From 074c4ca7fd77457f90ab2f4e772ffac8caf17f9c Mon Sep 17 00:00:00 2001
From: Roberto Togni <r_togni@tiscali.it>
Date: Fri, 7 Nov 2003 21:20:24 +0000
Subject: [PATCH] Add cr codec capability and buffer hints

Originally committed as revision 2484 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/avcodec.h | 25 ++++++++++++++++++++++++-
 libavcodec/utils.c   |  1 +
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1bcad4cd737..499633ac680 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -16,7 +16,7 @@ extern "C" {
 
 #define FFMPEG_VERSION_INT     0x000408
 #define FFMPEG_VERSION         "0.4.8"
-#define LIBAVCODEC_BUILD       4690
+#define LIBAVCODEC_BUILD       4691
 
 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
 #define LIBAVCODEC_VERSION     FFMPEG_VERSION
@@ -275,6 +275,10 @@ static const __attribute__((unused)) int Motion_Est_QTab[] =
    used */
 #define CODEC_CAP_PARSE_ONLY      0x0004
 #define CODEC_CAP_TRUNCATED       0x0008
+/*
+ * Codec can use conditional replenishment if available.
+ */
+#define CODEC_CAP_CR              0x0010
 
 /**
  * Pan Scan area.
@@ -460,6 +464,13 @@ typedef struct AVPanScan{
      * - decoding: set by lavc (default 0)\
      */\
     int palette_has_changed;\
+    \
+    /**\
+     * Codec suggestion on buffer type if != 0\
+     * - encoding: unused\
+     * - decoding: set by lavc (before get_buffer() call))\
+     */\
+    int buffer_hints;\
 
 #define FF_QSCALE_TYPE_MPEG1	0
 #define FF_QSCALE_TYPE_MPEG2	1
@@ -477,6 +488,11 @@ typedef struct AVPanScan{
 #define FF_SI_TYPE 5
 #define FF_SP_TYPE 6
 
+#define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore)
+#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer
+#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content
+#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update)
+
 /**
  * Audio Video Frame.
  */
@@ -1366,6 +1382,13 @@ typedef struct AVCodecContext {
      */
     int noise_reduction;
     
+    /**
+     * Conditional replenishment support
+     * - encoding: unused
+     * - decoding: set by user, if 1 user can allocate reusable buffers
+     */
+    int cr_available;
+    
 } AVCodecContext;
 
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ccb95f99812..2e944e4001a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -326,6 +326,7 @@ void avcodec_get_context_defaults(AVCodecContext *s){
     s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->palctrl = NULL;
+    s->cr_available = 0;
 }
 
 /**
-- 
GitLab