[FFmpeg-devel] [PATCH] split ff_log_missing_feature into ff_log_missing_feature and ff_log_ask_for_sample

Kenan Gillet kenan.gillet
Fri Jan 16 01:13:45 CET 2009


On Thu, Jan 15, 2009 at 4:09 PM, Kenan Gillet <kenan.gillet at gmail.com> wrote:
> Hi all,
>
> here is a patch to avoid duplicating code when asking for sample,
> based on Benoist Fouet request [1].
>
> [1] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-December/058271.html
>
> Kenan
>
patch now attached
-------------- next part --------------
Index: libavcodec/internal.h
===================================================================
--- libavcodec/internal.h	(revision 16618)
+++ libavcodec/internal.h	(working copy)
@@ -36,4 +36,12 @@
  */
 void ff_log_missing_feature(void *avc, const char *feature, int want_sample);
 
+/**
+ * Logs a generic warning message asking for a sample.
+ * @param[in] avc a pointer to an arbitrary struct of which the first field is
+ * a pointer to an AVClass struct
+ * @param[in] msg string containing an optional message, or NULL if no message
+ */
+void ff_log_ask_for_sample(void *avc, const char *msg);
+
 #endif /* AVCODEC_INTERNAL_H */
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c	(revision 16618)
+++ libavcodec/utils.c	(working copy)
@@ -36,6 +36,7 @@
 #include "opt.h"
 #include "imgconvert.h"
 #include "audioconvert.h"
+#include "internal.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include <limits.h>
@@ -1089,8 +1090,16 @@
             "occurs, it means that your file has a feature which has not "
             "been implemented.", feature);
     if(want_sample)
-        av_log(avc, AV_LOG_WARNING, " If you want to help, upload a sample "
-                "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
-                "and contact the ffmpeg-devel mailing list.");
-    av_log(avc, AV_LOG_WARNING, "\n");
+        ff_log_ask_for_sample(avc, NULL);
+    else
+        av_log(avc, AV_LOG_WARNING, "\n");
 }
+
+void ff_log_ask_for_sample(void *avc, const char *msg)
+{
+    if (msg)
+        av_log(avc, AV_LOG_WARNING, "%s ", msg);
+    av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
+            "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
+            "and contact the ffmpeg-devel mailing list.\n");
+}
Index: libavcodec/qcelpdec.c
===================================================================
--- libavcodec/qcelpdec.c	(revision 16618)
+++ libavcodec/qcelpdec.c	(working copy)
@@ -680,10 +705,7 @@
     if(bitrate == SILENCE)
     {
         //FIXME: Remove experimental warning when tested with samples.
-        av_log(avctx, AV_LOG_WARNING, "'Blank frame handling is experimental."
-                      " If you want to help, upload a sample "
-                      "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
-                      "and contact the ffmpeg-devel mailing list.\n");
+        ff_log_ask_for_sample(avctx, "'Blank frame handling is experimental.");
     }
     return bitrate;
 }



More information about the ffmpeg-devel mailing list