aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2008-07-26 01:57:10 +0000
committerAlexander Strange <astrange@ithinksw.com>2008-07-26 01:57:10 +0000
commit385c820b4a1bff625936ec66be9c151ea2f9718b (patch)
tree1edbc8a8136bfedc6e14049f1bdac1be8f6d73d7 /libavcodec
parentaf8c5e08d7ed56f770ba97aaaef495a7c0ae6ac4 (diff)
downloadffmpeg-385c820b4a1bff625936ec66be9c151ea2f9718b.tar.gz
Add a new -debug option for tracing calls to the default get/release_buffer functions.
Originally committed as revision 14406 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h1
-rw-r--r--libavcodec/utils.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ed267bbf0d..3a53c7fd4a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1462,6 +1462,7 @@ typedef struct AVCodecContext {
#define FF_DEBUG_BUGS 0x00001000
#define FF_DEBUG_VIS_QP 0x00002000
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
+#define FF_DEBUG_BUFFERS 0x00008000
/**
* debug
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1e64de160b..3fb33d6f73 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -280,6 +280,9 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
}
s->internal_buffer_count++;
+ if(s->debug&FF_DEBUG_BUFFERS)
+ av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count);
+
return 0;
}
@@ -307,6 +310,9 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
// pic->base[i]=NULL;
}
//printf("R%X\n", pic->opaque);
+
+ if(s->debug&FF_DEBUG_BUFFERS)
+ av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count);
}
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
@@ -577,6 +583,7 @@ static const AVOption options[]={
{"bugs", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"},
{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"},
{"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"},
+{"buffers", "picture buffer allocations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUFFERS, INT_MIN, INT_MAX, V|D, "debug"},
{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"},
{"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
{"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},