hook up our debug system

Original commit message from CVS:
hook up our debug system
This commit is contained in:
Thomas Vander Stichele 2004-07-07 15:12:02 +00:00
parent d867b293f7
commit 71f892d3de
5 changed files with 53 additions and 2 deletions

View file

@ -1,8 +1,16 @@
2004-07-07 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.h:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):
hook up our debug handler to FFmpeg's.
warn about getting negative have_data
2004-07-04 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_base_init):
bring category order in line with others
bring category order in line with others
2004-06-13 Ronald Bultje <rbultje@ronald.bitfreak.net>

2
common

@ -1 +1 @@
Subproject commit 1af22afdec71295108f882c828e08f10d8a3e94b
Subproject commit 59a2885f01e3092ffaefbed270f331c143b16d6b

View file

@ -33,6 +33,9 @@
#include <ffmpeg/avformat.h>
#endif
GST_DEBUG_CATEGORY_STATIC (ffmpeg_debug);
#define GST_CAT_DEFAULT ffmpeg_debug
extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
@ -41,12 +44,40 @@ extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin);
extern URLProtocol gstreamer_protocol;
static void
gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
{
GstDebugLevel gst_level;
switch (level) {
case AV_LOG_QUIET:
gst_level = GST_LEVEL_NONE;
break;
case AV_LOG_ERROR:
gst_level = GST_LEVEL_ERROR;
break;
case AV_LOG_INFO:
gst_level = GST_LEVEL_INFO;
break;
case AV_LOG_DEBUG:
gst_level = GST_LEVEL_DEBUG;
break;
default:
gst_level = GST_LEVEL_INFO;
break;
}
gst_debug_log_valist (ffmpeg_debug, gst_level, "", "", 0, NULL, fmt, vl);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream"))
return FALSE;
GST_DEBUG_CATEGORY_INIT (ffmpeg_debug, "ffmpeg", 0, "FFmpeg elements");
av_log_set_callback (gst_ffmpeg_log_callback);
av_register_all ();
gst_ffmpegenc_register (plugin);
@ -67,3 +98,5 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
"All FFMPEG codecs",
plugin_init,
FFMPEG_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")

View file

@ -87,4 +87,11 @@ gst_ffmpeg_caps_with_codectype (enum CodecType type,
GstCaps *
gst_ffmpeg_formatid_to_caps (const gchar *format_name);
/* 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

@ -433,6 +433,9 @@ 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);
if (have_data < 0)
GST_WARNING_OBJECT (ffmpegdec, "len %d, have_data: %d < 0 !",
len, have_data);
if (have_data) {
GST_BUFFER_SIZE (outbuf) = have_data;