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 330317 - New xingmux element for writing Xing headers
New xingmux element for writing Xing headers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: High normal
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-02-07 21:53 UTC by Christophe Fergeau
Modified: 2006-05-03 21:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The patch (6.60 KB, patch)
2006-02-07 21:54 UTC, Christophe Fergeau
needs-work Details | Review
Updated patch, added ChangeLog entry and a missing g_free. Compile tested only (7.82 KB, patch)
2006-02-16 20:26 UTC, Christophe Fergeau
none Details | Review
Xing header writer as a separate element (C file) (9.25 KB, text/x-csrc)
2006-03-04 12:09 UTC, Christophe Fergeau
  Details
Xing header writer (H file) (1.74 KB, text/x-chdr)
2006-03-04 12:11 UTC, Christophe Fergeau
  Details
Mark the xingheader property as obsolete in the lame element (939 bytes, patch)
2006-03-04 12:20 UTC, Christophe Fergeau
accepted-commit_now Details | Review
Updated version of the C file (10.11 KB, text/x-csrc)
2006-03-05 17:05 UTC, Christophe Fergeau
  Details
Cleaned up code (13.70 KB, patch)
2006-03-07 18:34 UTC, Christophe Fergeau
none Details | Review
Added missing gst_buffer_set_caps (13.88 KB, patch)
2006-03-09 17:56 UTC, Christophe Fergeau
reviewed Details | Review
Committed patch (1.56 KB, patch)
2006-03-11 11:13 UTC, Christophe Fergeau
committed Details | Review

Description Christophe Fergeau 2006-02-07 21:53:31 UTC
Here is a patch which writes a proper Xing header to mp3s creating with the lame element. I guess this would fit better in a separate xingmux element, I can do that if needed. Atm I'm mainly attaching this patch since it works for me (though the number of frames written to the header is 1 less than the number of frames in the original mp3 when I do a mad ! lame transcoding) and I'd like to get some feedback on it (about things to improve).
Comment 1 Christophe Fergeau 2006-02-07 21:54:17 UTC
Created attachment 58887 [details] [review]
The patch
Comment 2 Christophe Fergeau 2006-02-08 07:51:56 UTC
I forgot at least one thing, a g_free in gst_lame_finalize.
Comment 3 Andy Wingo 2006-02-13 09:38:07 UTC
Hi Christophe,

Mind updating this one with the cleanup fixes, and with a changelog entry?
Comment 4 Christophe Fergeau 2006-02-16 20:26:59 UTC
Created attachment 59522 [details] [review]
Updated patch, added ChangeLog entry and a missing g_free. Compile tested only
Comment 5 Andy Wingo 2006-02-28 09:28:57 UTC
Thanks for the patch! Raising priority so someone can have a look at it sooner.
Comment 6 Christophe Fergeau 2006-02-28 09:30:06 UTC
Fwiw I (slowly) started to write a xingmux element yesterday evening, so it might be worth waiting a week or two to see if I finish it or not ;)
Comment 7 Christophe Fergeau 2006-03-04 12:09:31 UTC
Created attachment 60632 [details]
Xing header writer as a separate element (C file)

I finished to put the Xing header code in a separate header, it seems to be working quite well and not leaking resource. I'm unsure I'm doing the right thing in the state change functions though (dunno if I should reset the header state when going from PAUSE to READY or from READY to NULL), and I don't know if there are events I should handle apart from EOS. I'm not sure the method I'm using to seek at the beginning of the stream to output my header is the best one. And it's also missing seek table support.
Comment 8 Christophe Fergeau 2006-03-04 12:11:03 UTC
Created attachment 60633 [details]
Xing header writer (H file)

I'm unsure where these 2 files should be put, for now I modified gst-plugins-ugly/ext/lame/Makefile.am to build them, but maybe they should go somewhere else?
Comment 9 Christophe Fergeau 2006-03-04 12:20:42 UTC
Created attachment 60634 [details] [review]
Mark the xingheader property as obsolete in the lame element

It's probably a bad idea to remove an existing property from the lame element, but we could at least mark it as obsolete (if the xingmux element gets in obviously ;)
Comment 10 Christophe Fergeau 2006-03-05 17:05:26 UTC
Created attachment 60699 [details]
Updated version of the C file

This new version handles NEW_SEGMENT events.
Comment 11 Christophe Fergeau 2006-03-06 22:22:19 UTC
Ok, no need to review that for now, I'll have to take into account some of the comments done in bug #333501 first since they apply to the code in that element as well.
Comment 12 Christophe Fergeau 2006-03-07 18:34:09 UTC
Created attachment 60852 [details] [review]
Cleaned up code
Comment 13 Christophe Fergeau 2006-03-07 18:34:56 UTC
Since the input and ouput caps are identical, do I need to call buffer_set_caps in my chain function? (it's not done currently)
Comment 14 Tim-Philipp Müller 2006-03-07 18:45:14 UTC
Generally not, but you probably need to call it on the xing header buffer if that's the first buffer you send out.
Comment 15 Christophe Fergeau 2006-03-09 17:56:32 UTC
Created attachment 60992 [details] [review]
Added missing gst_buffer_set_caps

I'm wondering if the file names (gst-xing-header.c) are in line with gstreamer conventions (if there are any conventions about file names)
Comment 16 Tim-Philipp Müller 2006-03-10 13:26:55 UTC
So here goes the usual nitpicking:

 * the filenames should be gstxingmux.[ch], not gst-xing-mux.[ch]

 * the plugin name in GST_PLUGIN_DEFINE should be "xingheader" or "xing",
   and the plugin filename in Makefile.am should be libgstxingheader.so
   or libgstxing.so (the element is then still called "xingmux"). That way
   it's possible to list the plugin details separately in gst-inspect, and
   also it matches the directory naming (gst/xingheader/). Just a personal
   preference of mine though, there are plenty of cases where this isn't done.

 * Here
      const gchar mp3_header[4] = {0xff, 0xfb, 0x90, 0x44};
   you should use guint8 or guchar.

 * for elements that aren't base classes for other elements you don't
   really need private structs like GstXingMuxPriv, as the header file
   is not installed, so there aren't any ABI/API issues here. Doesn't
   hurt to have it of course, just thought I'd mention it.


Feel free to commit to -bad when you think it's ready (do change the filenames though).



Comment 17 Christophe Fergeau 2006-03-11 11:13:59 UTC
Created attachment 61080 [details] [review]
Committed patch

Here is the patch I committed. Should the xingheader property be marked as obsolete in lame, or should we keep it as is for now?
Comment 18 Tim-Philipp Müller 2006-03-11 16:48:01 UTC
Does xingmux already do everything that lame does when writing the tag?

If yes, I'd say mark the lame property as deprecated and recommend xingmux instead. If not, better wait until xingmux is feature-equivalent for now.
Comment 19 Christophe Fergeau 2006-03-11 17:16:45 UTC
xingmux writes far less info than the command-line lame binary, but xing header writing from the gstreamer lame element never worked properly, ie it didn't even properly write the correct length because of limitations in liblame API. So xingmux is already a far better replacement (ie a working one) to the xingheader=TRUE gstlame property. 
Comment 20 Tim-Philipp Müller 2006-03-11 17:29:34 UTC
Cool, let's deprecate it then :)
Comment 21 Christophe Fergeau 2006-03-11 19:21:28 UTC
Is the patch from comment #9 ok to commit? (it's probably better to replace OBSOLETE with BROKEN in it). Or are there different ways to deprecate it?
Comment 22 Tim-Philipp Müller 2006-03-11 20:00:31 UTC
Oh, didn't see that one. Sure, the patch looks fine - please commit it.

Comment 23 Christophe Fergeau 2006-03-12 11:00:51 UTC
It's done.