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 622276 - Add an h263parse element
Add an h263parse element
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 0.10.22
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-21 11:02 UTC by Arun Raghavan
Modified: 2011-01-28 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
h263parse: Add h263parse element (45.18 KB, patch)
2010-06-21 11:02 UTC, Arun Raghavan
needs-work Details | Review
h263parse: Add h263parse element (updated) (46.22 KB, patch)
2010-07-07 13:21 UTC, Arun Raghavan
accepted-commit_after_freeze Details | Review
baseparse: Fix debug output (1.08 KB, patch)
2010-09-22 12:50 UTC, Arun Raghavan
committed Details | Review
baseparse: Allow chaining of subclass event handlers (1.39 KB, patch)
2010-09-22 12:50 UTC, Arun Raghavan
committed Details | Review
h263parse: Add an h263parse element (124.51 KB, patch)
2010-09-22 12:51 UTC, Arun Raghavan
none Details | Review
jpegformat: Push tags after setting srcpad caps (5.66 KB, patch)
2010-11-08 10:42 UTC, Arun Raghavan
none Details | Review
h263parse: Add an h263parse element (160.10 KB, patch)
2010-11-08 10:43 UTC, Arun Raghavan
none Details | Review
h263parse: handle absent sink pad caps and improve baseparse keyframe handling (4.24 KB, patch)
2010-11-08 19:23 UTC, Mark Nauwelaerts
none Details | Review
h263parse: handle absent sink pad caps and improve baseparse keyframe handling (4.27 KB, patch)
2010-11-16 16:59 UTC, Mark Nauwelaerts
none Details | Review

Description Arun Raghavan 2010-06-21 11:02:36 UTC
Created attachment 164206 [details] [review]
h263parse: Add h263parse element

I have written an h263parse element which determines stream codec and profile, and breaks up the incoming stream into frame-sized buffers. Attaching this as one large patch. The following repo might make for easier reviewing, however:

http://git.collabora.co.uk/?p=user/arun/gst-plugins-bad.git;a=summary
Comment 1 Edward Hervey 2010-06-21 14:07:17 UTC
Review of attachment 164206 [details] [review]:

::: gst/h263parse/h263parse.c
@@ +376,3 @@
+gst_h263_parse_get_params (GstH263Parse * h263parse, H263Params * params,
+    gboolean fast)
+{

it would be a bit cleaner if this was in a separate file ? Along with all the parsing-specific structures. Then it would leave only the gst-specific parts in gsth263parse.[ch]

@@ +808,3 @@
+
+static gint
+gst_h263_parse_get_profile (GstH263Parse * h263parse)

Same thing, this could be moved to a separate file and just take a H263Params structure as input.

@@ +930,3 @@
+
+static gint
+gst_h263_parse_get_level (GstH263Parse * h263parse)

Same comment as for get_profile

@@ +1081,3 @@
+    if (h263parse->profile != -1)
+      gst_caps_set_simple (caps, "profile", G_TYPE_STRING,
+          profiles[h263parse->profile], NULL);

If profile is only going to be a numerical value, let's keep it as an integer.

@@ +1086,3 @@
+    if (h263parse->level != -1) {
+      level_idx = (h263parse->level / 10) + (h263parse->level % 10) - 1;
+      gst_caps_set_simple (caps, "level", G_TYPE_STRING, levels[level_idx],

Same comment as for profile.

::: gst/h263parse/h263parse.h
@@ +67,3 @@
+  H263_OPTION_DPS_MODE  = 1 << 14
+} H263OptionalFeatures;
+

Since this is a plugin, there's maybe no need to have this flag definition here

@@ +104,3 @@
+  UUI_IS_01,
+} H263UUI;
+

Same comment for all structures above.

@@ +128,3 @@
+  H263ParseState        state;
+} H263Params;
+

These too
Comment 2 Arun Raghavan 2010-06-28 09:15:33 UTC
(In reply to comment #1)
> Review of attachment 164206 [details] [review]:
> 
> ::: gst/h263parse/h263parse.c
> @@ +376,3 @@
> +gst_h263_parse_get_params (GstH263Parse * h263parse, H263Params * params,
> +    gboolean fast)
> +{
> 
> it would be a bit cleaner if this was in a separate file ? Along with all the
> parsing-specific structures. Then it would leave only the gst-specific parts in
> gsth263parse.[ch]

Can do.


> @@ +808,3 @@
> +
> +static gint
> +gst_h263_parse_get_profile (GstH263Parse * h263parse)
> 
> Same thing, this could be moved to a separate file and just take a H263Params
> structure as input.
> 
> @@ +930,3 @@
> +
> +static gint
> +gst_h263_parse_get_level (GstH263Parse * h263parse)
> 
> Same comment as for get_profile

Can move to a separate file. get_level needs to take a GstH263Parse* since the bitrate isn't part of params (and IMHO should not be, since it basically represents stream params parsed out of the header). I let get_profile also take the same parameter for consistency, but I'm open to changing this.


> @@ +1081,3 @@
> +    if (h263parse->profile != -1)
> +      gst_caps_set_simple (caps, "profile", G_TYPE_STRING,
> +          profiles[h263parse->profile], NULL);
> 
> If profile is only going to be a numerical value, let's keep it as an integer.
> 
> @@ +1086,3 @@
> +    if (h263parse->level != -1) {
> +      level_idx = (h263parse->level / 10) + (h263parse->level % 10) - 1;
> +      gst_caps_set_simple (caps, "level", G_TYPE_STRING, levels[level_idx],
> 
> Same comment as for profile.

Since some codecs have non-numeric profiles/levels, I figured we should just keep them all as strings instead of having to worry about which codec has a string profile vs. which has an integer profile. Again, I'm not too religious about this, so if the common feeling is to go with integers here, I'll change it.


> ::: gst/h263parse/h263parse.h
> @@ +67,3 @@
> +  H263_OPTION_DPS_MODE  = 1 << 14
> +} H263OptionalFeatures;
> +
> 
> Since this is a plugin, there's maybe no need to have this flag definition here
> 
> @@ +104,3 @@
> +  UUI_IS_01,
> +} H263UUI;
> +
> 
> Same comment for all structures above.
> 
> @@ +128,3 @@
> +  H263ParseState        state;
> +} H263Params;
> +
> 
> These too

Since the header is never installed, will this make a difference?
Comment 3 Edward Hervey 2010-07-07 09:58:37 UTC
(In reply to comment #2)
> > @@ +930,3 @@
> > +
> > +static gint
> > +gst_h263_parse_get_level (GstH263Parse * h263parse)
> > 
> > Same comment as for get_profile
> 
> Can move to a separate file. get_level needs to take a GstH263Parse* since the
> bitrate isn't part of params (and IMHO should not be, since it basically
> represents stream params parsed out of the header). I let get_profile also take
> the same parameter for consistency, but I'm open to changing this.

  If you only need one extra parameter, can't you just add it as a return argument ?

> 
> 
> > @@ +1081,3 @@
> > +    if (h263parse->profile != -1)
> > +      gst_caps_set_simple (caps, "profile", G_TYPE_STRING,
> > +          profiles[h263parse->profile], NULL);
> > 
> > If profile is only going to be a numerical value, let's keep it as an integer.
> > 
> > @@ +1086,3 @@
> > +    if (h263parse->level != -1) {
> > +      level_idx = (h263parse->level / 10) + (h263parse->level % 10) - 1;
> > +      gst_caps_set_simple (caps, "level", G_TYPE_STRING, levels[level_idx],
> > 
> > Same comment as for profile.
> 
> Since some codecs have non-numeric profiles/levels, I figured we should just
> keep them all as strings instead of having to worry about which codec has a
> string profile vs. which has an integer profile. Again, I'm not too religious
> about this, so if the common feeling is to go with integers here, I'll change
> it.

  If for this media type we only have numerical values, let's stick with integers, makes the parsing code easier to handle (and therefore less bug-prone).

> 
> 
> > ::: gst/h263parse/h263parse.h
> > @@ +67,3 @@
> > +  H263_OPTION_DPS_MODE  = 1 << 14
> > +} H263OptionalFeatures;
> > +
> > 
> > Since this is a plugin, there's maybe no need to have this flag definition here
> > 
> > @@ +104,3 @@
> > +  UUI_IS_01,
> > +} H263UUI;
> > +
> > 
> > Same comment for all structures above.
> > 
> > @@ +128,3 @@
> > +  H263ParseState        state;
> > +} H263Params;
> > +
> > 
> > These too
> 
> Since the header is never installed, will this make a difference?

  Just cleaner code :)
Comment 4 Arun Raghavan 2010-07-07 13:21:53 UTC
Created attachment 165411 [details] [review]
h263parse: Add h263parse element (updated)

Incorporated all feedback and pushed to the tree I linked to previously. Attaching an updated, squashed patch.
Comment 5 Edward Hervey 2010-08-30 15:30:58 UTC
Comment on attachment 165411 [details] [review]
h263parse: Add h263parse element (updated)

Looks good for committing once -bad is released.
Comment 6 Arun Raghavan 2010-08-31 12:58:57 UTC
Comment on attachment 165411 [details] [review]
h263parse: Add h263parse element (updated)

There is a bug in the current patch which breaks debug output. I'm going to try to move this to use baseparse, and will push an updated patch when I'm done.
Comment 7 Edward Hervey 2010-09-17 08:30:57 UTC
Any news on this ?
Comment 8 Arun Raghavan 2010-09-17 15:36:20 UTC
I'm changing the code to use baseparse. Will post that here soon.
Comment 9 Arun Raghavan 2010-09-22 12:50:54 UTC
Created attachment 170829 [details] [review]
baseparse: Fix debug output

We lose the reference to the buffer after gst_pad_push(), so the debug
print should happen before.
Comment 10 Arun Raghavan 2010-09-22 12:50:59 UTC
Created attachment 170830 [details] [review]
baseparse: Allow chaining of subclass event handlers

This allows the child class to chain its event handler with
GstBaseParse, so that subclasses don't have to duplicate all the default
event handling logic.
Comment 11 Arun Raghavan 2010-09-22 12:51:05 UTC
Created attachment 170831 [details] [review]
h263parse: Add an h263parse element

This adds an h263parse element for parsing H.263 streams, breaking them
up into frame-sized buffers, and exporting metadata such as profile and
level.
Comment 12 Arun Raghavan 2010-09-22 12:53:31 UTC
Attached a minor baseparse fix, one enhancement to allow event handler chaining, and subsequently a reworked h263parse element that derives from baseparse.

For now, I've made a copy of gstbaseparse.[ch] in h263parse/, but this can be gotten rid of when baseparse moves to -base.
Comment 13 Arun Raghavan 2010-11-08 10:42:17 UTC
Created attachment 174049 [details] [review]
jpegformat: Push tags after setting srcpad caps

This patch defers emission of tag events till caps are set on the source
pad of jpegparse, so that these tags can be seen downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=627211
Comment 14 Arun Raghavan 2010-11-08 10:43:00 UTC
Comment on attachment 174049 [details] [review]
jpegformat: Push tags after setting srcpad caps

Whoops, wrong patch. Sorry about the spam.
Comment 15 Arun Raghavan 2010-11-08 10:43:24 UTC
Comment on attachment 170831 [details] [review]
h263parse: Add an h263parse element

Attaching an updated patch with Mark's latest baseparse changes.
Comment 16 Arun Raghavan 2010-11-08 10:43:29 UTC
Created attachment 174050 [details] [review]
h263parse: Add an h263parse element

This adds an h263parse element for parsing H.263 streams, breaking them
up into frame-sized buffers, and exporting metadata such as profile and
level.
Comment 17 Mark Nauwelaerts 2010-11-08 19:23:59 UTC
Created attachment 174089 [details] [review]
h263parse: handle absent sink pad caps and improve baseparse keyframe handling

Attached incremental patch (though it can be merged) should prevent critical complaints when using h263parse with raw input (no sink caps), and makes baseparse more keyframe aware (in particular not dropping keyframe before a segment).
Comment 18 Mark Nauwelaerts 2010-11-16 16:59:32 UTC
Created attachment 174612 [details] [review]
h263parse: handle absent sink pad caps and improve baseparse keyframe handling

Despite testing, previous version of patch had a silly error, this updated one should now take care ...
Comment 19 Mark Nauwelaerts 2011-01-26 16:10:27 UTC
So I now have h263parse pending locally, along with a (new) h264parse based on baseparse (though functionally equivalent to old h264parse).

To limit proliferation of baseparse, the intended plan is:
* have h263parse and h264parse in a videoparsers directory
(along with a copy *ouch* of baseparse)
* rename old h264parse to legacyh264parse (none rank and all)
* remove legacyh264parse altogether after some grace period

Note that baseparse itself has also seen (quite) some changes/updates, and will far less likely see more of those as long as several copies are out there, so it would be convenient (to say the least) if it could make it elsewhere (e.g. -base), albeit in whatever experimental state (worked long enough for playbin2).

Comments ?  Expected doom ?
Comment 20 Tim-Philipp Müller 2011-01-27 15:47:49 UTC
> Comments ?  Expected doom ?

1. w00t

Moving forward I'd go for this:

2. let's add a -bad/gst/videoparsers/ with an internal copy of the modified baseparse for now, to get the code out there and get it tested etc.

3. let's keep the baseparses in gst/audioparsers/ and gst/videoparsers/ in sync

4. do some performance measurements to make sure we're not regressing majorly from the non-baseparse implementation (in h264parse) case, and also test backwards playback.

5. get API reviewed, also compare with GstBaseVideoParse in -bad/gst-libs/gst/video/

6. then add new base class to core/base as appropriate (depends on whether we keep it generic or decide to go for dedicated audio/video classes I guess), and move code in -bad to that
Comment 21 Mark Nauwelaerts 2011-01-28 11:56:02 UTC
commit b33b88e4bb2d192f7064feb558e325813f4b06ba
Author: Arun Raghavan <arun.raghavan@collabora.co.uk>
Date:   Fri May 14 02:08:03 2010 +0530

    h263parse: Add an h263parse element
    
    This adds an h263parse element for parsing H.263 streams, breaking them
    up into frame-sized buffers, and exporting metadata such as profile and
    level.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622276

(and some following ones ...)