CVS Root: /cvs/gstreamer
Module: gst-plugins-bad
Changes by: msmith
Date: Fri Nov 21 2008 00:47:51 UTC
Log message:
* sys/dshowdecwrapper/gstdshowaudiodec.cpp:
Fix flushing/seeking problems returning error code.
Fix mp3 decoding with winXP (crashed randomly, occasionally).
* sys/dshowdecwrapper/gstdshowvideodec.cpp:
Fix problems when framerate is missing from video.
Modified files:
. : ChangeLog
sys/dshowdecwrapper: gstdshowaudiodec.cpp gstdshowvideodec.cpp
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3718&r2=1.3719
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/sys/dshowdecwrapper/gstdshowaudiodec.cpp.diff?r1=1.3&r2=1.4
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/sys/dshowdecwrapper/gstdshowvideodec.cpp.diff?r1=1.2&r2=1.3
====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3718
retrieving revision 1.3719
diff -u -d -r1.3718 -r1.3719
--- ChangeLog 20 Nov 2008 18:41:32 -0000 1.3718
+++ ChangeLog 21 Nov 2008 00:47:36 -0000 1.3719
@@ -1,3 +1,11 @@
+2008-11-20 Michael Smith <[email protected]>
+
+ * sys/dshowdecwrapper/gstdshowaudiodec.cpp:
+ Fix flushing/seeking problems returning error code.
+ Fix mp3 decoding with winXP (crashed randomly, occasionally).
+ * sys/dshowdecwrapper/gstdshowvideodec.cpp:
+ Fix problems when framerate is missing from video.
2008-11-20 Wim Taymans <[email protected]>
* gst/rtpmanager/gstrtpsession.c: (get_current_times),
Index: gstdshowaudiodec.cpp
RCS file: /cvs/gstreamer/gst-plugins-bad/sys/dshowdecwrapper/gstdshowaudiodec.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gstdshowaudiodec.cpp 30 Sep 2008 10:43:54 -0000 1.3
+++ gstdshowaudiodec.cpp 21 Nov 2008 00:47:36 -0000 1.4
@@ -619,7 +619,9 @@
/* flush dshow decoder and reset timestamp */
adec->fakesrc->GetOutputPin()->Flush();
adec->timestamp = GST_CLOCK_TIME_NONE;
+ adec->last_ret = GST_FLOW_OK;
return TRUE;
}
@@ -651,7 +653,7 @@
* decoder which doesn't need this */
if (adec->layer == 1 || adec->layer == 2) {
MPEG1WAVEFORMAT *mpeg1_format;
- int version, samples;
+ int samples, version;
GstStructure *structure = gst_caps_get_structure (caps, 0);
size = sizeof (MPEG1WAVEFORMAT);
@@ -702,12 +704,44 @@
{
size = sizeof (WAVEFORMATEX) +
(adec->codec_data ? GST_BUFFER_SIZE (adec->codec_data) : 0);
- format = (WAVEFORMATEX *)g_malloc0 (size);
- if (adec->codec_data) { /* Codec data is appended after our header */
- memcpy (((guchar *) format) + sizeof (WAVEFORMATEX),
- GST_BUFFER_DATA (adec->codec_data),
- GST_BUFFER_SIZE (adec->codec_data));
- format->cbSize = GST_BUFFER_SIZE (adec->codec_data);
+ if (adec->layer == 3) {
+ MPEGLAYER3WAVEFORMAT *mp3format;
+ /* The WinXP mp3 decoder doesn't actually check the size of this structure,
+ * but requires that this be allocated and filled out (or we get obscure
+ * random crashes)
+ */
+ size = sizeof (MPEGLAYER3WAVEFORMAT);
+ mp3format = (MPEGLAYER3WAVEFORMAT *)g_malloc0 (size);
+ format = (WAVEFORMATEX *)mp3format;
+ format->cbSize = MPEGLAYER3_WFX_EXTRA_BYTES;
+ mp3format->wID = MPEGLAYER3_ID_MPEG;
+ mp3format->fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO; /* No idea what this means for a decoder */
+ /* The XP decoder divides by nBlockSize, so we must set this to a
+ non-zero value, but it doesn't matter what - this is meaningless
+ for VBR mp3 anyway */
+ mp3format->nBlockSize = 1;
+ mp3format->nFramesPerBlock = 1;
+ mp3format->nCodecDelay = 0;
+ /* The XP decoder also has problems with some MP3 frames. If it tries
+ * to decode one, then forever after it outputs silence.
+ * If we recognise such a frame, just skip decoding it.
+ if (adec->decoder_is_xp_mp3)
+ adec->check_mp3_frames = TRUE;
+ }
+ else {
+ format = (WAVEFORMATEX *)g_malloc0 (size);
+ if (adec->codec_data) { /* Codec data is appended after our header */
+ memcpy (((guchar *) format) + sizeof (WAVEFORMATEX),
+ GST_BUFFER_DATA (adec->codec_data),
+ GST_BUFFER_SIZE (adec->codec_data));
+ format->cbSize = GST_BUFFER_SIZE (adec->codec_data);
+ }
}
format->wFormatTag = codec_entry->format;
Index: gstdshowvideodec.cpp
RCS file: /cvs/gstreamer/gst-plugins-bad/sys/dshowdecwrapper/gstdshowvideodec.cpp,v
retrieving revision 1.2
diff -u -d -r1.2 -r1.3
--- gstdshowvideodec.cpp 24 Sep 2008 17:21:41 -0000 1.2
+++ gstdshowvideodec.cpp 21 Nov 2008 00:47:37 -0000 1.3
@@ -539,13 +539,16 @@
goto end;
}
fps = gst_structure_get_value (s, "framerate");
- if (!fps) {
- GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,
- ("error getting video framerate from caps"), (NULL));
- goto end;
+ if (fps) {
+ vdec->fps_n = gst_value_get_fraction_numerator (fps);
+ vdec->fps_d = gst_value_get_fraction_denominator (fps);
+ }
+ else {
+ /* Invent a sane default framerate; the timestamps matter
+ * more anyway. */
+ vdec->fps_n = 25;
+ vdec->fps_d = 1;
- vdec->fps_n = gst_value_get_fraction_numerator (fps);
- vdec->fps_d = gst_value_get_fraction_denominator (fps);
if ((v = gst_structure_get_value (s, "codec_data")))
extradata = gst_value_get_buffer (v);
@@ -691,8 +694,13 @@
caps_out = gst_caps_from_string (klass->entry->srccaps);
gst_caps_set_simple (caps_out,
"width", G_TYPE_INT, vdec->width,
- "height", G_TYPE_INT, vdec->height,
- "framerate", GST_TYPE_FRACTION, vdec->fps_n, vdec->fps_d, NULL);
+ "height", G_TYPE_INT, vdec->height, NULL);
+ if (vdec->fps_n && vdec->fps_d) {
+ gst_caps_set_simple (caps_out,
+ "framerate", GST_TYPE_FRACTION, vdec->fps_n, vdec->fps_d, NULL);
if (!gst_pad_set_caps (vdec->srcpad, caps_out)) {
gst_caps_unref (caps_out);
GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.