* commit '5b9c3b4505206143d85398c1410949319fa1180f': Replace all instances of avcodec_alloc_frame() with av_frame_alloc(). Conflicts: doc/examples/decoding_encoding.c doc/examples/muxing.c ffmpeg.c libavcodec/alacenc.c libavcodec/libopenjpegenc.c libavcodec/libvpxenc.c libavcodec/pcm.c libavcodec/xbmenc.c libavcodec/xwdenc.c libavformat/utils.c
Unified · Split
| @@ -156,7 +156,7 @@ static void audio_encode_example(const char *filename) · 155 unmodified lines | ||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /* frame containing input raw audio */ |
| 159 | − frame = avcodec_alloc_frame(); | |
| 159 | + frame = av_frame_alloc(); | |
| 160 | 160 | if (!frame) { |
| 161 | 161 | fprintf(stderr, "Could not allocate audio frame\n"); |
| 162 | 162 | exit(1); |
| @@ -287,7 +287,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) · 124 unmodified lines | ||
| 287 | 287 | int got_frame = 0; |
| 288 | 288 | |
| 289 | 289 | if (!decoded_frame) { |
| 290 | − if (!(decoded_frame = avcodec_alloc_frame())) { | |
| 290 | + if (!(decoded_frame = av_frame_alloc())) { | |
| 291 | 291 | fprintf(stderr, "Could not allocate audio frame\n"); |
| 292 | 292 | exit(1); |
| 293 | 293 | } |
| @@ -386,7 +386,7 @@ static void video_encode_example(const char *filename, int codec_id) · 92 unmodified lines | ||
| 386 | 386 | exit(1); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | − frame = avcodec_alloc_frame(); | |
| 389 | + frame = av_frame_alloc(); | |
| 390 | 390 | if (!frame) { |
| 391 | 391 | fprintf(stderr, "Could not allocate video frame\n"); |
| 392 | 392 | exit(1); |
| @@ -565,7 +565,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 172 unmodified lines | ||
| 565 | 565 | exit(1); |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | − frame = avcodec_alloc_frame(); | |
| 568 | + frame = av_frame_alloc(); | |
| 569 | 569 | if (!frame) { |
| 570 | 570 | fprintf(stderr, "Could not allocate video frame\n"); |
| 571 | 571 | exit(1); |
| @@ -221,7 +221,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st) · 220 unmodified lines | ||
| 221 | 221 | { |
| 222 | 222 | AVCodecContext *c; |
| 223 | 223 | AVPacket pkt = { 0 }; // data and size must be 0; |
| 224 | − AVFrame *frame = avcodec_alloc_frame(); | |
| 224 | + AVFrame *frame = av_frame_alloc(); | |
| 225 | 225 | int got_packet, ret, dst_nb_samples; |
| 226 | 226 | |
| 227 | 227 | av_init_packet(&pkt); |
| @@ -310,7 +310,7 @@ static void open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st) · 82 unmodified lines | ||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /* allocate and init a re-usable frame */ |
| 313 | − frame = avcodec_alloc_frame(); | |
| 313 | + frame = av_frame_alloc(); | |
| 314 | 314 | if (!frame) { |
| 315 | 315 | fprintf(stderr, "Could not allocate video frame\n"); |
| 316 | 316 | exit(1); |
| @@ -1071,7 +1071,7 @@ static int reap_filters(void) · 1070 unmodified lines | ||
| 1071 | 1071 | if (!ost->filter) |
| 1072 | 1072 | continue; |
| 1073 | 1073 | |
| 1074 | − if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) { | |
| 1074 | + if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) { | |
| 1075 | 1075 | return AVERROR(ENOMEM); |
| 1076 | 1076 | } else |
| 1077 | 1077 | avcodec_get_frame_defaults(ost->filtered_frame); |
| @@ -1536,7 +1536,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) · 458 unmodified lines | ||
| 1536 | 1536 | int i, ret, err = 0, resample_changed; |
| 1537 | 1537 | AVRational decoded_frame_tb; |
| 1538 | 1538 | |
| 1539 | − if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) | |
| 1539 | + if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) | |
| 1540 | 1540 | return AVERROR(ENOMEM); |
| 1541 | 1541 | if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) |
| 1542 | 1542 | return AVERROR(ENOMEM); |
| @@ -2163,7 +2163,7 @@ static int audio_decode_frame(VideoState *is) · 2162 unmodified lines | ||
| 2163 | 2163 | /* NOTE: the audio packet can contain several frames */ |
| 2164 | 2164 | while (pkt_temp->stream_index != -1 || is->audio_buf_frames_pending) { |
| 2165 | 2165 | if (!is->frame) { |
| 2166 | − if (!(is->frame = avcodec_alloc_frame())) | |
| 2166 | + if (!(is->frame = av_frame_alloc())) | |
| 2167 | 2167 | return AVERROR(ENOMEM); |
| 2168 | 2168 | } else { |
| 2169 | 2169 | av_frame_unref(is->frame); |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static av_cold int avui_encode_init(AVCodecContext *avctx) |
| 27 | 27 | { |
| 28 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 28 | + avctx->coded_frame = av_frame_alloc(); | |
| 29 | 29 | |
| 30 | 30 | if (avctx->width != 720 || avctx->height != 486 && avctx->height != 576) { |
| 31 | 31 | av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n"); |
| @@ -49,7 +49,7 @@ av_cold int ffv1_common_init(AVCodecContext *avctx) · 48 unmodified lines | ||
| 49 | 49 | s->avctx = avctx; |
| 50 | 50 | s->flags = avctx->flags; |
| 51 | 51 | |
| 52 | − s->picture.f = avcodec_alloc_frame(); | |
| 52 | + s->picture.f = av_frame_alloc(); | |
| 53 | 53 | s->last_picture.f = av_frame_alloc(); |
| 54 | 54 | if (!s->picture.f || !s->last_picture.f) |
| 55 | 55 | return AVERROR(ENOMEM); |
| @@ -242,7 +242,7 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) · 241 unmodified lines | ||
| 242 | 242 | goto fail; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 245 | + avctx->coded_frame = av_frame_alloc(); | |
| 246 | 246 | if (!avctx->coded_frame) { |
| 247 | 247 | av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); |
| 248 | 248 | goto fail; |
| @@ -264,7 +264,7 @@ static av_cold int encode_init(AVCodecContext* avc_context) · 263 unmodified lines | ||
| 264 | 264 | th_comment_clear(&t_comment); |
| 265 | 265 | |
| 266 | 266 | /* Set up the output AVFrame */ |
| 267 | − avc_context->coded_frame= avcodec_alloc_frame(); | |
| 267 | + avc_context->coded_frame = av_frame_alloc(); | |
| 268 | 268 | |
| 269 | 269 | return 0; |
| 270 | 270 | } |
| @@ -96,7 +96,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx) · 95 unmodified lines | ||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /* Allocate the output frame */ |
| 99 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 99 | + avctx->coded_frame = av_frame_alloc(); | |
| 100 | 100 | |
| 101 | 101 | /* Ut Video only supports 8-bit */ |
| 102 | 102 | avctx->bits_per_raw_sample = 8; |
| @@ -74,7 +74,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) · 73 unmodified lines | ||
| 74 | 74 | flags = ((avctx->prediction_method + 1) << 8) | (avctx->thread_count - 1); |
| 75 | 75 | |
| 76 | 76 | avctx->priv_data = utv; |
| 77 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 77 | + avctx->coded_frame = av_frame_alloc(); | |
| 78 | 78 | |
| 79 | 79 | /* Alloc extradata buffer */ |
| 80 | 80 | info = (UtVideoExtra *)av_malloc(sizeof(*info)); |
| @@ -456,7 +456,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, · 455 unmodified lines | ||
| 456 | 456 | vpx_img_wrap(&ctx->rawimg_alpha, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, |
| 457 | 457 | (unsigned char*)1); |
| 458 | 458 | |
| 459 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 459 | + avctx->coded_frame = av_frame_alloc(); | |
| 460 | 460 | if (!avctx->coded_frame) { |
| 461 | 461 | av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); |
| 462 | 462 | vp8_free(avctx); |
| @@ -581,7 +581,7 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) · 580 unmodified lines | ||
| 581 | 581 | scale_mat(QMAT_CHROMA[avctx->profile], ctx->qmat_chroma[i - 1], i); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 584 | + avctx->coded_frame = av_frame_alloc(); | |
| 585 | 585 | avctx->coded_frame->key_frame = 1; |
| 586 | 586 | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; |
| 587 | 587 | |
| @@ -1073,7 +1073,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 1072 unmodified lines | ||
| 1073 | 1073 | int interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT); |
| 1074 | 1074 | |
| 1075 | 1075 | avctx->bits_per_raw_sample = 10; |
| 1076 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 1076 | + avctx->coded_frame = av_frame_alloc(); | |
| 1077 | 1077 | if (!avctx->coded_frame) |
| 1078 | 1078 | return AVERROR(ENOMEM); |
| 1079 | 1079 | |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | static av_cold int encode_init(AVCodecContext *avctx) |
| 28 | 28 | { |
| 29 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 29 | + avctx->coded_frame = av_frame_alloc(); | |
| 30 | 30 | |
| 31 | 31 | if (!avctx->coded_frame) |
| 32 | 32 | return AVERROR(ENOMEM); |
| @@ -742,7 +742,7 @@ static av_cold int svq1_decode_init(AVCodecContext *avctx) · 741 unmodified lines | ||
| 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 | |
| @@ -1559,7 +1559,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src) · 1558 unmodified lines | ||
| 1559 | 1559 | AVFrame *frame = NULL; |
| 1560 | 1560 | int ret; |
| 1561 | 1561 | |
| 1562 | − if (!(frame = avcodec_alloc_frame())) | |
| 1562 | + if (!(frame = av_frame_alloc())) | |
| 1563 | 1563 | return AVERROR(ENOMEM); |
| 1564 | 1564 | |
| 1565 | 1565 | frame->format = src->format; |
| @@ -126,7 +126,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) · 125 unmodified lines | ||
| 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) · 35 unmodified lines | ||
| 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 | |
| @@ -31,7 +31,7 @@ static av_cold int v308_encode_init(AVCodecContext *avctx) · 30 unmodified lines | ||
| 31 | 31 | return AVERROR_INVALIDDATA; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 34 | + avctx->coded_frame = av_frame_alloc(); | |
| 35 | 35 | |
| 36 | 36 | if (!avctx->coded_frame) { |
| 37 | 37 | av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | static av_cold int v408_encode_init(AVCodecContext *avctx) |
| 28 | 28 | { |
| 29 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 29 | + avctx->coded_frame = av_frame_alloc(); | |
| 30 | 30 | |
| 31 | 31 | if (!avctx->coded_frame) { |
| 32 | 32 | av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
| @@ -32,7 +32,7 @@ static av_cold int v410_encode_init(AVCodecContext *avctx) · 31 unmodified lines | ||
| 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"); |
| @@ -125,7 +125,7 @@ static void encode_block(char *bitmap, int w, int h, int level, ProbRangesQueue · 124 unmodified lines | ||
| 125 | 125 | |
| 126 | 126 | static av_cold int xface_encode_init(AVCodecContext *avctx) |
| 127 | 127 | { |
| 128 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 128 | + avctx->coded_frame = av_frame_alloc(); | |
| 129 | 129 | if (!avctx->coded_frame) |
| 130 | 130 | return AVERROR(ENOMEM); |
| 131 | 131 | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; |
| @@ -30,7 +30,7 @@ static av_cold int y41p_encode_init(AVCodecContext *avctx) · 29 unmodified lines | ||
| 30 | 30 | return AVERROR_INVALIDDATA; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 33 | + avctx->coded_frame = av_frame_alloc(); | |
| 34 | 34 | avctx->bits_per_coded_sample = 12; |
| 35 | 35 | |
| 36 | 36 | if (!avctx->coded_frame) { |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static av_cold int yuv4_encode_init(AVCodecContext *avctx) |
| 27 | 27 | { |
| 28 | − avctx->coded_frame = avcodec_alloc_frame(); | |
| 28 | + avctx->coded_frame = av_frame_alloc(); | |
| 29 | 29 | |
| 30 | 30 | if (!avctx->coded_frame) { |
| 31 | 31 | av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
| @@ -57,7 +57,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], · 56 unmodified lines | ||
| 57 | 57 | goto end; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | − if (!(frame = avcodec_alloc_frame()) ) { | |
| 60 | + if (!(frame = av_frame_alloc()) ) { | |
| 61 | 61 | av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc frame\n"); |
| 62 | 62 | ret = AVERROR(ENOMEM); |
| 63 | 63 | goto end; |
| @@ -245,8 +245,8 @@ static int config(struct vf_instance *vf, · 244 unmodified lines | ||
| 245 | 245 | av_dict_free(&opts); |
| 246 | 246 | assert(avctx_enc->codec); |
| 247 | 247 | } |
| 248 | − vf->priv->frame= avcodec_alloc_frame(); | |
| 249 | − vf->priv->frame_dec= avcodec_alloc_frame(); | |
| 248 | + vf->priv->frame= av_frame_alloc(); | |
| 249 | + vf->priv->frame_dec= av_frame_alloc(); | |
| 250 | 250 | |
| 251 | 251 | vf->priv->outbuf_size= (width + BLOCK)*(height + BLOCK)*10; |
| 252 | 252 | vf->priv->outbuf= malloc(vf->priv->outbuf_size); |
| @@ -2448,7 +2448,7 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, A · 2447 unmodified lines | ||
| 2448 | 2448 | { |
| 2449 | 2449 | const AVCodec *codec; |
| 2450 | 2450 | int got_picture = 1, ret = 0; |
| 2451 | − AVFrame *frame = avcodec_alloc_frame(); | |
| 2451 | + AVFrame *frame = av_frame_alloc(); | |
| 2452 | 2452 | AVSubtitle subtitle; |
| 2453 | 2453 | AVPacket pkt = *avpkt; |
| 2454 | 2454 | |