continue;
e = htsmsg_create_map();
- htsmsg_add_str(e, "type", streaming_component_type2txt(ssc->ssc_type));
- if (ssc->ssc_lang[0])
- htsmsg_add_str(e, "language", ssc->ssc_lang);
-
- if(SCT_ISAUDIO(ssc->ssc_type)) {
- htsmsg_add_u32(e, "audio_type", ssc->ssc_audio_type);
- if(ssc->ssc_audio_version)
- htsmsg_add_u32(e, "audio_version", ssc->ssc_audio_version);
- if(ssc->ssc_sri < 16)
- snprintf(sr, sizeof(sr), "%d", sri_to_rate(ssc->ssc_sri));
+ htsmsg_add_str(e, "type", streaming_component_type2txt(ssc->es_type));
+ if (ssc->es_lang[0])
+ htsmsg_add_str(e, "language", ssc->es_lang);
+
+ if(SCT_ISAUDIO(ssc->es_type)) {
+ htsmsg_add_u32(e, "audio_type", ssc->es_audio_type);
+ if(ssc->es_audio_version)
+ htsmsg_add_u32(e, "audio_version", ssc->es_audio_version);
+ if(ssc->es_sri < 16)
+ snprintf(sr, sizeof(sr), "%d", sri_to_rate(ssc->es_sri));
else
strcpy(sr, "?");
- if(ssc->ssc_channels == 6)
+ if(ssc->es_channels == 6)
snprintf(ch, sizeof(ch), "5.1");
- else if(ssc->ssc_channels == 0)
+ else if(ssc->es_channels == 0)
strcpy(ch, "?");
else
- snprintf(ch, sizeof(ch), "%d", ssc->ssc_channels);
+ snprintf(ch, sizeof(ch), "%d", ssc->es_channels);
} else {
sr[0] = ch[0] = 0;
}
- if(SCT_ISVIDEO(ssc->ssc_type)) {
- if(ssc->ssc_width && ssc->ssc_height)
+ if(SCT_ISVIDEO(ssc->es_type)) {
+ if(ssc->es_width && ssc->es_height)
snprintf(res, sizeof(res), "%dx%d",
- ssc->ssc_width, ssc->ssc_height);
+ ssc->es_width, ssc->es_height);
else
strcpy(res, "?");
- if(ssc->ssc_aspect_num && ssc->ssc_aspect_den)
+ if(ssc->es_aspect_num && ssc->es_aspect_den)
snprintf(asp, sizeof(asp), "%d:%d",
- ssc->ssc_aspect_num, ssc->ssc_aspect_den);
+ ssc->es_aspect_num, ssc->es_aspect_den);
else
strcpy(asp, "?");
- htsmsg_add_u32(e, "width", ssc->ssc_width);
- htsmsg_add_u32(e, "height", ssc->ssc_height);
- htsmsg_add_u32(e, "duration", ssc->ssc_frameduration);
- htsmsg_add_u32(e, "aspect_num", ssc->ssc_aspect_num);
- htsmsg_add_u32(e, "aspect_den", ssc->ssc_aspect_den);
+ htsmsg_add_u32(e, "width", ssc->es_width);
+ htsmsg_add_u32(e, "height", ssc->es_height);
+ htsmsg_add_u32(e, "duration", ssc->es_frame_duration);
+ htsmsg_add_u32(e, "aspect_num", ssc->es_aspect_num);
+ htsmsg_add_u32(e, "aspect_den", ssc->es_aspect_den);
} else {
res[0] = asp[0] = 0;
}
- if (SCT_ISSUBTITLE(ssc->ssc_type)) {
- htsmsg_add_u32(e, "composition_id", ssc->ssc_composition_id);
- htsmsg_add_u32(e, "ancillary_id", ssc->ssc_ancillary_id);
+ if (SCT_ISSUBTITLE(ssc->es_type)) {
+ htsmsg_add_u32(e, "composition_id", ssc->es_composition_id);
+ htsmsg_add_u32(e, "ancillary_id", ssc->es_ancillary_id);
}
tvhinfo(LS_DVR,
"%2d %-16s %-4s %-10s %-12s %-11s %-8s %s",
- ssc->ssc_index,
- streaming_component_type2txt(ssc->ssc_type),
- ssc->ssc_lang,
+ ssc->es_index,
+ streaming_component_type2txt(ssc->es_type),
+ ssc->es_lang,
res,
asp,
sr,
return PTS_UNSET;
for (i = 0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
- if (ssc->ssc_index == pkt->pkt_componentindex) {
- if (SCT_ISVIDEO(ssc->ssc_type))
+ if (ssc->es_index == pkt->pkt_componentindex) {
+ if (SCT_ISVIDEO(ssc->es_type))
return pkt->pkt_dts;
- if (audio == PTS_UNSET && SCT_ISAUDIO(ssc->ssc_type))
+ if (audio == PTS_UNSET && SCT_ISAUDIO(ssc->es_type))
audio = pkt->pkt_dts;
}
}
n = 0;
TAILQ_FOREACH(st, &set->set_filter, es_filter_link) {
streaming_start_component_t *ssc = &ss->ss_components[n++];
- ssc->ssc_index = st->es_index;
- ssc->ssc_type = st->es_type;
-
- memcpy(ssc->ssc_lang, st->es_lang, 4);
- ssc->ssc_audio_type = st->es_audio_type;
- ssc->ssc_audio_version = st->es_audio_version;
- ssc->ssc_composition_id = st->es_composition_id;
- ssc->ssc_ancillary_id = st->es_ancillary_id;
- ssc->ssc_pid = st->es_pid;
- ssc->ssc_width = st->es_width;
- ssc->ssc_height = st->es_height;
- ssc->ssc_frameduration = st->es_frame_duration;
+ *(elementary_info_t *)ssc = *(elementary_info_t *)st;
}
ss->ss_refcount = 1;
typedef struct streaming_start streaming_start_t;
typedef enum streaming_component_type streaming_component_type_t;
+typedef struct elementary_info elementary_info_t;
typedef struct elementary_stream elementary_stream_t;
typedef struct elementary_set elementary_set_t;
#define SCT_ISSUBTITLE(t) ((t) == SCT_TEXTSUB || (t) == SCT_DVBSUB)
/**
- * Stream, one media component for a service.
+ * Stream info, one media component for a service.
*/
-struct elementary_stream {
- TAILQ_ENTRY(elementary_stream) es_link;
- TAILQ_ENTRY(elementary_stream) es_filter_link;
-
- uint32_t es_position;
- struct service *es_service;
-
- streaming_component_type_t es_type;
+struct elementary_info {
int es_index;
-
- char *es_nicename;
-
- /* PID related */
int16_t es_pid;
- uint16_t es_parent_pid; /* For subtitle streams originating from
- a teletext stream. this is the pid
- of the teletext stream */
- int8_t es_pid_opened; /* PID is opened */
- int8_t es_cc; /* Last CC */
-
- /* CA ID's on this stream */
- struct caid_list es_caids;
+ int es_type;
- /* */
- int es_delete_me; /* Temporary flag for deleting streams */
-
- /* Stream info */
int es_frame_duration;
int es_width;
char es_lang[4]; /* ISO 639 2B 3-letter language code */
uint8_t es_audio_type; /* Audio type */
uint8_t es_audio_version; /* Audio version/layer */
+ uint8_t es_sri;
+ uint8_t es_ext_sri;
+ uint16_t es_channels;
uint16_t es_composition_id;
uint16_t es_ancillary_id;
+};
+
+/**
+ * Stream, one media component for a service.
+ */
+struct elementary_stream {
+ elementary_info_t;
+
+ TAILQ_ENTRY(elementary_stream) es_link;
+ TAILQ_ENTRY(elementary_stream) es_filter_link;
+
+ uint32_t es_position;
+ struct service *es_service;
+ char *es_nicename;
+
+ /* PID related */
+ uint16_t es_parent_pid; /* For subtitle streams originating from
+ a teletext stream. this is the pid
+ of the teletext stream */
+ int8_t es_pid_opened; /* PID is opened */
+ int8_t es_cc; /* Last CC */
+ int8_t es_delete_me; /* Temporary flag for deleting streams */
+
+ struct caid_list es_caids; /* CA ID's on this stream */
- /* Error log limiters */
- tvhlog_limit_t es_cc_log;
- /* Filter temporary variable */
- uint32_t es_filter;
+ tvhlog_limit_t es_cc_log; /* CC error log limiter */
+ uint32_t es_filter; /* Filter temporary variable */
- /* HBBTV PSI table (AIT) */
- mpegts_psi_table_t es_psi;
+ mpegts_psi_table_t es_psi; /* HBBTV PSI table (AIT) */
};
/*
for(i = 0; i < ss->ss_num_components; i++) {
const streaming_start_component_t *ssc = &ss->ss_components[i];
if (ssc->ssc_disabled) continue;
- if (SCT_ISVIDEO(ssc->ssc_type)) {
- if (ssc->ssc_width == 0 || ssc->ssc_height == 0) {
+ if (SCT_ISVIDEO(ssc->es_type)) {
+ if (ssc->es_width == 0 || ssc->es_height == 0) {
hs->hs_wait_for_video = 1;
return;
}
if(ssc->ssc_disabled) continue;
c = htsmsg_create_map();
- htsmsg_add_u32(c, "index", ssc->ssc_index);
- if (ssc->ssc_type == SCT_MP4A)
+ htsmsg_add_u32(c, "index", ssc->es_index);
+ if (ssc->es_type == SCT_MP4A)
type = "AAC"; /* override */
else
- type = streaming_component_type2txt(ssc->ssc_type);
+ type = streaming_component_type2txt(ssc->es_type);
htsmsg_add_str(c, "type", type);
- if(ssc->ssc_lang[0])
- htsmsg_add_str(c, "language", ssc->ssc_lang);
+ if(ssc->es_lang[0])
+ htsmsg_add_str(c, "language", ssc->es_lang);
- if(ssc->ssc_type == SCT_DVBSUB) {
- htsmsg_add_u32(c, "composition_id", ssc->ssc_composition_id);
- htsmsg_add_u32(c, "ancillary_id", ssc->ssc_ancillary_id);
+ if(ssc->es_type == SCT_DVBSUB) {
+ htsmsg_add_u32(c, "composition_id", ssc->es_composition_id);
+ htsmsg_add_u32(c, "ancillary_id", ssc->es_ancillary_id);
}
- if(SCT_ISVIDEO(ssc->ssc_type)) {
- if(ssc->ssc_width)
- htsmsg_add_u32(c, "width", ssc->ssc_width);
- if(ssc->ssc_height)
- htsmsg_add_u32(c, "height", ssc->ssc_height);
- if(ssc->ssc_frameduration)
- htsmsg_add_u32(c, "duration", hs->hs_90khz ? ssc->ssc_frameduration :
- ts_rescale(ssc->ssc_frameduration, 1000000));
- if (ssc->ssc_aspect_num)
- htsmsg_add_u32(c, "aspect_num", ssc->ssc_aspect_num);
- if (ssc->ssc_aspect_den)
- htsmsg_add_u32(c, "aspect_den", ssc->ssc_aspect_den);
+ if(SCT_ISVIDEO(ssc->es_type)) {
+ if(ssc->es_width)
+ htsmsg_add_u32(c, "width", ssc->es_width);
+ if(ssc->es_height)
+ htsmsg_add_u32(c, "height", ssc->es_height);
+ if(ssc->es_frame_duration)
+ htsmsg_add_u32(c, "duration", hs->hs_90khz ? ssc->es_frame_duration :
+ ts_rescale(ssc->es_frame_duration, 1000000));
+ if (ssc->es_aspect_num)
+ htsmsg_add_u32(c, "aspect_num", ssc->es_aspect_num);
+ if (ssc->es_aspect_den)
+ htsmsg_add_u32(c, "aspect_den", ssc->es_aspect_den);
}
- if (SCT_ISAUDIO(ssc->ssc_type))
+ if (SCT_ISAUDIO(ssc->es_type))
{
- htsmsg_add_u32(c, "audio_type", ssc->ssc_audio_type);
- if (ssc->ssc_audio_version)
- htsmsg_add_u32(c, "audio_version", ssc->ssc_audio_version);
- if (ssc->ssc_channels)
- htsmsg_add_u32(c, "channels", ssc->ssc_channels);
- if (ssc->ssc_sri)
- htsmsg_add_u32(c, "rate", ssc->ssc_sri);
+ htsmsg_add_u32(c, "audio_type", ssc->es_audio_type);
+ if (ssc->es_audio_version)
+ htsmsg_add_u32(c, "audio_version", ssc->es_audio_version);
+ if (ssc->es_channels)
+ htsmsg_add_u32(c, "channels", ssc->es_channels);
+ if (ssc->es_sri)
+ htsmsg_add_u32(c, "rate", ssc->es_sri);
}
if (ssc->ssc_gh)
for (i = count = 0; i < ss->ss_num_components;i++) {
ssc = &ss->ss_components[i];
- if ((!ssc->ssc_disabled) && (SCT_ISAUDIO(ssc->ssc_type))) {
+ if ((!ssc->ssc_disabled) && (SCT_ISAUDIO(ssc->es_type))) {
if (m->m_config.u.audioes.m_force_type != MC_UNKNOWN) {
- mc = audioes_muxer_type(ssc->ssc_type);
+ mc = audioes_muxer_type(ssc->es_type);
if (m->m_config.u.audioes.m_force_type != mc)
continue;
}
ssc = audioes_get_component(m, ss);
if (ssc)
- mc = audioes_muxer_type(ssc->ssc_type);
+ mc = audioes_muxer_type(ssc->es_type);
return muxer_container_type2mime(mc, 0);
}
ssc = audioes_get_component(m, ss);
if (ssc)
- am->am_index = ssc->ssc_index;
+ am->am_index = ssc->es_index;
return 0;
}
if (!st)
return -1;
- st->id = ssc->ssc_index;
+ st->id = ssc->es_index;
c = st->codec;
- c->codec_id = streaming_component_type2codec_id(ssc->ssc_type);
+ c->codec_id = streaming_component_type2codec_id(ssc->es_type);
switch(lm->m_config.m_type) {
case MC_MATROSKA:
}
if(ssc->ssc_gh) {
- if (ssc->ssc_type == SCT_H264 || ssc->ssc_type == SCT_HEVC) {
+ if (ssc->es_type == SCT_H264 || ssc->es_type == SCT_HEVC) {
sbuf_t hdr;
sbuf_init(&hdr);
- if (ssc->ssc_type == SCT_H264) {
+ if (ssc->es_type == SCT_H264) {
isom_write_avcc(&hdr, pktbuf_ptr(ssc->ssc_gh),
pktbuf_len(ssc->ssc_gh));
} else {
}
}
- if(SCT_ISAUDIO(ssc->ssc_type)) {
+ if(SCT_ISAUDIO(ssc->es_type)) {
c->codec_type = AVMEDIA_TYPE_AUDIO;
c->sample_fmt = AV_SAMPLE_FMT_S16;
- c->sample_rate = sri_to_rate(ssc->ssc_sri);
- c->channels = ssc->ssc_channels;
+ c->sample_rate = sri_to_rate(ssc->es_sri);
+ c->channels = ssc->es_channels;
#if 0
c->time_base.num = 1;
c->time_base = st->time_base;
#endif
- av_dict_set(&st->metadata, "language", ssc->ssc_lang, 0);
+ av_dict_set(&st->metadata, "language", ssc->es_lang, 0);
- } else if(SCT_ISVIDEO(ssc->ssc_type)) {
+ } else if(SCT_ISVIDEO(ssc->es_type)) {
c->codec_type = AVMEDIA_TYPE_VIDEO;
- c->width = ssc->ssc_width;
- c->height = ssc->ssc_height;
+ c->width = ssc->es_width;
+ c->height = ssc->es_height;
c->time_base.num = 1;
c->time_base.den = 25;
- c->sample_aspect_ratio.num = ssc->ssc_aspect_num;
- c->sample_aspect_ratio.den = ssc->ssc_aspect_den;
+ c->sample_aspect_ratio.num = ssc->es_aspect_num;
+ c->sample_aspect_ratio.den = ssc->es_aspect_den;
if (lm->m_config.m_type == MC_AVMP4) {
/* this is a whole hell */
st->sample_aspect_ratio.num = c->sample_aspect_ratio.num;
st->sample_aspect_ratio.den = c->sample_aspect_ratio.den;
- } else if(SCT_ISSUBTITLE(ssc->ssc_type)) {
+ } else if(SCT_ISSUBTITLE(ssc->es_type)) {
c->codec_type = AVMEDIA_TYPE_SUBTITLE;
- av_dict_set(&st->metadata, "language", ssc->ssc_lang, 0);
+ av_dict_set(&st->metadata, "language", ssc->es_lang, 0);
}
if(lm->lm_oc->oformat->flags & AVFMT_GLOBALHEADER)
if(ssc->ssc_disabled)
continue;
- if(!lav_muxer_support_stream(m->m_config.m_type, ssc->ssc_type))
+ if(!lav_muxer_support_stream(m->m_config.m_type, ssc->es_type))
continue;
- has_video |= SCT_ISVIDEO(ssc->ssc_type);
- has_audio |= SCT_ISAUDIO(ssc->ssc_type);
+ has_video |= SCT_ISVIDEO(ssc->es_type);
+ has_audio |= SCT_ISAUDIO(ssc->es_type);
}
if(has_video)
if(ssc->ssc_disabled)
continue;
- if(!lav_muxer_support_stream(lm->m_config.m_type, ssc->ssc_type)) {
+ if(!lav_muxer_support_stream(lm->m_config.m_type, ssc->es_type)) {
tvhwarn(LS_LIBAV, "%s is not supported in %s",
- streaming_component_type2txt(ssc->ssc_type),
+ streaming_component_type2txt(ssc->es_type),
muxer_container_type2txt(lm->m_config.m_type));
ssc->ssc_muxer_disabled = 1;
continue;
if(lav_muxer_add_stream(lm, ssc)) {
tvherror(LS_LIBAV, "Failed to add %s stream",
- streaming_component_type2txt(ssc->ssc_type));
+ streaming_component_type2txt(ssc->es_type));
ssc->ssc_muxer_disabled = 1;
continue;
}
tr = &mk->tracks[i];
tr->disabled = ssc->ssc_disabled;
- tr->index = ssc->ssc_index;
+ tr->index = ssc->es_index;
if(tr->disabled)
continue;
- tr->type = ssc->ssc_type;
- tr->channels = ssc->ssc_channels;
- tr->aspect_num = ssc->ssc_aspect_num;
- tr->aspect_den = ssc->ssc_aspect_den;
+ tr->type = ssc->es_type;
+ tr->channels = ssc->es_channels;
+ tr->aspect_num = ssc->es_aspect_num;
+ tr->aspect_den = ssc->es_aspect_den;
tr->commercial = COMMERCIAL_UNKNOWN;
- tr->sri = ssc->ssc_sri;
+ tr->sri = ssc->es_sri;
tr->nextpts = PTS_UNSET;
- if (mk->webm && ssc->ssc_type != SCT_VP8 && ssc->ssc_type != SCT_VORBIS)
+ if (mk->webm && ssc->es_type != SCT_VP8 && ssc->es_type != SCT_VORBIS)
tvhwarn(LS_MKV, "WEBM format supports only VP8+VORBIS streams (detected %s)",
- streaming_component_type2txt(ssc->ssc_type));
+ streaming_component_type2txt(ssc->es_type));
- switch(ssc->ssc_type) {
+ switch(ssc->es_type) {
case SCT_MPEG2VIDEO:
tracktype = 1;
codec_id = "V_MPEG2";
case SCT_MPEG2AUDIO:
tracktype = 2;
codec_id = "A_MPEG/L2";
- if (ssc->ssc_audio_version == 3)
+ if (ssc->es_audio_version == 3)
codec_id = "A_MPEG/L3";
- else if (ssc->ssc_audio_version == 1)
+ else if (ssc->es_audio_version == 1)
codec_id = "A_MPEG/L1";
break;
ebml_append_uint(t, 0x9c, 0); // Lacing
ebml_append_string(t, 0x86, codec_id);
- if(ssc->ssc_lang[0])
- ebml_append_string(t, 0x22b59c, ssc->ssc_lang);
+ if(ssc->es_lang[0])
+ ebml_append_string(t, 0x22b59c, ssc->es_lang);
- switch(ssc->ssc_type) {
+ switch(ssc->es_type) {
case SCT_HEVC:
case SCT_H264:
case SCT_MPEG2VIDEO:
uint8_t *header_start[3];
int header_len[3];
int j;
- int first_header_size = ssc->ssc_type == SCT_VORBIS ? 30 : 42;
+ int first_header_size = ssc->es_type == SCT_VORBIS ? 30 : 42;
if(mk_split_xiph_headers(pktbuf_ptr(ssc->ssc_gh), pktbuf_len(ssc->ssc_gh),
first_header_size, header_start, header_len)) {
break;
case SCT_DVBSUB:
- buf4[0] = ssc->ssc_composition_id >> 8;
- buf4[1] = ssc->ssc_composition_id;
- buf4[2] = ssc->ssc_ancillary_id >> 8;
- buf4[3] = ssc->ssc_ancillary_id;
+ buf4[0] = ssc->es_composition_id >> 8;
+ buf4[1] = ssc->es_composition_id;
+ buf4[2] = ssc->es_ancillary_id >> 8;
+ buf4[3] = ssc->es_ancillary_id;
ebml_append_bin(t, 0x63a2, buf4, 4);
break;
}
- if(SCT_ISVIDEO(ssc->ssc_type)) {
+ if(SCT_ISVIDEO(ssc->es_type)) {
htsbuf_queue_t *vi = htsbuf_queue_alloc(0);
- if(ssc->ssc_frameduration) {
- int d = ts_rescale(ssc->ssc_frameduration, 1000000000);
+ if(ssc->es_frame_duration) {
+ int d = ts_rescale(ssc->es_frame_duration, 1000000000);
ebml_append_uint(t, 0x23e383, d);
}
- ebml_append_uint(vi, 0xb0, ssc->ssc_width);
- ebml_append_uint(vi, 0xba, ssc->ssc_height);
+ ebml_append_uint(vi, 0xb0, ssc->es_width);
+ ebml_append_uint(vi, 0xba, ssc->es_height);
- if (ssc->ssc_aspect_num && ssc->ssc_aspect_den) {
+ if (ssc->es_aspect_num && ssc->es_aspect_den) {
if (mk->webm) {
- ebml_append_uint(vi, 0x54b0, (ssc->ssc_height * ssc->ssc_aspect_num) / ssc->ssc_aspect_den);
- ebml_append_uint(vi, 0x54ba, ssc->ssc_height);
+ ebml_append_uint(vi, 0x54b0, (ssc->es_height * ssc->es_aspect_num) / ssc->es_aspect_den);
+ ebml_append_uint(vi, 0x54ba, ssc->es_height);
ebml_append_uint(vi, 0x54b2, 0); // DisplayUnit: pixels because DAR is not supported by webm
} else {
- ebml_append_uint(vi, 0x54b0, ssc->ssc_aspect_num);
- ebml_append_uint(vi, 0x54ba, ssc->ssc_aspect_den);
+ ebml_append_uint(vi, 0x54b0, ssc->es_aspect_num);
+ ebml_append_uint(vi, 0x54ba, ssc->es_aspect_den);
ebml_append_uint(vi, 0x54b2, 3); // DisplayUnit: DAR
}
}
ebml_append_master(t, 0xe0, vi);
}
- if(SCT_ISAUDIO(ssc->ssc_type)) {
+ if(SCT_ISAUDIO(ssc->es_type)) {
htsbuf_queue_t *au = htsbuf_queue_alloc(0);
- ebml_append_float(au, 0xb5, sri_to_rate(ssc->ssc_sri));
- if (ssc->ssc_ext_sri)
- ebml_append_float(au, 0x78b5, sri_to_rate(ssc->ssc_ext_sri - 1));
- ebml_append_uint(au, 0x9f, ssc->ssc_channels);
+ ebml_append_float(au, 0xb5, sri_to_rate(ssc->es_sri));
+ if (ssc->es_ext_sri)
+ ebml_append_float(au, 0x78b5, sri_to_rate(ssc->es_ext_sri - 1));
+ ebml_append_uint(au, 0x9f, ssc->es_channels);
if (bit_depth)
ebml_append_uint(au, 0x6264, bit_depth);
if(ssc->ssc_disabled)
continue;
- has_video |= SCT_ISVIDEO(ssc->ssc_type);
- has_audio |= SCT_ISAUDIO(ssc->ssc_type);
+ has_video |= SCT_ISVIDEO(ssc->es_type);
+ has_audio |= SCT_ISAUDIO(ssc->es_type);
}
if(has_video)
for (i = 0; i < pm->pm_ss->ss_num_components; i++) {
ssc = &pm->pm_ss->ss_components[i];
- if (ssc->ssc_pid == pid)
+ if (ssc->es_pid == pid)
break;
}
if (i < pm->pm_ss->ss_num_components) {
if(ssc->ssc_disabled)
continue;
- has_video |= SCT_ISVIDEO(ssc->ssc_type);
- has_audio |= SCT_ISAUDIO(ssc->ssc_type);
+ has_video |= SCT_ISVIDEO(ssc->es_type);
+ has_audio |= SCT_ISAUDIO(ssc->es_type);
}
if(si->si_type == S_MPEG_TS)
for(i=0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
- if (!SCT_ISVIDEO(ssc->ssc_type) && !SCT_ISAUDIO(ssc->ssc_type))
+ if (!SCT_ISVIDEO(ssc->es_type) && !SCT_ISAUDIO(ssc->es_type))
continue;
- if (ssc->ssc_pid == DVB_SDT_PID && pm->pm_rewrite_sdt) {
+ if (ssc->es_pid == DVB_SDT_PID && pm->pm_rewrite_sdt) {
tvhwarn(LS_PASS, "SDT PID shared with A/V, rewrite disabled");
pm->pm_rewrite_sdt = 0;
}
- if (ssc->ssc_pid == DVB_EIT_PID && pm->pm_rewrite_eit) {
+ if (ssc->es_pid == DVB_EIT_PID && pm->pm_rewrite_eit) {
tvhwarn(LS_PASS, "EIT PID shared with A/V, rewrite disabled");
pm->pm_rewrite_eit = 0;
}
return (muxer_t *)pm;
}
-
for (i = 0; i < ss->ss_num_components; i++) {
pes = &prs->prs_es[i];
ssc = &ss->ss_components[i];
- parser_init_es(&prs->prs_es[i], prs, ssc->ssc_type);
+ parser_init_es(&prs->prs_es[i], prs, ssc->es_type);
pes->es_service = prs->prs_service;
- pes->es_index = ssc->ssc_index;
- pes->es_pid = ssc->ssc_pid;
+ pes->es_index = ssc->es_index;
+ pes->es_pid = ssc->es_pid;
if (pes->es_pid != -1) {
snprintf(buf, sizeof(buf), "%s: %s @ #%d",
service_nicename(prs->prs_service),
static void
apply_header(streaming_start_component_t *ssc, th_pkt_t *pkt)
{
- if(ssc->ssc_frameduration == 0 && pkt->pkt_duration != 0)
- ssc->ssc_frameduration = pkt->pkt_duration;
+ if(ssc->es_frame_duration == 0 && pkt->pkt_duration != 0)
+ ssc->es_frame_duration = pkt->pkt_duration;
- if(SCT_ISAUDIO(ssc->ssc_type) && !ssc->ssc_channels) {
- ssc->ssc_channels = pkt->a.pkt_channels;
- ssc->ssc_sri = pkt->a.pkt_sri;
- ssc->ssc_ext_sri = pkt->a.pkt_ext_sri;
+ if(SCT_ISAUDIO(ssc->es_type) && !ssc->es_channels) {
+ ssc->es_channels = pkt->a.pkt_channels;
+ ssc->es_sri = pkt->a.pkt_sri;
+ ssc->es_ext_sri = pkt->a.pkt_ext_sri;
}
- if(SCT_ISVIDEO(ssc->ssc_type)) {
+ if(SCT_ISVIDEO(ssc->es_type)) {
if(pkt->v.pkt_aspect_num && pkt->v.pkt_aspect_den) {
- ssc->ssc_aspect_num = pkt->v.pkt_aspect_num;
- ssc->ssc_aspect_den = pkt->v.pkt_aspect_den;
+ ssc->es_aspect_num = pkt->v.pkt_aspect_num;
+ ssc->es_aspect_den = pkt->v.pkt_aspect_den;
}
}
return;
}
- if (ssc->ssc_type == SCT_MP4A || ssc->ssc_type == SCT_AAC) {
+ if (ssc->es_type == SCT_MP4A || ssc->es_type == SCT_AAC) {
ssc->ssc_gh = pktbuf_alloc(NULL, pkt->a.pkt_ext_sri ? 5 : 2);
uint8_t *d = pktbuf_ptr(ssc->ssc_gh);
static int
header_complete(streaming_start_component_t *ssc, int not_so_picky)
{
- int is_video = SCT_ISVIDEO(ssc->ssc_type);
- int is_audio = !is_video && SCT_ISAUDIO(ssc->ssc_type);
+ int is_video = SCT_ISVIDEO(ssc->es_type);
+ int is_audio = !is_video && SCT_ISAUDIO(ssc->es_type);
- if((is_audio || is_video) && ssc->ssc_frameduration == 0)
+ if((is_audio || is_video) && ssc->es_frame_duration == 0)
return 0;
if(is_video) {
- if(!not_so_picky && (ssc->ssc_aspect_num == 0 || ssc->ssc_aspect_den == 0 ||
- ssc->ssc_width == 0 || ssc->ssc_height == 0))
+ if(!not_so_picky && (ssc->es_aspect_num == 0 || ssc->es_aspect_den == 0 ||
+ ssc->es_width == 0 || ssc->es_height == 0))
return 0;
}
- if(is_audio && !ssc->ssc_channels)
+ if(is_audio && !ssc->es_channels)
return 0;
- if(ssc->ssc_gh == NULL && gh_require_meta(ssc->ssc_type))
+ if(ssc->ssc_gh == NULL && gh_require_meta(ssc->es_type))
return 0;
return 1;
if (f->pr_pkt->pkt_dts != PTS_UNSET) {
ssc = streaming_start_component_find_by_index
(gh->gh_ss, f->pr_pkt->pkt_componentindex);
- if (ssc && ssc->ssc_index == index)
+ if (ssc && ssc->es_index == index)
break;
}
f = TAILQ_NEXT(f, pr_link);
if (l->pr_pkt->pkt_dts != PTS_UNSET) {
ssc = streaming_start_component_find_by_index
(gh->gh_ss, l->pr_pkt->pkt_componentindex);
- if (ssc && ssc->ssc_index == index)
+ if (ssc && ssc->es_index == index)
break;
}
l = TAILQ_PREV(l, th_pktref_queue, pr_link);
for(i = 0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
- qd[i] = gh_is_audiovideo(ssc->ssc_type) ?
- gh_queue_delay(gh, ssc->ssc_index) : 0;
+ qd[i] = gh_is_audiovideo(ssc->es_type) ?
+ gh_queue_delay(gh, ssc->es_index) : 0;
if (qd[i] > qd_max)
qd_max = qd[i];
}
if(threshold || (qd[i] <= 0 && qd_max > (MAX_SCAN_TIME * 90) / 2)) {
ssc->ssc_disabled = 1;
tvhdebug(LS_GLOBALHEADERS, "gh disable stream %d %s%s%s (PID %i) threshold %d qd %"PRId64" qd_max %"PRId64,
- ssc->ssc_index, streaming_component_type2txt(ssc->ssc_type),
- ssc->ssc_lang[0] ? " " : "", ssc->ssc_lang, ssc->ssc_pid,
+ ssc->es_index, streaming_component_type2txt(ssc->es_type),
+ ssc->es_lang[0] ? " " : "", ssc->es_lang, ssc->es_pid,
threshold, qd[i], qd_max);
} else {
return 0;
for(i = 0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
tvhtrace(LS_GLOBALHEADERS, "stream %d %s%s%s (PID %i) complete time %"PRId64"%s",
- ssc->ssc_index, streaming_component_type2txt(ssc->ssc_type),
- ssc->ssc_lang[0] ? " " : "", ssc->ssc_lang, ssc->ssc_pid,
- gh_queue_delay(gh, ssc->ssc_index),
+ ssc->es_index, streaming_component_type2txt(ssc->es_type),
+ ssc->es_lang[0] ? " " : "", ssc->es_lang, ssc->es_pid,
+ gh_queue_delay(gh, ssc->es_index),
ssc->ssc_disabled ? " disabled" : "");
}
}
streaming_msg_free(sm);
- if(!gh_is_audiovideo(ssc->ssc_type))
+ if(!gh_is_audiovideo(ssc->es_type))
break;
if(!headers_complete(gh))
for(i = 0; i < ss->ss_num_components; i++) {
const streaming_start_component_t *ssc = &ss->ss_components[i];
- tfs = tsfix_add_stream(tf, ssc->ssc_index, ssc->ssc_type);
+ tfs = tsfix_add_stream(tf, ssc->es_index, ssc->es_type);
if (tfs->tfs_video) {
- if (ssc->ssc_width == 0 || ssc->ssc_height == 0)
+ if (ssc->es_width == 0 || ssc->es_height == 0)
/* only first video stream may be valid */
vwait = !hasvideo ? 1 : 0;
hasvideo = 1;
streaming_start_component_t *ssc;
int i;
for(i = 0, ssc = ss->ss_components; i < ss->ss_num_components; i++, ssc++)
- if(ssc->ssc_index == idx)
+ if(ssc->es_index == idx)
return ssc;
return NULL;
}
pthread_mutex_lock(&global_lock);
memoryinfo_unregister(&streaming_msg_memoryinfo);
pthread_mutex_unlock(&global_lock);
-}
+}
\ No newline at end of file
*
*/
struct streaming_start_component {
- int ssc_index;
- int ssc_type;
- char ssc_lang[4];
- uint8_t ssc_audio_type;
- uint8_t ssc_audio_version;
- uint16_t ssc_composition_id;
- uint16_t ssc_ancillary_id;
- uint16_t ssc_pid;
- int16_t ssc_width;
- int16_t ssc_height;
- int16_t ssc_aspect_num;
- int16_t ssc_aspect_den;
- uint8_t ssc_sri;
- uint8_t ssc_ext_sri;
- uint8_t ssc_channels;
+ elementary_info_t;
+
uint8_t ssc_disabled;
uint8_t ssc_muxer_disabled;
pktbuf_t *ssc_gh;
-
- int ssc_frameduration;
-
};
/* Update video index */
for (i = 0; i < ss->ss_num_components; i++)
- if (SCT_ISVIDEO(ss->ss_components[i].ssc_type)) {
- ts->vididx = ss->ss_components[i].ssc_index;
+ if (SCT_ISVIDEO(ss->ss_components[i].es_type)) {
+ ts->vididx = ss->ss_components[i].es_index;
break;
}
}
tvherror(LS_CODEC, "unknown type for profile '%s'", self->name);
return -1;
}
- if (out_type == ssc->ssc_type) {
+ if (out_type == ssc->es_type) {
idclass = (&self->idnode)->in_class;
while (idclass) {
codec_profile_class = (codec_profile_class_t *)idclass;
// TODO: fix me
// assuming default channel_layout (AV_CH_LAYOUT_STEREO)
// and sample_rate (48kHz) for input
- int ssc_channels = ssc->ssc_channels ? ssc->ssc_channels : 2;
- int ssc_sr = ssc->ssc_sri ? sri_to_rate(ssc->ssc_sri) : 48000;
+ int ssc_channels = ssc->es_channels ? ssc->es_channels : 2;
+ int ssc_sr = ssc->es_sri ? sri_to_rate(ssc->es_sri) : 48000;
if ((self->channel_layout &&
ssc_channels != av_get_channel_layout_nb_channels(self->channel_layout)) ||
(self->sample_rate && ssc_sr != self->sample_rate)) {
static int
tvh_codec_profile_video_setup(TVHVideoCodecProfile *self, tvh_ssc_t *ssc)
{
- self->size.den = ssc->ssc_height;
- self->size.num = ssc->ssc_width;
+ self->size.den = ssc->es_height;
+ self->size.num = ssc->es_width;
if (self->height) {
self->size.den = self->height;
self->size.den += self->size.den & 1;
- self->size.num = self->size.den * ((double)ssc->ssc_width / ssc->ssc_height);
+ self->size.num = self->size.den * ((double)ssc->es_width / ssc->es_height);
self->size.num += self->size.num & 1;
}
return 0;
static int
tvh_codec_profile_video_is_copy(TVHVideoCodecProfile *self, tvh_ssc_t *ssc)
{
- return (!self->deinterlace && (self->size.den == ssc->ssc_height));
+ return (!self->deinterlace && (self->size.den == ssc->es_height));
}
do { \
_stream_log((level), fmt, \
(transcoder), \
- (ssc)->ssc_index, \
- (ssc)->ssc_type, \
+ (ssc)->es_index, \
+ (ssc)->es_type, \
##__VA_ARGS__); \
} while (0)
if (src_codecs && *src_codecs != '\0' && *src_codecs != '-') {
list = htsmsg_csv_2_list(src_codecs, ',');
if (list) {
- txtname = streaming_component_type2txt(ssc->ssc_type);
+ txtname = streaming_component_type2txt(ssc->es_type);
r = htsmsg_is_string_in_list(list, txtname);
htsmsg_destroy(list);
if (r)
static int
tvh_stream_setup(TVHStream *self, TVHCodecProfile *profile, tvh_ssc_t *ssc)
{
- enum AVCodecID icodec_id = streaming_component_type2codec_id(ssc->ssc_type);
+ enum AVCodecID icodec_id = streaming_component_type2codec_id(ssc->es_type);
AVCodec *icodec = NULL, *ocodec = NULL;
if (icodec_id == AV_CODEC_ID_NONE) {
tvh_stream_log(self, LOG_ERR, "unknown decoder id for '%s'",
- streaming_component_type2txt(ssc->ssc_type));
+ streaming_component_type2txt(ssc->es_type));
return -1;
}
#if ENABLE_MMAL
#endif
if (!icodec && !(icodec = avcodec_find_decoder(icodec_id))) {
tvh_stream_log(self, LOG_ERR, "failed to find decoder for '%s'",
- streaming_component_type2txt(ssc->ssc_type));
+ streaming_component_type2txt(ssc->es_type));
return -1;
}
if (!(ocodec = tvh_codec_profile_get_avcodec(profile))) {
icodec, ocodec, ssc->ssc_gh))) {
return -1;
}
- self->type = ssc->ssc_type = codec_id2streaming_component_type(ocodec->id);
- if (ssc->ssc_type == SCT_UNKNOWN) {
+ self->type = ssc->es_type = codec_id2streaming_component_type(ocodec->id);
+ if (ssc->es_type == SCT_UNKNOWN) {
tvh_stream_log(self, LOG_ERR, "unable to translate AV type %s [%d] to SCT!", ocodec->name, ocodec->id);
}
ssc->ssc_gh = NULL;
return NULL;
}
self->transcoder = transcoder;
- self->id = self->index = ssc->ssc_index;
- self->type = ssc->ssc_type;
+ self->id = self->index = ssc->es_index;
+ self->type = ssc->es_type;
if ((is_copy = tvh_stream_is_copy(profile, ssc, src_codecs)) > 0) {
self->is_copy = 1;
if (ssc->ssc_gh) {
if (ssc->ssc_disabled) {
return AVMEDIA_TYPE_UNKNOWN;
}
- if (SCT_ISVIDEO(ssc->ssc_type)) {
+ if (SCT_ISVIDEO(ssc->es_type)) {
return AVMEDIA_TYPE_VIDEO;
}
- if (SCT_ISAUDIO(ssc->ssc_type)) {
+ if (SCT_ISAUDIO(ssc->es_type)) {
return AVMEDIA_TYPE_AUDIO;
}
- if (SCT_ISSUBTITLE(ssc->ssc_type)) {
+ if (SCT_ISSUBTITLE(ssc->es_type)) {
return AVMEDIA_TYPE_SUBTITLE;
}
return AVMEDIA_TYPE_UNKNOWN;
{
if (*index >= 0)
return 0;
- if (lang && strcmp(lang, ssc->ssc_lang) == 0) {
+ if (lang && strcmp(lang, ssc->es_lang) == 0) {
*index = value;
return 1;
}
if (j < count)
continue;
ssc_src = &ss_src->ss_components[i];
- switch (ssc_src->ssc_type) {
+ switch (ssc_src->es_type) {
case SCT_CA:
case SCT_HBBTV:
case SCT_TELETEXT: