[FFmpeg-devel] [PATCH 6/7] Implement get_buffer_ref_perms_string() and use it.

Stefano Sabatini stefano.sabatini-lala
Thu Aug 19 18:38:27 CEST 2010


---
 libavfilter/avfilter.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 3b94f14..a43bfbe 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -191,6 +191,19 @@ int avfilter_config_links(AVFilterContext *filter)
     return 0;
 }
 
+#ifdef DEBUG
+static char *get_buffer_ref_perms_string(char *buf, size_t buf_size, int perms)
+{
+    snprintf(buf, buf_size, "%s%s%s%s%s",
+             perms & AV_PERM_READ      ? "r" : "",
+             perms & AV_PERM_WRITE     ? "w" : "",
+             perms & AV_PERM_PRESERVE  ? "p" : "",
+             perms & AV_PERM_REUSE     ? "r" : "",
+             perms & AV_PERM_REUSE2    ? "R" : "");
+    return buf;
+}
+#endif
+
 void ff_dprintf_buffer_ref(void *ctx, AVFilterBufferRef *bufref, int end)
 {
     dprintf(ctx,
@@ -233,7 +246,13 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
 {
     AVFilterBufferRef *ret = NULL;
 
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h);
+#ifdef DEBUG
+    char perms_buf[16];
+#endif
+
+    FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0);
+    dprintf(NULL, " perms:%s w:%d h:%d\n",
+            get_buffer_ref_perms_string(perms_buf, sizeof(perms_buf), perms), w, h);
 
     if (link_dpad(link).get_video_buffer)
         ret = link_dpad(link).get_video_buffer(link, perms, w, h);
-- 
1.7.0.4




More information about the ffmpeg-devel mailing list