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.
This commit is contained in:
Ronald S. Bultje 2004-12-18 20:53:55 +00:00
parent f0aa8d49ed
commit 9093685a44
10 changed files with 37 additions and 21 deletions

View file

@ -1,3 +1,18 @@
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):

View file

@ -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)

View file

@ -30,6 +30,7 @@
#endif
#include <string.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
/*

View file

@ -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__ */

View file

@ -30,6 +30,7 @@
#include <ffmpeg/avcodec.h>
#endif
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
#define GST_TYPE_FFMPEGCSP \

View file

@ -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);
}

View file

@ -32,6 +32,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegDemux GstFFMpegDemux;

View file

@ -32,6 +32,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegEnc GstFFMpegEnc;

View file

@ -30,6 +30,7 @@
#include <gst/gst.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegMux GstFFMpegMux;

View file

@ -31,6 +31,7 @@
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include "gstffmpeg.h"
typedef struct _GstProtocolInfo GstProtocolInfo;