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
parent a02a444d
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> 2005-09-05 Andy Wingo <wingo@pobox.com>
* Update for state change type and macro changes. * Update for state change type and macro changes.
......
common @ 30a1fc4d
Subproject commit 54886902497be267fe1f1a3f9c4dc0245bc46175 Subproject commit 30a1fc4dc24133cc411e0232af87790ae2f845b2
...@@ -43,6 +43,9 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl) ...@@ -43,6 +43,9 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
{ {
GstDebugLevel gst_level; GstDebugLevel gst_level;
if (_shut_up_I_am_probing)
return;
switch (level) { switch (level) {
case AV_LOG_QUIET: case AV_LOG_QUIET:
gst_level = GST_LEVEL_NONE; gst_level = GST_LEVEL_NONE;
...@@ -65,11 +68,16 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl) ...@@ -65,11 +68,16 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
} }
#endif #endif
#ifndef GST_DISABLE_GST_DEBUG
gboolean _shut_up_I_am_probing = FALSE;
#endif
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
GST_DEBUG_CATEGORY_INIT (ffmpeg_debug, "ffmpeg", 0, "FFmpeg elements"); GST_DEBUG_CATEGORY_INIT (ffmpeg_debug, "ffmpeg", 0, "FFmpeg elements");
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
av_log_set_callback (gst_ffmpeg_log_callback); av_log_set_callback (gst_ffmpeg_log_callback);
#endif #endif
av_register_all (); av_register_all ();
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
#ifndef __GST_FFMPEG_H__ #ifndef __GST_FFMPEG_H__
#define __GST_FFMPEG_H #define __GST_FFMPEG_H__
#ifdef HAVE_FFMPEG_UNINSTALLED #ifdef HAVE_FFMPEG_UNINSTALLED
#include <avcodec.h> #include <avcodec.h>
...@@ -39,6 +39,10 @@ GST_DEBUG_CATEGORY_EXTERN (ffmpeg_debug); ...@@ -39,6 +39,10 @@ GST_DEBUG_CATEGORY_EXTERN (ffmpeg_debug);
G_BEGIN_DECLS 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_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin * plugin); extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin * plugin); extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
...@@ -51,7 +55,7 @@ G_END_DECLS ...@@ -51,7 +55,7 @@ G_END_DECLS
extern URLProtocol gstreamer_protocol; 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. */ * buffer should be used as streamheader property on the pad's caps. */
#define GST_FFMPEG_URL_STREAMHEADER 16 #define GST_FFMPEG_URL_STREAMHEADER 16
......
...@@ -322,6 +322,13 @@ gst_ffmpegenc_getcaps (GstPad * pad) ...@@ -322,6 +322,13 @@ gst_ffmpegenc_getcaps (GstPad * pad)
/* makes it silent */ /* makes it silent */
ctx->strict_std_compliance = -1; 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++) { for (pixfmt = 0; pixfmt < PIX_FMT_NB; pixfmt++) {
ctx->pix_fmt = pixfmt; ctx->pix_fmt = pixfmt;
if (avcodec_open (ctx, oclass->in_plugin) >= 0 && if (avcodec_open (ctx, oclass->in_plugin) >= 0 &&
...@@ -337,6 +344,7 @@ gst_ffmpegenc_getcaps (GstPad * pad) ...@@ -337,6 +344,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
avcodec_close (ctx); avcodec_close (ctx);
} }
av_free (ctx); av_free (ctx);
_shut_up_I_am_probing = FALSE;
/* make sure we have something */ /* make sure we have something */
if (!caps) { if (!caps) {
......
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