From: <sl...@ke...> - 2008-08-02 18:11:36
|
CVS Root: /cvs/gstreamer Module: gst-plugins-good Changes by: slomo Date: Sat Aug 02 2008 18:11:47 UTC Log message: * gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_setcaps): Fix muxing of MP3/MP2 with different MPEG versions by calculating the duration of a frame with the new mpegaudioversion caps field. Modified files: . : ChangeLog gst/matroska : matroska-mux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3628&r2=1.3629 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/matroska/matroska-mux.c.diff?r1=1.67&r2=1.68 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v retrieving revision 1.3628 retrieving revision 1.3629 diff -u -d -r1.3628 -r1.3629 --- ChangeLog 2 Aug 2008 18:06:19 -0000 1.3628 +++ ChangeLog 2 Aug 2008 18:11:31 -0000 1.3629 @@ -1,5 +1,12 @@ 2008-08-02 Sebastian Dröge <seb...@co...> + * gst/matroska/matroska-mux.c: + (gst_matroska_mux_audio_pad_setcaps): + Fix muxing of MP3/MP2 with different MPEG versions by calculating the + duration of a frame with the new mpegaudioversion caps field. + +2008-08-02 Sebastian Dröge <seb...@co...> * gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize), (gst_matroska_demux_class_init), (gst_matroska_demux_init), (gst_matroska_demux_combine_flows), (gst_matroska_demux_reset), Index: matroska-mux.c RCS file: /cvs/gstreamer/gst-plugins-good/gst/matroska/matroska-mux.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- matroska-mux.c 2 Aug 2008 18:01:36 -0000 1.67 +++ matroska-mux.c 2 Aug 2008 18:11:32 -0000 1.68 @@ -978,27 +978,38 @@ switch (mpegversion) { case 1:{ gint layer; - - /* FIXME: number of samples per frame also depends on the mpegversion - * which we don't pass as a caps field - */ + gint version = 1; + gint spf; gst_structure_get_int (structure, "layer", &layer); + if (!gst_structure_get_int (structure, "mpegaudioversion", &version)) { + GST_WARNING_OBJECT (mux, + "Unable to determine MPEG audio version, assuming 1"); + version = 1; + } + if (layer == 1) + spf = 384; + else if (layer == 2) + spf = 1152; + else if (version == 2) + spf = 576; + else + context->default_duration = + gst_util_uint64_scale (GST_SECOND, spf, audiocontext->samplerate); switch (layer) { case 1: context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1); - context->default_duration = - 384 * GST_SECOND / audiocontext->samplerate; break; case 2: context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2); - 1152 * GST_SECOND / audiocontext->samplerate; case 3: context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3); default: return FALSE; |