ext/ffmpeg/: shut up the logging while it's probing for formats

Original commit message from CVS:

* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps):
shut up the logging while it's probing for formats
This commit is contained in:
Thomas Vander Stichele 2005-09-13 12:16:32 +00:00
parent a02a444d68
commit 2e02b4f6f5
5 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2005-09-13 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps):
shut up the logging while it's probing for formats
2005-09-05 Andy Wingo <wingo@pobox.com>
* Update for state change type and macro changes.

2
common

@ -1 +1 @@
Subproject commit 54886902497be267fe1f1a3f9c4dc0245bc46175
Subproject commit 30a1fc4dc24133cc411e0232af87790ae2f845b2

View file

@ -43,6 +43,9 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
{
GstDebugLevel gst_level;
if (_shut_up_I_am_probing)
return;
switch (level) {
case AV_LOG_QUIET:
gst_level = GST_LEVEL_NONE;
@ -65,11 +68,16 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
}
#endif
#ifndef GST_DISABLE_GST_DEBUG
gboolean _shut_up_I_am_probing = FALSE;
#endif
static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (ffmpeg_debug, "ffmpeg", 0, "FFmpeg elements");
#ifndef GST_DISABLE_GST_DEBUG
av_log_set_callback (gst_ffmpeg_log_callback);
#endif
av_register_all ();

View file

@ -22,7 +22,7 @@
*/
#ifndef __GST_FFMPEG_H__
#define __GST_FFMPEG_H
#define __GST_FFMPEG_H__
#ifdef HAVE_FFMPEG_UNINSTALLED
#include <avcodec.h>
@ -39,6 +39,10 @@ GST_DEBUG_CATEGORY_EXTERN (ffmpeg_debug);
G_BEGIN_DECLS
#ifndef GST_DISABLE_GST_DEBUG
extern gboolean _shut_up_I_am_probing;
#endif
extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
@ -51,7 +55,7 @@ G_END_DECLS
extern URLProtocol gstreamer_protocol;
/* use GST_FFMPEG URL_STREAMHEADER with URL_WRONLY if the first
/* use GST_FFMPEG URL_STREAMHEADER with URL_WRONLY if the first
* buffer should be used as streamheader property on the pad's caps. */
#define GST_FFMPEG_URL_STREAMHEADER 16

View file

@ -322,6 +322,13 @@ gst_ffmpegenc_getcaps (GstPad * pad)
/* makes it silent */
ctx->strict_std_compliance = -1;
/* shut up the logging while we autoprobe; we don't want warnings and
* errors about unsupported formats */
/* FIXME: if someone cares about this disabling the logging for other
* instances/threads/..., one could investigate if there is a way to
* set this as a struct member on the av context, and check it from the
* log handler */
_shut_up_I_am_probing = TRUE;
for (pixfmt = 0; pixfmt < PIX_FMT_NB; pixfmt++) {
ctx->pix_fmt = pixfmt;
if (avcodec_open (ctx, oclass->in_plugin) >= 0 &&
@ -337,6 +344,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
avcodec_close (ctx);
}
av_free (ctx);
_shut_up_I_am_probing = FALSE;
/* make sure we have something */
if (!caps) {