After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709180 - mpegts: Return GstMpegTsDescriptor in mpegts_get_descriptor_from_*
mpegts: Return GstMpegTsDescriptor in mpegts_get_descriptor_from_*
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-10-01 11:50 UTC by Jesper Larsen
Modified: 2013-10-11 08:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch v1 (5.06 KB, patch)
2013-10-01 11:50 UTC, Jesper Larsen
needs-work Details | Review
Patch v2 (10.59 KB, patch)
2013-10-07 06:40 UTC, Jesper Larsen
none Details | Review
0001-mpegts-Add-ISO-639-parsing-functions.patch (3.83 KB, patch)
2013-10-07 08:10 UTC, Jesper Larsen
committed Details | Review
0002-tsdemux-Return-descriptor-in-get_descriptor.patch (5.06 KB, patch)
2013-10-07 08:10 UTC, Jesper Larsen
committed Details | Review
0003-tsdemux-Use-mpegts-lib-for-ISO-639-language-tags.patch (1.70 KB, patch)
2013-10-07 08:10 UTC, Jesper Larsen
committed Details | Review
Fix assertion faults (1.18 KB, patch)
2013-10-10 20:49 UTC, Jesper Larsen
committed Details | Review

Description Jesper Larsen 2013-10-01 11:50:02 UTC
Created attachment 256178 [details] [review]
Patch v1

Patch on master to correct a FIXME.

The functions mpegts_get_descriptor_from_program and mpegts_get_descriptor_from_stream should return the GstMpegTsDescriptor instead of a pointer to descriptor data.

I have touched the parts that uses the functions, but I don't know if the preferred way is to pass desc->data to the macros, or if the macros should do the ->data?
Comment 1 Edward Hervey 2013-10-02 05:43:20 UTC
The part in mpegtsbase.[ch] is fine.

The usage is a bit more tricky. *Ideally* we should be using mpeg-ts-lib functions, but the one for languages is a bit heavy and we don't have one for ac3 descriptor.

For language, maybe we could have a one-shot variant:

gboolean
gst_mpegts_descriptor_parse_iso_639_language_idx
   (const GstMpegTsDescriptor *descriptor,
    guint idx, gchar *lang[4],
    GstMpegTsIso639AudioType *audio_type);

idx: index in the table (if you ask for something bigger than the size of the descriptor the method returns FALSE and you can stop iterating)
lang: output for the language code (NULL-terminated) for that index
audio_type: output for the audio_type for that index

This would allow doing
  while (gst_mpegts_descriptor_parse_iso_639_language_idx(desc, i, &lang, &type))
   {
      // do something
      i++;
   }


For the AC3 one I'm not 100% sure what the method should look like (The description of that descriptor is in ATSC A/52 specifications btw).
Comment 2 Jesper Larsen 2013-10-07 06:40:18 UTC
Created attachment 256598 [details] [review]
Patch v2

Reworked the patch a bit. Split up into 3 commits.

The first commit introduces new ISO 639 parsing functions in mpegts-lib:
A function to get a specific table id, as mentioned in the previous comment.
A function to get the number of languages in the descriptor.

The second commit does the change in return type for the mpegts_get_descriptor_from_* functions. This commit uses the descriptors in the old non-ideal ways in order to by able to compile.

The third commit changes the use of the language descriptor, so that the new mpegts-lib functions are used.

Seems like a bit of thought is needed regarding the AC3 parsing, as this descriptor holds quite a lot of information. Maybe we can work on the current patch set as a step in the right direction?
Comment 3 Edward Hervey 2013-10-07 07:50:54 UTC
Looks good.

Can you make 3 different git patches ? Make sure the commit messages are sensible ("tsdemux: ...." "mpegts:....") and not contain PATCH in it ?
Comment 4 Jesper Larsen 2013-10-07 08:10:05 UTC
Created attachment 256601 [details] [review]
0001-mpegts-Add-ISO-639-parsing-functions.patch

Splitting patch into three files
Comment 5 Jesper Larsen 2013-10-07 08:10:31 UTC
Created attachment 256602 [details] [review]
0002-tsdemux-Return-descriptor-in-get_descriptor.patch
Comment 6 Jesper Larsen 2013-10-07 08:10:51 UTC
Created attachment 256603 [details] [review]
0003-tsdemux-Use-mpegts-lib-for-ISO-639-language-tags.patch
Comment 7 Edward Hervey 2013-10-07 08:24:59 UTC
commit b6d33e5ce423473a0521fe1cbe1ccf1eb78ef3f3
Author: Jesper Larsen <knorr.jesper@gmail.com>
Date:   Sat Oct 5 14:45:33 2013 +0200

    tsdemux: Use mpegts-lib for ISO 639 language tags
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709180

commit 279bdef4ea5c16ff1c0e4b291bc50f10b866e429
Author: Jesper Larsen <knorr.jesper@gmail.com>
Date:   Sat Oct 5 14:45:32 2013 +0200

    tsdemux: Return descriptor in get_descriptor
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709180

commit 7cb434e42f95590ed5e57d925cdf51e44a94d930
Author: Jesper Larsen <knorr.jesper@gmail.com>
Date:   Sat Oct 5 14:45:31 2013 +0200

    mpegts: Add ISO 639 parsing functions
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709180
Comment 8 Sebastian Dröge (slomo) 2013-10-10 11:03:29 UTC
This causes assertions on the file from bug #709768 :

gst-launch-1.0 filesrc location=/home/slomo/Downloads/raw_h264.ts ! tsdemux ! decodebin ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

(gst-launch-1.0:29742): GStreamer-WARNING **: Trying to set string on taglist field 'language-code', but string is not valid UTF-8. Please file a bug.

** (gst-launch-1.0:29742): CRITICAL **: gst_mpegts_descriptor_parse_iso_639_language_idx: assertion 'descriptor->length / 4 > idx' failed

(gst-launch-1.0:29742): GStreamer-WARNING **: Trying to set string on taglist field 'language-code', but string is not valid UTF-8. Please file a bug.

** (gst-launch-1.0:29742): CRITICAL **: gst_mpegts_descriptor_parse_iso_639_language_idx: assertion 'descriptor->length / 4 > idx' failed
Comment 9 Jesper Larsen 2013-10-10 20:49:43 UTC
Created attachment 256948 [details] [review]
Fix assertion faults

Patch that fixes the assertion faults pointed out by Sebastian.
Tested with the file provided in bug #709768
Comment 10 Edward Hervey 2013-10-11 08:40:15 UTC
commit 0d577565127433174e218545680dd3ba7cb43354
Author: Jesper Larsen <knorr.jesper@gmail.com>
Date:   Thu Oct 10 22:46:48 2013 +0200

    mpegts: Fix assertion fault in ISO 639 parsing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709180