diff --git a/ChangeLog b/ChangeLog index ff827785e6..0970503b5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2004-12-18 Ronald S. Bultje + + * ext/ffmpeg/gstffmpeg.c: + * ext/ffmpeg/gstffmpegcodecmap.c: + * ext/ffmpeg/gstffmpegcodecmap.h: + * ext/ffmpeg/gstffmpegcolorspace.c: + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain): + * ext/ffmpeg/gstffmpegdemux.c: + * ext/ffmpeg/gstffmpegenc.c: + * ext/ffmpeg/gstffmpegmux.c: + * ext/ffmpeg/gstffmpegprotocol.c: + Add debugging category everywhere (correctly this time). Don't + parse mp3 data (the parser is a piece of crap). Fixes #155274 + mostly. Seeking pending. + 2004-12-18 Ronald S. Bultje * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps): diff --git a/ext/ffmpeg/gstffmpeg.c b/ext/ffmpeg/gstffmpeg.c index 545b2b31f6..caf23992c9 100644 --- a/ext/ffmpeg/gstffmpeg.c +++ b/ext/ffmpeg/gstffmpeg.c @@ -33,16 +33,9 @@ #include #endif -GST_DEBUG_CATEGORY_STATIC (ffmpeg_debug); -#define GST_CAT_DEFAULT ffmpeg_debug +#include "gstffmpeg.h" -extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin); -extern gboolean gst_ffmpegdec_register (GstPlugin * plugin); -extern gboolean gst_ffmpegenc_register (GstPlugin * plugin); -extern gboolean gst_ffmpegmux_register (GstPlugin * plugin); -extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin); - -extern URLProtocol gstreamer_protocol; +GST_DEBUG_CATEGORY (ffmpeg_debug); static void gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl) diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index 1c53524a29..019f859a27 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -30,6 +30,7 @@ #endif #include +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" /* diff --git a/ext/ffmpeg/gstffmpegcodecmap.h b/ext/ffmpeg/gstffmpegcodecmap.h index 1cb94fade4..7226bdaa76 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.h +++ b/ext/ffmpeg/gstffmpegcodecmap.h @@ -120,15 +120,5 @@ int gst_ffmpeg_img_convert (AVPicture * dst, int dst_pix_fmt, const AVPicture * src, int src_pix_fmt, int src_width, int src_height); - -/* - * FFMPEG debugging function; maybe move to a different file. - */ - -GST_DEBUG_CATEGORY_EXTERN (ffmpeg_debug); - -static void -gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl); - #endif /* __GST_FFMPEG_CODECMAP_H__ */ diff --git a/ext/ffmpeg/gstffmpegcolorspace.c b/ext/ffmpeg/gstffmpegcolorspace.c index ffe35832d4..0b1f59ece4 100644 --- a/ext/ffmpeg/gstffmpegcolorspace.c +++ b/ext/ffmpeg/gstffmpegcolorspace.c @@ -30,6 +30,7 @@ #include #endif +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" #define GST_TYPE_FFMPEGCSP \ diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 4d95542cbc..b4adcd10cd 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -32,6 +32,7 @@ #include +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" typedef struct _GstFFMpegDec GstFFMpegDec; @@ -462,6 +463,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) return; } + GST_DEBUG ("Received new data of size %d", GST_BUFFER_SIZE (inbuf)); + /* FIXME: implement event awareness (especially EOS * (av_close_codec ()) and FLUSH/DISCONT * (avcodec_flush_buffers ())) @@ -490,7 +493,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) do { /* parse, if at all possible */ - if (ffmpegdec->pctx) { + if (ffmpegdec->pctx && ffmpegdec->context->codec_id != CODEC_ID_MP3) { gint res; res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, @@ -515,6 +518,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) case CODEC_TYPE_VIDEO: len = avcodec_decode_video (ffmpegdec->context, ffmpegdec->picture, &have_data, data, size); + GST_DEBUG ("Decode video: len=%d, have_data=%d", len, have_data); if (len >= 0 && have_data) { /* libavcodec constantly crashes on stupid buffer allocation @@ -557,6 +561,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) outbuf = gst_buffer_new_and_alloc (AVCODEC_MAX_AUDIO_FRAME_SIZE); len = avcodec_decode_audio (ffmpegdec->context, (int16_t *) GST_BUFFER_DATA (outbuf), &have_data, data, size); + GST_DEBUG ("Decode audio: len=%d, have_data=%d", len, have_data); + if (have_data < 0) { GST_WARNING_OBJECT (ffmpegdec, "FFmpeg error: len %d, have_data: %d < 0 !", @@ -587,9 +593,13 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) GST_ERROR_OBJECT (ffmpegdec, "ffdec_%s: decoding error", oclass->in_plugin->name); break; + } else if (len == 0) { + break; } if (have_data) { + GST_DEBUG ("Decoded data, now pushing"); + if (!GST_PAD_CAPS (ffmpegdec->srcpad)) { if (!gst_ffmpegdec_negotiate (ffmpegdec)) { gst_buffer_unref (outbuf); @@ -603,13 +613,15 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) gst_buffer_unref (outbuf); } - if (!ffmpegdec->pctx) { + if (!ffmpegdec->pctx || ffmpegdec->context->codec_id == CODEC_ID_MP3) { bsize -= len; bdata += len; } } while (bsize > 0); if (ffmpegdec->pctx && bsize > 0) { + GST_DEBUG ("Keeping %d bytes of data", bsize); + ffmpegdec->pcache = gst_buffer_create_sub (inbuf, GST_BUFFER_SIZE (inbuf) - bsize, bsize); } diff --git a/ext/ffmpeg/gstffmpegdemux.c b/ext/ffmpeg/gstffmpegdemux.c index c3577ef04e..dfda037866 100644 --- a/ext/ffmpeg/gstffmpegdemux.c +++ b/ext/ffmpeg/gstffmpegdemux.c @@ -32,6 +32,7 @@ #include +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" typedef struct _GstFFMpegDemux GstFFMpegDemux; diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index 3d77415ea8..7fd2cc2fd4 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c @@ -32,6 +32,7 @@ #include +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" typedef struct _GstFFMpegEnc GstFFMpegEnc; diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index 7eeb4db6b2..ae858f28a2 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -30,6 +30,7 @@ #include +#include "gstffmpeg.h" #include "gstffmpegcodecmap.h" typedef struct _GstFFMpegMux GstFFMpegMux; diff --git a/ext/ffmpeg/gstffmpegprotocol.c b/ext/ffmpeg/gstffmpegprotocol.c index a644cffdab..51af68b0d9 100644 --- a/ext/ffmpeg/gstffmpegprotocol.c +++ b/ext/ffmpeg/gstffmpegprotocol.c @@ -31,6 +31,7 @@ #include #include +#include "gstffmpeg.h" typedef struct _GstProtocolInfo GstProtocolInfo;