[FFmpeg-cvslog] avcodec: use av_frame_unref() to set frame defaults

Michael Niedermayer git at videolan.org
Tue Dec 17 14:40:56 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 17 14:02:29 2013 +0100| [6aed7bfd845349e68708b5791b3296c0e07f1d0d] | committer: Michael Niedermayer

avcodec: use av_frame_unref() to set frame defaults

This ensures that the code isnt duplicated and cant become out of sync

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/utils.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d361391..d738a86 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1062,19 +1062,7 @@ void avcodec_get_frame_defaults(AVFrame *frame)
 #endif
 
     memset(frame, 0, sizeof(AVFrame));
-
-    frame->pts                   =
-    frame->pkt_dts               =
-    frame->pkt_pts               = AV_NOPTS_VALUE;
-    av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
-    av_frame_set_pkt_duration         (frame, 0);
-    av_frame_set_pkt_pos              (frame, -1);
-    av_frame_set_pkt_size             (frame, -1);
-    frame->key_frame           = 1;
-    frame->sample_aspect_ratio = (AVRational) {0, 1 };
-    frame->format              = -1; /* unknown */
-    frame->extended_data       = frame->data;
-    av_frame_set_colorspace(frame, AVCOL_SPC_UNSPECIFIED);
+    av_frame_unref(frame);
 }
 
 AVFrame *avcodec_alloc_frame(void)



More information about the ffmpeg-cvslog mailing list