Commit 9093685a authored by Ronald S. Bultje's avatar Ronald S. Bultje

ext/ffmpeg/: Add debugging category everywhere (correctly this time). Don't...

ext/ffmpeg/: Add debugging category everywhere (correctly this time). Don't parse mp3 data (the parser is a piece of ...

Original commit message from CVS:
* 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.
parent f0aa8d49
2004-12-18 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* 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 <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
......
......@@ -33,16 +33,9 @@
#include <ffmpeg/avformat.h>
#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)
......
......@@ -30,6 +30,7 @@
#endif
#include <string.h>
#include "gstffmpeg.h"
#include "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__ */
......@@ -30,6 +30,7 @@
#include <ffmpeg/avcodec.h>
#endif
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
#define GST_TYPE_FFMPEGCSP \
......
......@@ -32,6 +32,7 @@
#include <gst/gst.h>
#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);
}
......
......@@ -32,6 +32,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegDemux GstFFMpegDemux;
......
......@@ -32,6 +32,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegEnc GstFFMpegEnc;
......
......@@ -30,6 +30,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegMux GstFFMpegMux;
......
......@@ -31,6 +31,7 @@
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include "gstffmpeg.h"
typedef struct _GstProtocolInfo GstProtocolInfo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment