[FFmpeg-cvslog] dv: Mark internal frame reference as const

Vittorio Giovara git at videolan.org
Mon Oct 5 11:23:51 CEST 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Oct  2 12:43:39 2015 +0200| [cab63a8b594cdc365bb2581a12b3ac8e6dd480b2] | committer: Vittorio Giovara

dv: Mark internal frame reference as const

Silence a warning due to frame assignment in dvenc. All uses of the
reference in dvdec are read only, except the ones in the main decoding
function, so use the frame pointer directly there.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cab63a8b594cdc365bb2581a12b3ac8e6dd480b2
---

 libavcodec/dv.h    |    2 +-
 libavcodec/dvdec.c |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index b458aea..d032405 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -39,7 +39,7 @@ typedef struct DVwork_chunk {
 
 typedef struct DVVideoContext {
     const AVDVProfile *sys;
-    AVFrame         *frame;
+    const AVFrame   *frame;
     AVCodecContext  *avctx;
     uint8_t         *buf;
 
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 9ee9933..463d108 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -350,6 +350,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     DVVideoContext *s = avctx->priv_data;
+    AVFrame *frame = data;
     const uint8_t *vsc_pack;
     int apt, is16_9, ret;
     const AVDVProfile *sys;
@@ -369,9 +370,9 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
         s->sys = sys;
     }
 
-    s->frame            = data;
-    s->frame->key_frame = 1;
-    s->frame->pict_type = AV_PICTURE_TYPE_I;
+    s->frame            = frame;
+    frame->key_frame    = 1;
+    frame->pict_type    = AV_PICTURE_TYPE_I;
     avctx->pix_fmt      = s->sys->pix_fmt;
     avctx->framerate    = av_inv_q(s->sys->time_base);
 
@@ -388,12 +389,12 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
         ff_set_sar(avctx, s->sys->sar[is16_9]);
     }
 
-    if (ff_get_buffer(avctx, s->frame, 0) < 0) {
+    if (ff_get_buffer(avctx, frame, 0) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }
-    s->frame->interlaced_frame = 1;
-    s->frame->top_field_first  = 0;
+    frame->interlaced_frame = 1;
+    frame->top_field_first  = 0;
 
     s->buf = buf;
     avctx->execute(avctx, dv_decode_video_segment, s->work_chunks, NULL,



More information about the ffmpeg-cvslog mailing list