diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-12 09:22:18 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-12 09:22:18 +0200 |
commit | fcbd7fae7c2208e01a7f670f8ba2f34d62ea6a4d (patch) | |
tree | 006c782df5ab4470ce5d87bba02595ca6366e1c7 | |
parent | d070107d6267f617bb7331d84507701c8e2d673c (diff) |
libdvbv5: detect SMTPE 302m audio format
When SMTPE 302m is used, the ES type is 6. Detecting weather
it has audio or not should be done via registration descriptor.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | lib/libdvbv5/dvb-file.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c index 474b59cb..0dd847f6 100644 --- a/lib/libdvbv5/dvb-file.c +++ b/lib/libdvbv5/dvb-file.c @@ -42,6 +42,7 @@ #include <libdvbv5/desc_sat.h> #include <libdvbv5/desc_terrestrial_delivery.h> #include <libdvbv5/desc_service.h> +#include <libdvbv5/desc_registration_id.h> #include <libdvbv5/desc_frequency_list.h> #include <libdvbv5/desc_event_short.h> #include <libdvbv5/desc_event_extended.h> @@ -1036,7 +1037,7 @@ static int sort_other_el_pid(const void *a_arg, const void *b_arg) static void get_pmt_descriptors(struct dvb_entry *entry, struct dvb_table_pmt *pmt) { - int has_ac3 = 0; + int has_audio = 0; int video_len = 0, audio_len = 0, other_len = 0; dvb_pmt_stream_foreach(stream, pmt) { @@ -1081,12 +1082,26 @@ static void get_pmt_descriptors(struct dvb_entry *entry, * DVB AC-3. So, need to seek for the AC-3 descriptors */ dvb_desc_find(struct dvb_desc_service, desc, stream, AC_3_descriptor) - has_ac3 = 1; + has_audio = 1; dvb_desc_find(struct dvb_desc_service, desc, stream, enhanced_AC_3_descriptor) - has_ac3 = 1; + has_audio = 1; + + dvb_desc_find(struct dvb_desc_service, desc, stream, + registration_descriptor) { + struct dvb_desc_registration *d = (void *) desc; + + /* + * Check if the data contains audio via the + * format identifier: + * + * 0x42535344 = SMPTE 302m + */ + if (d->format_identifier == 0x42535344) + has_audio = 1; + } - if (has_ac3) { + if (has_audio) { entry->audio_pid = realloc(entry->audio_pid, sizeof(*entry->audio_pid) * (audio_len + 1)); |