The rationale is that coded_frame was only used to communicate key_frame, pict_type and quality to the caller, as well as a few other random fields, in a non predictable, let alone consistent way. There was agreement that there was no use case for coded_frame, as it is a full-sized AVFrame container used for just 2-3 int-sized properties, which shouldn't even belong into the AVCodecContext in the first place. The appropriate AVPacket flag can be used instead of key_frame, while quality is exported with the new AVPacketSideData quality factor. There is no replacement for the other fields as they were unreliable, mishandled or just not used at all. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>tags/n2.8
| @@ -38,6 +38,7 @@ | |||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "libavutil/samplefmt.h" | #include "libavutil/samplefmt.h" | ||||
| #include "libavutil/fifo.h" | #include "libavutil/fifo.h" | ||||
| #include "libavutil/internal.h" | |||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| #include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||
| @@ -492,8 +493,12 @@ static void do_video_out(AVFormatContext *s, | |||||
| /* raw pictures are written as AVPicture structure to | /* raw pictures are written as AVPicture structure to | ||||
| avoid any copies. We support temporarily the older | avoid any copies. We support temporarily the older | ||||
| method. */ | method. */ | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; | enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; | ||||
| enc->coded_frame->top_field_first = in_picture->top_field_first; | enc->coded_frame->top_field_first = in_picture->top_field_first; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt.data = (uint8_t *)in_picture; | pkt.data = (uint8_t *)in_picture; | ||||
| pkt.size = sizeof(AVPicture); | pkt.size = sizeof(AVPicture); | ||||
| pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); | pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); | ||||
| @@ -568,8 +573,13 @@ static void do_video_stats(OutputStream *ost, int frame_size) | |||||
| frame_number = ost->frame_number; | frame_number = ost->frame_number; | ||||
| fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, | fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, | ||||
| ost->quality / (float)FF_QP2LAMBDA); | ost->quality / (float)FF_QP2LAMBDA); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (enc->flags&CODEC_FLAG_PSNR) | if (enc->flags&CODEC_FLAG_PSNR) | ||||
| fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); | fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| fprintf(vstats_file,"f_size= %6d ", frame_size); | fprintf(vstats_file,"f_size= %6d ", frame_size); | ||||
| /* compute pts value */ | /* compute pts value */ | ||||
| @@ -581,7 +591,11 @@ static void do_video_stats(OutputStream *ost, int frame_size) | |||||
| avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; | avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; | ||||
| fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", | fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", | ||||
| (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); | (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); | fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| } | } | ||||
| @@ -874,6 +888,9 @@ static void print_report(int is_last_report, int64_t timer_start) | |||||
| for (j = 0; j < 32; j++) | for (j = 0; j < 32; j++) | ||||
| snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (enc->flags&CODEC_FLAG_PSNR) { | if (enc->flags&CODEC_FLAG_PSNR) { | ||||
| int j; | int j; | ||||
| double error, error_sum = 0; | double error, error_sum = 0; | ||||
| @@ -896,6 +913,8 @@ static void print_report(int is_last_report, int64_t timer_start) | |||||
| } | } | ||||
| snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| vid = 1; | vid = 1; | ||||
| } | } | ||||
| /* compute min output value */ | /* compute min output value */ | ||||
| @@ -217,8 +217,12 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx) | |||||
| AV_WB32(avctx->extradata, c->mc_lifetime); | AV_WB32(avctx->extradata, c->mc_lifetime); | ||||
| AV_WB32(avctx->extradata + 16, INTERLACED); | AV_WB32(avctx->extradata + 16, INTERLACED); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (!avctx->codec_tag) | if (!avctx->codec_tag) | ||||
| avctx->codec_tag = AV_RL32("a64m"); | avctx->codec_tag = AV_RL32("a64m"); | ||||
| @@ -289,8 +293,12 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } else { | } else { | ||||
| /* fill up mc_meta_charset with data until lifetime exceeds */ | /* fill up mc_meta_charset with data until lifetime exceeds */ | ||||
| if (c->mc_frame_counter < c->mc_lifetime) { | if (c->mc_frame_counter < c->mc_lifetime) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| to_meta_with_crop(avctx, pict, meta + 32000 * c->mc_frame_counter); | to_meta_with_crop(avctx, pict, meta + 32000 * c->mc_frame_counter); | ||||
| c->mc_frame_counter++; | c->mc_frame_counter++; | ||||
| if (c->next_pts == AV_NOPTS_VALUE) | if (c->next_pts == AV_NOPTS_VALUE) | ||||
| @@ -33,8 +33,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| int width, height, bits_pixel, i, j, length, ret; | int width, height, bits_pixel, i, j, length, ret; | ||||
| uint8_t *in_buf, *buf; | uint8_t *in_buf, *buf; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| width = avctx->width; | width = avctx->width; | ||||
| height = avctx->height; | height = avctx->height; | ||||
| @@ -282,8 +282,12 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| int i; | int i; | ||||
| const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; | const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| ff_asv_common_init(avctx); | ff_asv_common_init(avctx); | ||||
| ff_fdctdsp_init(&a->fdsp, avctx); | ff_fdctdsp_init(&a->fdsp, avctx); | ||||
| @@ -2559,12 +2559,16 @@ typedef struct AVCodecContext { | |||||
| attribute_deprecated int lowres; | attribute_deprecated int lowres; | ||||
| #endif | #endif | ||||
| #if FF_API_CODED_FRAME | |||||
| /** | /** | ||||
| * the picture in the bitstream | * the picture in the bitstream | ||||
| * - encoding: Set by libavcodec. | * - encoding: Set by libavcodec. | ||||
| * - decoding: unused | * - decoding: unused | ||||
| * | |||||
| * @deprecated use the quality factor packet side data instead | |||||
| */ | */ | ||||
| AVFrame *coded_frame; | |||||
| attribute_deprecated AVFrame *coded_frame; | |||||
| #endif | |||||
| /** | /** | ||||
| * thread count | * thread count | ||||
| @@ -69,8 +69,12 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| int bit_count = avctx->bits_per_coded_sample; | int bit_count = avctx->bits_per_coded_sample; | ||||
| uint8_t *ptr, *buf; | uint8_t *ptr, *buf; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| switch (avctx->pix_fmt) { | switch (avctx->pix_fmt) { | ||||
| case AV_PIX_FMT_RGB444: | case AV_PIX_FMT_RGB444: | ||||
| compression = BMP_BITFIELDS; | compression = BMP_BITFIELDS; | ||||
| @@ -41,8 +41,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| init_put_bits(&pb, pkt->data, pkt->size); | init_put_bits(&pb, pkt->data, pkt->size); | ||||
| @@ -372,8 +372,12 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
| FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale, | FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale, | ||||
| ctx->m.mb_num * sizeof(uint8_t), fail); | ctx->m.mb_num * sizeof(uint8_t), fail); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (avctx->thread_count > MAX_THREADS) { | if (avctx->thread_count > MAX_THREADS) { | ||||
| av_log(avctx, AV_LOG_ERROR, "too many threads\n"); | av_log(avctx, AV_LOG_ERROR, "too many threads\n"); | ||||
| @@ -1026,7 +1030,11 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame) | |||||
| ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8; | ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| ctx->m.avctx->coded_frame->interlaced_frame = frame->interlaced_frame; | ctx->m.avctx->coded_frame->interlaced_frame = frame->interlaced_frame; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| ctx->cur_field = frame->interlaced_frame && !frame->top_field_first; | ctx->cur_field = frame->interlaced_frame && !frame->top_field_first; | ||||
| } | } | ||||
| @@ -1090,7 +1098,11 @@ encode_coding_unit: | |||||
| goto encode_coding_unit; | goto encode_coding_unit; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->quality = ctx->qscale * FF_QP2LAMBDA; | avctx->coded_frame->quality = ctx->qscale * FF_QP2LAMBDA; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | ||||
| if (!sd) | if (!sd) | ||||
| @@ -35,8 +35,12 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| { | { | ||||
| DPXContext *s = avctx->priv_data; | DPXContext *s = avctx->priv_data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->big_endian = 1; | s->big_endian = 1; | ||||
| s->bits_per_component = 8; | s->bits_per_component = 8; | ||||
| @@ -716,8 +716,12 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt, | |||||
| c->pix_fmt = s->sys->pix_fmt; | c->pix_fmt = s->sys->pix_fmt; | ||||
| s->frame = frame; | s->frame = frame; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| c->coded_frame->key_frame = 1; | c->coded_frame->key_frame = 1; | ||||
| c->coded_frame->pict_type = AV_PICTURE_TYPE_I; | c->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->buf = pkt->data; | s->buf = pkt->data; | ||||
| c->execute(c, dv_encode_video_segment, s->work_chunks, NULL, | c->execute(c, dv_encode_video_segment, s->work_chunks, NULL, | ||||
| @@ -721,7 +721,11 @@ static av_cold int ffv1_encode_init(AVCodecContext *avctx) | |||||
| if ((ret = ffv1_allocate_initial_states(s)) < 0) | if ((ret = ffv1_allocate_initial_states(s)) < 0) | ||||
| return ret; | return ret; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (!s->transparency) | if (!s->transparency) | ||||
| s->plane_count = 2; | s->plane_count = 2; | ||||
| @@ -1045,7 +1049,11 @@ static int ffv1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } else if (avctx->flags & CODEC_FLAG_PASS1) | } else if (avctx->flags & CODEC_FLAG_PASS1) | ||||
| avctx->stats_out[0] = '\0'; | avctx->stats_out[0] = '\0'; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = f->key_frame; | avctx->coded_frame->key_frame = f->key_frame; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| f->picture_number++; | f->picture_number++; | ||||
| pkt->size = buf_p - pkt->data; | pkt->size = buf_p - pkt->data; | ||||
| @@ -258,13 +258,21 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| //mark the frame type so the muxer can mux it correctly | //mark the frame type so the muxer can mux it correctly | ||||
| if (I_frame) { | if (I_frame) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->last_key_frame = avctx->frame_number; | s->last_key_frame = avctx->frame_number; | ||||
| ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number); | ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number); | ||||
| } else { | } else { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | ||||
| avctx->coded_frame->key_frame = 0; | avctx->coded_frame->key_frame = 0; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| if (I_frame) | if (I_frame) | ||||
| @@ -130,8 +130,12 @@ static av_cold int gif_encode_init(AVCodecContext *avctx) | |||||
| { | { | ||||
| GIFContext *s = avctx->priv_data; | GIFContext *s = avctx->priv_data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->lzw = av_mallocz(ff_lzw_encode_state_size); | s->lzw = av_mallocz(ff_lzw_encode_state_size); | ||||
| if (!s->lzw) | if (!s->lzw) | ||||
| @@ -157,8 +157,12 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| if (!avctx->extradata || !avctx->stats_out) | if (!avctx->extradata || !avctx->stats_out) | ||||
| return AVERROR(ENOMEM); | return AVERROR(ENOMEM); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| switch (avctx->pix_fmt) { | switch (avctx->pix_fmt) { | ||||
| case AV_PIX_FMT_YUV420P: | case AV_PIX_FMT_YUV420P: | ||||
| @@ -415,8 +415,12 @@ memfail: | |||||
| static av_cold int encode_init_ls(AVCodecContext *ctx) | static av_cold int encode_init_ls(AVCodecContext *ctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| ctx->coded_frame->key_frame = 1; | ctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (ctx->pix_fmt != AV_PIX_FMT_GRAY8 && | if (ctx->pix_fmt != AV_PIX_FMT_GRAY8 && | ||||
| ctx->pix_fmt != AV_PIX_FMT_GRAY16 && | ctx->pix_fmt != AV_PIX_FMT_GRAY16 && | ||||
| @@ -138,8 +138,12 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| if (!avctx->extradata) | if (!avctx->extradata) | ||||
| return AVERROR(ENOMEM); | return AVERROR(ENOMEM); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| // Will be user settable someday | // Will be user settable someday | ||||
| c->compression = 6; | c->compression = 6; | ||||
| @@ -384,12 +384,16 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } | } | ||||
| memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size); | memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = p_frame_output->key_frame; | avctx->coded_frame->key_frame = p_frame_output->key_frame; | ||||
| avctx->coded_frame->pts = p_frame_output->frame_num; | |||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| /* Use the frame number of the encoded frame as the pts. It is OK to | /* 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 | * do so since Dirac is a constant frame rate codec. It expects input | ||||
| * to be of constant frame rate. */ | * 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++; | pkt->dts = p_schro_params->dts++; | ||||
| enc_size = p_frame_output->size; | enc_size = p_frame_output->size; | ||||
| @@ -343,7 +343,11 @@ static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt, | |||||
| // HACK: assumes no encoder delay, this is true until libtheora becomes | // HACK: assumes no encoder delay, this is true until libtheora becomes | ||||
| // multithreaded (which will be disabled unless explicitly requested) | // multithreaded (which will be disabled unless explicitly requested) | ||||
| pkt->pts = pkt->dts = frame->pts; | pkt->pts = pkt->dts = frame->pts; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avc_context->coded_frame->key_frame = !(o_packet.granulepos & h->keyframe_mask); | avc_context->coded_frame->key_frame = !(o_packet.granulepos & h->keyframe_mask); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (!(o_packet.granulepos & h->keyframe_mask)) | if (!(o_packet.granulepos & h->keyframe_mask)) | ||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| *got_packet = 1; | *got_packet = 1; | ||||
| @@ -397,14 +397,26 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, | |||||
| if (ret >= 0) { | if (ret >= 0) { | ||||
| memcpy(pkt->data, cx_frame->buf, pkt->size); | memcpy(pkt->data, cx_frame->buf, pkt->size); | ||||
| pkt->pts = pkt->dts = cx_frame->pts; | pkt->pts = pkt->dts = cx_frame->pts; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pts = cx_frame->pts; | avctx->coded_frame->pts = cx_frame->pts; | ||||
| avctx->coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY); | avctx->coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) { | if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| } else { | } else { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| } else { | } else { | ||||
| av_log(avctx, AV_LOG_ERROR, | av_log(avctx, AV_LOG_ERROR, | ||||
| @@ -253,6 +253,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, | |||||
| pkt->pts = pic_out.i_pts; | pkt->pts = pic_out.i_pts; | ||||
| pkt->dts = pic_out.i_dts; | pkt->dts = pic_out.i_dts; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| switch (pic_out.i_type) { | switch (pic_out.i_type) { | ||||
| case X264_TYPE_IDR: | case X264_TYPE_IDR: | ||||
| case X264_TYPE_I: | case X264_TYPE_I: | ||||
| @@ -266,6 +268,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, | |||||
| ctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | ctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | ||||
| break; | break; | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe; | pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe; | ||||
| if (ret) { | if (ret) { | ||||
| @@ -275,7 +279,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, | |||||
| return AVERROR(ENOMEM); | return AVERROR(ENOMEM); | ||||
| *(int *)sd = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | *(int *)sd = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| ctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | ctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| *got_packet = ret; | *got_packet = ret; | ||||
| @@ -298,6 +298,8 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| pkt->pts = x265pic_out.pts; | pkt->pts = x265pic_out.pts; | ||||
| pkt->dts = x265pic_out.dts; | pkt->dts = x265pic_out.dts; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| switch (x265pic_out.sliceType) { | switch (x265pic_out.sliceType) { | ||||
| case X265_TYPE_IDR: | case X265_TYPE_IDR: | ||||
| case X265_TYPE_I: | case X265_TYPE_I: | ||||
| @@ -310,6 +312,8 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | ||||
| break; | break; | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| *got_packet = 1; | *got_packet = 1; | ||||
| return 0; | return 0; | ||||
| @@ -161,7 +161,11 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pts = pic_out.i_pts; | avctx->coded_frame->pts = pic_out.i_pts; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->pts = pic_out.i_pts; | pkt->pts = pic_out.i_pts; | ||||
| if (avctx->has_b_frames) { | if (avctx->has_b_frames) { | ||||
| if (!x4->out_frame_count) | if (!x4->out_frame_count) | ||||
| @@ -171,6 +175,8 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } else | } else | ||||
| pkt->dts = pkt->pts; | pkt->dts = pkt->pts; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| switch (pic_out.i_type) { | switch (pic_out.i_type) { | ||||
| case XAVS_TYPE_IDR: | case XAVS_TYPE_IDR: | ||||
| case XAVS_TYPE_I: | case XAVS_TYPE_I: | ||||
| @@ -184,15 +190,25 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | ||||
| break; | break; | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| /* There is no IDR frame in AVS JiZhun */ | /* There is no IDR frame in AVS JiZhun */ | ||||
| /* Sequence header is used as a flag */ | /* Sequence header is used as a flag */ | ||||
| if (pic_out.i_type == XAVS_TYPE_I) { | if (pic_out.i_type == XAVS_TYPE_I) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | avctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | ||||
| if (!sd) | if (!sd) | ||||
| @@ -751,6 +751,8 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| *got_packet = 1; | *got_packet = 1; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; | avctx->coded_frame->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; | ||||
| if (xvid_enc_stats.type == XVID_TYPE_PVOP) | if (xvid_enc_stats.type == XVID_TYPE_PVOP) | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | ||||
| @@ -760,14 +762,24 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_S; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_S; | ||||
| else | else | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { | if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| if (x->quicktime_format) | if (x->quicktime_format) | ||||
| return xvid_strip_vol_header(avctx, pkt, | return xvid_strip_vol_header(avctx, pkt, | ||||
| xvid_enc_stats.hlength, xerr); | xvid_enc_stats.hlength, xerr); | ||||
| } else { | } else { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 0; | avctx->coded_frame->key_frame = 0; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| pkt->size = xerr; | pkt->size = xerr; | ||||
| @@ -276,8 +276,12 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx) | |||||
| return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch)); | s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch)); | ||||
| @@ -1475,7 +1475,11 @@ static void frame_end(MpegEncContext *s) | |||||
| } | } | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f); | av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| static void update_noise_reduction(MpegEncContext *s) | static void update_noise_reduction(MpegEncContext *s) | ||||
| @@ -1037,6 +1037,8 @@ static int nvenc_get_frame(AVCodecContext *avctx, AVPacket *pkt) | |||||
| switch (params.pictureType) { | switch (params.pictureType) { | ||||
| case NV_ENC_PIC_TYPE_IDR: | case NV_ENC_PIC_TYPE_IDR: | ||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| case NV_ENC_PIC_TYPE_INTRA_REFRESH: | case NV_ENC_PIC_TYPE_INTRA_REFRESH: | ||||
| case NV_ENC_PIC_TYPE_I: | case NV_ENC_PIC_TYPE_I: | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| @@ -1050,6 +1052,8 @@ static int nvenc_get_frame(AVCodecContext *avctx, AVPacket *pkt) | |||||
| case NV_ENC_PIC_TYPE_BI: | case NV_ENC_PIC_TYPE_BI: | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_BI; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_BI; | ||||
| break; | break; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -109,8 +109,12 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| static av_cold int pam_encode_init(AVCodecContext *avctx) | static av_cold int pam_encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -34,8 +34,12 @@ static const uint32_t monoblack_pal[16] = { 0x000000, 0xFFFFFF }; | |||||
| static av_cold int pcx_encode_init(AVCodecContext *avctx) | static av_cold int pcx_encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -455,8 +455,12 @@ static av_cold int png_enc_init(AVCodecContext *avctx) | |||||
| { | { | ||||
| PNGEncContext *s = avctx->priv_data; | PNGEncContext *s = avctx->priv_data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| ff_huffyuvencdsp_init(&s->hdsp); | ff_huffyuvencdsp_init(&s->hdsp); | ||||
| @@ -120,8 +120,12 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| static av_cold int pnm_encode_init(AVCodecContext *avctx) | static av_cold int pnm_encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -939,8 +939,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| uint8_t frame_flags; | uint8_t frame_flags; | ||||
| ctx->pic = pic; | ctx->pic = pic; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt_size = ctx->frame_size_upper_bound; | pkt_size = ctx->frame_size_upper_bound; | ||||
| @@ -215,7 +215,11 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
| } | } | ||||
| if (for_user) { | if (for_user) { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| dst->coded_frame = src->coded_frame; | dst->coded_frame = src->coded_frame; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } else { | } else { | ||||
| if (dst->codec->update_thread_context) | if (dst->codec->update_thread_context) | ||||
| err = dst->codec->update_thread_context(dst, src); | err = dst->codec->update_thread_context(dst, src); | ||||
| @@ -441,12 +441,16 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, | |||||
| bs->FrameType & MFX_FRAMETYPE_xIDR) | bs->FrameType & MFX_FRAMETYPE_xIDR) | ||||
| new_pkt.flags |= AV_PKT_FLAG_KEY; | new_pkt.flags |= AV_PKT_FLAG_KEY; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI) | if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI) | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP) | else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP) | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; | ||||
| else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) | else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| av_freep(&bs); | av_freep(&bs); | ||||
| @@ -321,8 +321,12 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| av_picture_copy(&s->previous_frame, (const AVPicture *)pict, | av_picture_copy(&s->previous_frame, (const AVPicture *)pict, | ||||
| avctx->pix_fmt, avctx->width, avctx->height); | avctx->pix_fmt, avctx->width, avctx->height); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = s->key_frame; | avctx->coded_frame->key_frame = s->key_frame; | ||||
| avctx->coded_frame->pict_type = pict_type; | avctx->coded_frame->pict_type = pict_type; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (s->key_frame) | if (s->key_frame) | ||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| @@ -35,8 +35,12 @@ static av_cold int raw_encode_init(AVCodecContext *avctx) | |||||
| { | { | ||||
| const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc); | avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc); | ||||
| if(!avctx->codec_tag) | if(!avctx->codec_tag) | ||||
| avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt); | avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt); | ||||
| @@ -49,8 +49,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| unsigned int bytes_per_channel, pixmax, put_be; | unsigned int bytes_per_channel, pixmax, put_be; | ||||
| unsigned char *end_buf; | unsigned char *end_buf; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| width = avctx->width; | width = avctx->width; | ||||
| height = avctx->height; | height = avctx->height; | ||||
| @@ -153,8 +153,12 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx) | |||||
| return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->maptype = RMT_NONE; | s->maptype = RMT_NONE; | ||||
| s->maplength = 0; | s->maplength = 0; | ||||
| @@ -609,8 +609,12 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| s->pict_type = AV_PICTURE_TYPE_I; | s->pict_type = AV_PICTURE_TYPE_I; | ||||
| s->quality = pict->quality; | s->quality = pict->quality; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = s->pict_type; | avctx->coded_frame->pict_type = s->pict_type; | ||||
| avctx->coded_frame->key_frame = s->pict_type == AV_PICTURE_TYPE_I; | avctx->coded_frame->key_frame = s->pict_type == AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); | ||||
| if (!sd) | if (!sd) | ||||
| @@ -150,8 +150,12 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| static av_cold int targa_encode_init(AVCodecContext *avctx) | static av_cold int targa_encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -490,8 +490,12 @@ fail: | |||||
| static av_cold int encode_init(AVCodecContext *avctx) | static av_cold int encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -1169,11 +1169,15 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code | |||||
| if (av_codec_is_encoder(avctx->codec)) { | if (av_codec_is_encoder(avctx->codec)) { | ||||
| int i; | int i; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame = av_frame_alloc(); | avctx->coded_frame = av_frame_alloc(); | ||||
| if (!avctx->coded_frame) { | if (!avctx->coded_frame) { | ||||
| ret = AVERROR(ENOMEM); | ret = AVERROR(ENOMEM); | ||||
| goto free_and_end; | goto free_and_end; | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (avctx->codec->sample_fmts) { | if (avctx->codec->sample_fmts) { | ||||
| for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { | for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { | ||||
| if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) | if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) | ||||
| @@ -1301,7 +1305,11 @@ free_and_end: | |||||
| av_opt_free(avctx->priv_data); | av_opt_free(avctx->priv_data); | ||||
| av_opt_free(avctx); | av_opt_free(avctx); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| av_frame_free(&avctx->coded_frame); | av_frame_free(&avctx->coded_frame); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| av_dict_free(&tmp); | av_dict_free(&tmp); | ||||
| av_freep(&avctx->priv_data); | av_freep(&avctx->priv_data); | ||||
| @@ -1822,7 +1830,11 @@ av_cold int avcodec_close(AVCodecContext *avctx) | |||||
| av_freep(&avctx->priv_data); | av_freep(&avctx->priv_data); | ||||
| if (av_codec_is_encoder(avctx->codec)) { | if (av_codec_is_encoder(avctx->codec)) { | ||||
| av_freep(&avctx->extradata); | av_freep(&avctx->extradata); | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| av_frame_free(&avctx->coded_frame); | av_frame_free(&avctx->coded_frame); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| avctx->codec = NULL; | avctx->codec = NULL; | ||||
| avctx->active_thread_type = 0; | avctx->active_thread_type = 0; | ||||
| @@ -615,8 +615,12 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| * At least currently Ut Video is IDR only. | * At least currently Ut Video is IDR only. | ||||
| * Set flags accordingly. | * Set flags accordingly. | ||||
| */ | */ | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->size = bytestream2_tell_p(&pb); | pkt->size = bytestream2_tell_p(&pb); | ||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| @@ -91,7 +91,11 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->pack_line_8 = v210_planar_pack_8_c; | s->pack_line_8 = v210_planar_pack_8_c; | ||||
| s->pack_line_10 = v210_planar_pack_10_c; | s->pack_line_10 = v210_planar_pack_10_c; | ||||
| @@ -49,8 +49,12 @@ static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } | } | ||||
| dst = pkt->data; | dst = pkt->data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| y = (uint16_t *)pic->data[0]; | y = (uint16_t *)pic->data[0]; | ||||
| u = (uint16_t *)pic->data[1]; | u = (uint16_t *)pic->data[1]; | ||||
| @@ -30,7 +30,7 @@ | |||||
| #define LIBAVCODEC_VERSION_MAJOR 56 | #define LIBAVCODEC_VERSION_MAJOR 56 | ||||
| #define LIBAVCODEC_VERSION_MINOR 33 | #define LIBAVCODEC_VERSION_MINOR 33 | ||||
| #define LIBAVCODEC_VERSION_MICRO 0 | |||||
| #define LIBAVCODEC_VERSION_MICRO 1 | |||||
| #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||
| LIBAVCODEC_VERSION_MINOR, \ | LIBAVCODEC_VERSION_MINOR, \ | ||||
| @@ -171,5 +171,8 @@ | |||||
| #ifndef FF_API_RC_STRATEGY | #ifndef FF_API_RC_STRATEGY | ||||
| #define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) | #define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) | ||||
| #endif | #endif | ||||
| #ifndef FF_API_CODED_FRAME | |||||
| #define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) | |||||
| #endif | |||||
| #endif /* AVCODEC_VERSION_H */ | #endif /* AVCODEC_VERSION_H */ | ||||
| @@ -26,7 +26,11 @@ | |||||
| static av_cold int xbm_encode_init(AVCodecContext *avctx) | static av_cold int xbm_encode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -146,8 +146,12 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| } | } | ||||
| buf = pkt->data; | buf = pkt->data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->key_frame = 1; | avctx->coded_frame->key_frame = 1; | ||||
| avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| bytestream_put_be32(&buf, header_size); | bytestream_put_be32(&buf, header_size); | ||||
| bytestream_put_be32(&buf, XWD_VERSION); // file version | bytestream_put_be32(&buf, XWD_VERSION); // file version | ||||
| @@ -133,8 +133,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
| c->curfrm++; | c->curfrm++; | ||||
| if(c->curfrm == c->keyint) | if(c->curfrm == c->keyint) | ||||
| c->curfrm = 0; | c->curfrm = 0; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| avctx->coded_frame->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; | avctx->coded_frame->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; | ||||
| avctx->coded_frame->key_frame = keyframe; | avctx->coded_frame->key_frame = keyframe; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| chpal = !keyframe && memcmp(p->data[1], c->pal2, 1024); | chpal = !keyframe && memcmp(p->data[1], c->pal2, 1024); | ||||
| palptr = (uint32_t*)p->data[1]; | palptr = (uint32_t*)p->data[1]; | ||||
| @@ -866,7 +866,11 @@ static int v4l2_read_header(AVFormatContext *s1) | |||||
| static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt) | static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt) | ||||
| { | { | ||||
| struct video_data *s = s1->priv_data; | struct video_data *s = s1->priv_data; | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| AVFrame *frame = s1->streams[0]->codec->coded_frame; | AVFrame *frame = s1->streams[0]->codec->coded_frame; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| int res; | int res; | ||||
| av_init_packet(pkt); | av_init_packet(pkt); | ||||
| @@ -874,10 +878,14 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt) | |||||
| return res; | return res; | ||||
| } | } | ||||
| #if FF_API_CODED_FRAME | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (frame && s->interlaced) { | if (frame && s->interlaced) { | ||||
| frame->interlaced_frame = 1; | frame->interlaced_frame = 1; | ||||
| frame->top_field_first = s->top_field_first; | frame->top_field_first = s->top_field_first; | ||||
| } | } | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| return pkt->size; | return pkt->size; | ||||
| } | } | ||||