Do not overwrite its pointer, and do not fill it twice.

All exported fields are still correctly initialized in the compatibility
layer, taking place at the end of encode_frame().

Signed-off-by: Vittorio Giovara <[email protected]>
---
 avconv.c                        | 2 --
 libavcodec/a64multienc.c        | 8 +++-----
 libavcodec/dnxhdenc.c           | 1 -
 libavcodec/ffv1enc.c            | 8 ++++----
 libavcodec/libschroedingerenc.c | 3 +--
 libavcodec/libvpxenc.c          | 1 -
 libavcodec/libxavs.c            | 1 -
 libavcodec/mpegvideo_enc.c      | 2 --
 libavdevice/v4l2.c              | 6 ------
 9 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/avconv.c b/avconv.c
index 275c3eb..0174854 100644
--- a/avconv.c
+++ b/avconv.c
@@ -548,8 +548,6 @@ static void do_video_out(AVFormatContext *s,
         /* raw pictures are written as AVPicture structure to
            avoid any copies. We support temporarily the older
            method. */
-        enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
-        enc->coded_frame->top_field_first  = in_picture->top_field_first;
         pkt.data   = (uint8_t *)in_picture;
         pkt.size   =  sizeof(AVPicture);
         pkt.pts    = av_rescale_q(in_picture->pts, enc->time_base, 
ost->st->time_base);
diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c
index d742dee..969a071 100644
--- a/libavcodec/a64multienc.c
+++ b/libavcodec/a64multienc.c
@@ -44,7 +44,8 @@ static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
 //static const int mc_colors[5]={0x0,0x8,0xa,0xf,0x7};
 //static const int mc_colors[5]={0x0,0x9,0x8,0xa,0x3};
 
-static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest)
+static void to_meta_with_crop(AVCodecContext *avctx,
+                              const AVFrame *p, int *dest)
 {
     int blockx, blocky, x, y;
     int luma = 0;
@@ -252,7 +253,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
                                  const AVFrame *pict, int *got_packet)
 {
     A64Context *c = avctx->priv_data;
-    AVFrame *const p = avctx->coded_frame;
+    const AVFrame *p = pict;
 
     int frame;
     int x, y;
@@ -296,9 +297,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
     } else {
         /* fill up mc_meta_charset with data until lifetime exceeds */
         if (c->mc_frame_counter < c->mc_lifetime) {
-            *p = *pict;
-            p->pict_type = AV_PICTURE_TYPE_I;
-            p->key_frame = 1;
             to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter);
             c->mc_frame_counter++;
             if (c->next_pts == AV_NOPTS_VALUE)
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index dd7d8d1..f28c338 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -1022,7 +1022,6 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, 
const AVFrame *frame)
         ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8;
     }
 
-    ctx->m.avctx->coded_frame->interlaced_frame = frame->interlaced_frame;
     ctx->cur_field = frame->interlaced_frame && !frame->top_field_first;
 }
 
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index f689bd9..2ef2913 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -863,12 +863,12 @@ static void encode_slice_header(FFV1Context *f, 
FFV1Context *fs)
         put_symbol(c, state, f->plane[j].quant_table_index, 0);
         av_assert0(f->plane[j].quant_table_index == f->avctx->context_model);
     }
-    if (!f->avctx->coded_frame->interlaced_frame)
+    if (!f->frame->interlaced_frame)
         put_symbol(c, state, 3, 0);
     else
-        put_symbol(c, state, 1 + !f->avctx->coded_frame->top_field_first, 0);
-    put_symbol(c, state, f->avctx->coded_frame->sample_aspect_ratio.num, 0);
-    put_symbol(c, state, f->avctx->coded_frame->sample_aspect_ratio.den, 0);
+        put_symbol(c, state, 1 + !f->frame->top_field_first, 0);
+    put_symbol(c, state, f->avctx->sample_aspect_ratio.num, 0);
+    put_symbol(c, state, f->avctx->sample_aspect_ratio.den, 0);
 }
 
 static int encode_slice(AVCodecContext *c, void *arg)
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index b2c492b..d99ba69 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -392,8 +392,7 @@ static int libschroedinger_encode_frame(AVCodecContext 
*avctx, AVPacket *pkt,
     /* Use the frame number of the encoded frame as the pts. It is OK to
      * do so since Dirac is a constant frame rate codec. It expects input
      * to be of constant frame rate. */
-    pkt->pts =
-    avctx->coded_frame->pts = p_frame_output->frame_num;
+    pkt->pts = p_frame_output->frame_num;
     pkt->dts = p_schro_params->dts++;
     enc_size = p_frame_output->size;
 
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 4164769..ec8f1f1 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -397,7 +397,6 @@ static int storeframe(AVCodecContext *avctx, struct 
FrameListData *cx_frame,
     if (ret >= 0) {
         memcpy(pkt->data, cx_frame->buf, pkt->size);
         pkt->pts = pkt->dts    = cx_frame->pts;
-        coded_frame->pts       = cx_frame->pts;
         coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY);
 
         if (coded_frame->key_frame) {
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index 7a74e36..4fd90a9 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -160,7 +160,6 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt,
         return 0;
     }
 
-    avctx->coded_frame->pts = pic_out.i_pts;
     pkt->pts = pic_out.i_pts;
     if (avctx->has_b_frames) {
         if (!x4->out_frame_count)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 428ff72..6397681 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -714,8 +714,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
     ff_pixblockdsp_init(&s->pdsp, avctx);
     ff_qpeldsp_init(&s->qdsp);
 
-    s->avctx->coded_frame = s->current_picture.f;
-
     if (s->msmpeg4_version) {
         FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
                           2 * 2 * (MAX_LEVEL + 1) *
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 3631c1f..5f35c73 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -866,7 +866,6 @@ static int v4l2_read_header(AVFormatContext *s1)
 static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
 {
     struct video_data *s = s1->priv_data;
-    AVFrame *frame = s1->streams[0]->codec->coded_frame;
     int res;
 
     av_init_packet(pkt);
@@ -874,11 +873,6 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket 
*pkt)
         return res;
     }
 
-    if (frame && s->interlaced) {
-        frame->interlaced_frame = 1;
-        frame->top_field_first = s->top_field_first;
-    }
-
     return pkt->size;
 }
 
-- 
1.9.5 (Apple Git-50.3)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to