Browse code

Replace all instances of avcodec_alloc_frame() with av_frame_alloc().

Anton Khirnov authored on 2013/11/09 18:05:22
Showing 18 changed files
... ...
@@ -637,7 +637,7 @@ static int poll_filter(OutputStream *ost)
637 637
     AVFrame *filtered_frame = NULL;
638 638
     int frame_size, ret;
639 639
 
640
-    if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
640
+    if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) {
641 641
         return AVERROR(ENOMEM);
642 642
     } else
643 643
         avcodec_get_frame_defaults(ost->filtered_frame);
... ...
@@ -1056,7 +1056,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
1056 1056
     AVCodecContext *avctx = ist->st->codec;
1057 1057
     int i, ret, err = 0, resample_changed;
1058 1058
 
1059
-    if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))
1059
+    if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
1060 1060
         return AVERROR(ENOMEM);
1061 1061
     if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
1062 1062
         return AVERROR(ENOMEM);
... ...
@@ -1842,7 +1842,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
1842 1842
             int resample_changed, audio_resample;
1843 1843
 
1844 1844
             if (!is->frame) {
1845
-                if (!(is->frame = avcodec_alloc_frame()))
1845
+                if (!(is->frame = av_frame_alloc()))
1846 1846
                     return AVERROR(ENOMEM);
1847 1847
             } else
1848 1848
                 avcodec_get_frame_defaults(is->frame);
... ...
@@ -579,7 +579,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
579 579
         goto error;
580 580
     }
581 581
 
582
-    avctx->coded_frame = avcodec_alloc_frame();
582
+    avctx->coded_frame = av_frame_alloc();
583 583
     if (!avctx->coded_frame) {
584 584
         ret = AVERROR(ENOMEM);
585 585
         goto error;
... ...
@@ -155,7 +155,7 @@ static void audio_encode_example(const char *filename)
155 155
     }
156 156
 
157 157
     /* frame containing input raw audio */
158
-    frame = avcodec_alloc_frame();
158
+    frame = av_frame_alloc();
159 159
     if (!frame) {
160 160
         fprintf(stderr, "could not allocate audio frame\n");
161 161
         exit(1);
... ...
@@ -268,7 +268,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
268 268
         int got_frame = 0;
269 269
 
270 270
         if (!decoded_frame) {
271
-            if (!(decoded_frame = avcodec_alloc_frame())) {
271
+            if (!(decoded_frame = av_frame_alloc())) {
272 272
                 fprintf(stderr, "out of memory\n");
273 273
                 exit(1);
274 274
             }
... ...
@@ -334,7 +334,7 @@ static void video_encode_example(const char *filename)
334 334
     }
335 335
 
336 336
     c = avcodec_alloc_context3(codec);
337
-    picture= avcodec_alloc_frame();
337
+    picture = av_frame_alloc();
338 338
 
339 339
     /* put sample parameters */
340 340
     c->bit_rate = 400000;
... ...
@@ -479,7 +479,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
479 479
     }
480 480
 
481 481
     c = avcodec_alloc_context3(codec);
482
-    picture= avcodec_alloc_frame();
482
+    picture = av_frame_alloc();
483 483
 
484 484
     if(codec->capabilities&CODEC_CAP_TRUNCATED)
485 485
         c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */
... ...
@@ -168,7 +168,7 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
168 168
         return AVERROR(ENOMEM);
169 169
     }
170 170
 
171
-    avctx->coded_frame = avcodec_alloc_frame();
171
+    avctx->coded_frame = av_frame_alloc();
172 172
     if (!avctx->coded_frame) {
173 173
         av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
174 174
         goto fail;
... ...
@@ -259,7 +259,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
259 259
     th_comment_clear(&t_comment);
260 260
 
261 261
     /* Set up the output AVFrame */
262
-    avc_context->coded_frame= avcodec_alloc_frame();
262
+    avc_context->coded_frame = av_frame_alloc();
263 263
 
264 264
     return 0;
265 265
 }
... ...
@@ -353,7 +353,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
353 353
     vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
354 354
                  (unsigned char*)1);
355 355
 
356
-    avctx->coded_frame = avcodec_alloc_frame();
356
+    avctx->coded_frame = av_frame_alloc();
357 357
     if (!avctx->coded_frame) {
358 358
         av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
359 359
         vp8_free(avctx);
... ...
@@ -48,7 +48,7 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
48 48
     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
49 49
     avctx->block_align           = avctx->channels * avctx->bits_per_coded_sample / 8;
50 50
     avctx->bit_rate              = avctx->block_align * avctx->sample_rate * 8;
51
-    avctx->coded_frame           = avcodec_alloc_frame();
51
+    avctx->coded_frame           = av_frame_alloc();
52 52
     if (!avctx->coded_frame)
53 53
         return AVERROR(ENOMEM);
54 54
 
... ...
@@ -1075,7 +1075,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
1075 1075
     int interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
1076 1076
 
1077 1077
     avctx->bits_per_raw_sample = 10;
1078
-    avctx->coded_frame = avcodec_alloc_frame();
1078
+    avctx->coded_frame = av_frame_alloc();
1079 1079
     if (!avctx->coded_frame)
1080 1080
         return AVERROR(ENOMEM);
1081 1081
 
... ...
@@ -742,7 +742,7 @@ static av_cold int svq1_decode_init(AVCodecContext *avctx)
742 742
     int i;
743 743
     int offset = 0;
744 744
 
745
-    s->prev = avcodec_alloc_frame();
745
+    s->prev = av_frame_alloc();
746 746
     if (!s->prev)
747 747
         return AVERROR(ENOMEM);
748 748
 
... ...
@@ -1125,7 +1125,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
1125 1125
     AVFrame *frame = NULL;
1126 1126
     int ret;
1127 1127
 
1128
-    if (!(frame = avcodec_alloc_frame()))
1128
+    if (!(frame = av_frame_alloc()))
1129 1129
         return AVERROR(ENOMEM);
1130 1130
 
1131 1131
     frame->format         = src->format;
... ...
@@ -126,7 +126,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
126 126
         return AVERROR_OPTION_NOT_FOUND;
127 127
     }
128 128
 
129
-    avctx->coded_frame = avcodec_alloc_frame();
129
+    avctx->coded_frame = av_frame_alloc();
130 130
 
131 131
     if (!avctx->coded_frame) {
132 132
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
... ...
@@ -36,7 +36,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
36 36
         av_log(avctx, AV_LOG_WARNING, "bits per raw sample: %d != 10-bit\n",
37 37
                avctx->bits_per_raw_sample);
38 38
 
39
-    avctx->coded_frame = avcodec_alloc_frame();
39
+    avctx->coded_frame = av_frame_alloc();
40 40
     if (!avctx->coded_frame)
41 41
         return AVERROR(ENOMEM);
42 42
 
... ...
@@ -32,7 +32,7 @@ static av_cold int v410_encode_init(AVCodecContext *avctx)
32 32
         return AVERROR_INVALIDDATA;
33 33
     }
34 34
 
35
-    avctx->coded_frame = avcodec_alloc_frame();
35
+    avctx->coded_frame = av_frame_alloc();
36 36
 
37 37
     if (!avctx->coded_frame) {
38 38
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
... ...
@@ -26,7 +26,7 @@
26 26
 
27 27
 static av_cold int xbm_encode_init(AVCodecContext *avctx)
28 28
 {
29
-    avctx->coded_frame = avcodec_alloc_frame();
29
+    avctx->coded_frame = av_frame_alloc();
30 30
     if (!avctx->coded_frame)
31 31
         return AVERROR(ENOMEM);
32 32
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
... ...
@@ -32,7 +32,7 @@
32 32
 
33 33
 static av_cold int xwd_encode_init(AVCodecContext *avctx)
34 34
 {
35
-    avctx->coded_frame = avcodec_alloc_frame();
35
+    avctx->coded_frame = av_frame_alloc();
36 36
     if (!avctx->coded_frame)
37 37
         return AVERROR(ENOMEM);
38 38
 
... ...
@@ -138,7 +138,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
138 138
 {
139 139
     AVCodecContext *c;
140 140
     AVPacket pkt = { 0 }; // data and size must be 0;
141
-    AVFrame *frame = avcodec_alloc_frame();
141
+    AVFrame *frame = av_frame_alloc();
142 142
     int got_packet;
143 143
 
144 144
     av_init_packet(&pkt);
... ...
@@ -237,7 +237,7 @@ static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
237 237
     uint8_t *picture_buf;
238 238
     int size;
239 239
 
240
-    picture = avcodec_alloc_frame();
240
+    picture = av_frame_alloc();
241 241
     if (!picture)
242 242
         return NULL;
243 243
     size        = avpicture_get_size(pix_fmt, width, height);
... ...
@@ -1928,7 +1928,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
1928 1928
 {
1929 1929
     const AVCodec *codec;
1930 1930
     int got_picture = 1, ret = 0;
1931
-    AVFrame *frame = avcodec_alloc_frame();
1931
+    AVFrame *frame = av_frame_alloc();
1932 1932
     AVPacket pkt = *avpkt;
1933 1933
 
1934 1934
     if (!frame)