mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
tsdemux: Detect language from ac3 descriptor
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4709>
This commit is contained in:
parent
bdff780fe9
commit
0a331402d6
2 changed files with 19 additions and 0 deletions
|
@ -211,6 +211,10 @@
|
||||||
|
|
||||||
/* AC3_audio_stream_descriptor */
|
/* AC3_audio_stream_descriptor */
|
||||||
#define DESC_AC_AUDIO_STREAM_bsid(desc) ((desc)[2] & 0x1f)
|
#define DESC_AC_AUDIO_STREAM_bsid(desc) ((desc)[2] & 0x1f)
|
||||||
|
#define DESC_AC_AUDIO_STREAM_channels(desc) ((desc[4] >> 1) & 0x0f)
|
||||||
|
#define DESC_AC_AUDIO_STREAM_textlen(desc) ((desc[7 + (DESC_AC_AUDIO_STREAM_channels(desc)==0)] >> 1) & 0x7f)
|
||||||
|
#define DESC_AC_AUDIO_STREAM_has_lang1(desc) ((desc[8 + DESC_AC_AUDIO_STREAM_textlen(desc)] >> 7) & 0x01)
|
||||||
|
#define DESC_AC_AUDIO_STREAM_lang1_code(desc) (desc + 9 + DESC_AC_AUDIO_STREAM_textlen(desc))
|
||||||
|
|
||||||
/* FIXME : Move list of well know registration ids to an enum
|
/* FIXME : Move list of well know registration ids to an enum
|
||||||
* in the mpegts library.
|
* in the mpegts library.
|
||||||
|
|
|
@ -1269,6 +1269,21 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
|
||||||
const GstMpegtsDescriptor *desc = NULL;
|
const GstMpegtsDescriptor *desc = NULL;
|
||||||
int i, nb;
|
int i, nb;
|
||||||
|
|
||||||
|
if (bstream->stream_type == ST_PS_AUDIO_AC3 &&
|
||||||
|
!mpegts_get_descriptor_from_stream (bstream,
|
||||||
|
GST_MTS_DESC_DVB_ENHANCED_AC3)) {
|
||||||
|
const GstMpegtsDescriptor *ac3_desc =
|
||||||
|
mpegts_get_descriptor_from_stream (bstream,
|
||||||
|
GST_MTS_DESC_AC3_AUDIO_STREAM);
|
||||||
|
if (ac3_desc && DESC_AC_AUDIO_STREAM_has_lang1 (ac3_desc->data)) {
|
||||||
|
gchar lang_code[4];
|
||||||
|
|
||||||
|
memcpy (lang_code, DESC_AC_AUDIO_STREAM_lang1_code (ac3_desc->data), 3);
|
||||||
|
lang_code[3] = '\0';
|
||||||
|
add_iso639_language_to_tags (stream, lang_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
desc =
|
desc =
|
||||||
mpegts_get_descriptor_from_stream (bstream,
|
mpegts_get_descriptor_from_stream (bstream,
|
||||||
GST_MTS_DESC_ISO_639_LANGUAGE);
|
GST_MTS_DESC_ISO_639_LANGUAGE);
|
||||||
|
|
Loading…
Reference in a new issue