[006/250] lavc: factorise setting buffer type in avcodec_default_get_buffer().

Message ID 1354401337-7312-7-git-send-email-anton@khirnov.net
State Committed
Commit 387bef95d28019c13c6805cfa4079e59948284e5
Headers show

Commit Message

Anton Khirnov Dec. 1, 2012, 10:31 p.m.
---
 libavcodec/utils.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Luca Barbato Dec. 2, 2012, 7:12 p.m. | #1
On 12/01/2012 11:31 PM, Anton Khirnov wrote:
> ---
>  libavcodec/utils.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Ok as well.

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6752ed9..1185a35 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -320,8 +320,6 @@  static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
         return ret;
     }
 
-    frame->type = FF_BUFFER_TYPE_INTERNAL;
-
     avci->audio_data = frame->data[0];
     if (avctx->debug & FF_DEBUG_BUFFERS)
         av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "
@@ -434,7 +432,6 @@  static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
         buf->height  = s->height;
         buf->pix_fmt = s->pix_fmt;
     }
-    pic->type = FF_BUFFER_TYPE_INTERNAL;
 
     for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
         pic->base[i]     = buf->base[i];
@@ -453,6 +450,7 @@  static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
 
 int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
 {
+    frame->type = FF_BUFFER_TYPE_INTERNAL;
     switch (avctx->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
         return video_get_buffer(avctx, frame);