SHA256
1
0
forked from pool/libquicktime
libquicktime/0005-ffmpeg4-conversion-fixing-the-erroring-ones-only.patch
Tomáš Chvátal e93eddf4dc - Update to version 1.2.4+git20180207.666c35c:
* remove generated file that got committed somehow
  * cleanup - remove all the .cvsignore files
  * remove another .cvsignore file
  * remove typo
  * add a bunch more generated files to ignore
  * more files added
  * add more files
  * switch to .gitignore from .cvsignore
  * remove m4/avcodec.m4, not needed with changes to configure.ac
  * don't need avcodec.m4 with changes to configure.ac
- Remove merged patches:
  * libquicktime-1.2.4-integer_overflow.patch
  * libquicktime-1.2.4-multiple_vulnerabilities.patch
- Remove all local patches:
  * libquicktime-faad2.patch
  * libquicktime-1.2.4-ffmpeg2.patch
  * libquicktime-1.2.4-ffmpeg29.patch
  * libquicktime-1.2.4-ffmpeg4.patch
- Readd patches to be rebased from the git:
  * 0001-Fix-sizeof-call-in-faad2.patch
  * 0002-Allow-any-avcodec-to-be-detected-by-configure.patch
  * 0003-Fix-AVCODEC_HEADER-macro-replacement.patch
  * 0004-Ignore-prepared-patches-in-git-checkout.patch
  * 0005-ffmpeg4-conversion-fixing-the-erroring-ones-only.patch

- Switch to Git snapshots as upstream moved to git, use _service

- Remove redone patch:
  * libquicktime-ffmpeg3.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/libquicktime?expand=0&rev=84
2018-06-13 09:51:34 +00:00

306 lines
12 KiB
Diff

From 545a2968caaa67b4062bf65fbb83539c3731294e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
Date: Wed, 13 Jun 2018 11:21:48 +0200
Subject: [PATCH 5/5] ffmpeg4 conversion fixing the erroring ones only
There are still quite few deprecated reports
---
plugins/ffmpeg/params.c | 72 ++++++++++++++---------------------------
plugins/ffmpeg/params.h | 2 +-
plugins/ffmpeg/video.c | 33 +++++++++----------
3 files changed, 41 insertions(+), 66 deletions(-)
diff --git a/plugins/ffmpeg/params.c b/plugins/ffmpeg/params.c
index a597d3e..6743390 100644
--- a/plugins/ffmpeg/params.c
+++ b/plugins/ffmpeg/params.c
@@ -124,16 +124,6 @@ typedef struct
}
-enum_t me_method[] =
- {
- { "Zero", ME_ZERO },
- { "Phods", ME_PHODS },
- { "Log", ME_LOG },
- { "X1", ME_X1 },
- { "Epzs", ME_EPZS },
- { "Full", ME_FULL }
- };
-
enum_t prediction_method[] =
{
{ "Left", FF_PRED_LEFT },
@@ -163,15 +153,6 @@ enum_t mb_decision[] =
{ "Rate distoration", FF_MB_DECISION_RD }
};
-enum_t coder_type[] =
- {
- { "VLC", FF_CODER_TYPE_VLC },
- { "Arithmetic", FF_CODER_TYPE_AC },
- { "Raw", FF_CODER_TYPE_RAW },
- { "RLE", FF_CODER_TYPE_RLE },
- { "Deflate", FF_CODER_TYPE_DEFLATE },
- };
-
#define PARAM_ENUM(name, var, arr) \
if(!strcasecmp(key, name)) \
{ \
@@ -201,7 +182,7 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
PARAM_INT_SCALE("ff_bit_rate_audio",bit_rate,1000);
PARAM_INT_SCALE("ff_bit_rate_video",bit_rate,1000);
PARAM_INT_SCALE("ff_bit_rate_tolerance",bit_rate_tolerance,1000);
- PARAM_ENUM("ff_me_method",me_method,me_method);
+ PARAM_DICT_INT("ff_me_method","motion-est");
PARAM_INT("ff_gop_size",gop_size);
PARAM_FLOAT("ff_qcompress",qcompress);
PARAM_FLOAT("ff_qblur",qblur);
@@ -225,10 +206,9 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
PARAM_INT("ff_rc_min_rate",rc_min_rate);
PARAM_INT("ff_rc_max_rate",rc_max_rate);
PARAM_INT_SCALE("ff_rc_buffer_size",rc_buffer_size,1000);
- PARAM_FLOAT("ff_rc_buffer_aggressivity",rc_buffer_aggressivity);
PARAM_FLOAT("ff_i_quant_factor",i_quant_factor);
PARAM_QP2LAMBDA("ff_i_quant_offset",i_quant_offset);
- PARAM_FLOAT("ff_rc_initial_cplx",rc_initial_cplx);
+ PARAM_DICT_INT("ff_rc_initial_cplx","rc_init_cplx");
PARAM_FLOAT("ff_lumi_masking",lumi_masking);
PARAM_FLOAT("ff_temporal_cplx_masking",temporal_cplx_masking);
PARAM_FLOAT("ff_spatial_cplx_masking",spatial_cplx_masking);
@@ -253,8 +233,8 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
PARAM_INT("ff_me_range",me_range);
PARAM_ENUM("ff_mb_decision",mb_decision,mb_decision);
PARAM_INT("ff_scenechange_threshold",scenechange_threshold);
- PARAM_QP2LAMBDA("ff_lmin", lmin);
- PARAM_QP2LAMBDA("ff_lmax", lmax);
+ PARAM_DICT_INT("ff_lmin", "lmin");
+ PARAM_DICT_INT("ff_lmax", "lmax");
PARAM_INT("ff_noise_reduction",noise_reduction);
PARAM_INT_SCALE("ff_rc_initial_buffer_occupancy",rc_initial_buffer_occupancy,1000);
@@ -267,29 +247,25 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
#endif
PARAM_INT("ff_thread_count",thread_count);
- PARAM_INT("ff_me_threshold",me_threshold);
- PARAM_INT("ff_mb_threshold",mb_threshold);
PARAM_INT("ff_nsse_weight",nsse_weight);
- PARAM_FLOAT("ff_border_masking",border_masking);
+ PARAM_DICT_INT("ff_border_masking","border_mask");
PARAM_QP2LAMBDA("ff_mb_lmin", mb_lmin);
PARAM_QP2LAMBDA("ff_mb_lmax", mb_lmax);
PARAM_INT("ff_me_penalty_compensation",me_penalty_compensation);
PARAM_INT("ff_bidir_refine",bidir_refine);
PARAM_INT("ff_brd_scale",brd_scale);
- PARAM_INT("ff_scenechange_factor",scenechange_factor);
- PARAM_FLAG("ff_flag_qscale",CODEC_FLAG_QSCALE);
- PARAM_FLAG("ff_flag_4mv",CODEC_FLAG_4MV);
- PARAM_FLAG("ff_flag_qpel",CODEC_FLAG_QPEL);
- PARAM_FLAG("ff_flag_gmc",CODEC_FLAG_GMC);
- PARAM_FLAG("ff_flag_mv0",CODEC_FLAG_MV0);
+ PARAM_FLAG("ff_flag_qscale",AV_CODEC_FLAG_QSCALE);
+ PARAM_FLAG("ff_flag_4mv",AV_CODEC_FLAG_4MV);
+ PARAM_FLAG("ff_flag_qpel",AV_CODEC_FLAG_QPEL);
+ PARAM_DICT_FLAG("ff_flag_gmc","gmc");
+ PARAM_DICT_FLAG("ff_flag_mv0","mpv_flags");
// PARAM_FLAG("ff_flag_part",CODEC_FLAG_PART); // Unused
- PARAM_FLAG("ff_flag_gray",CODEC_FLAG_GRAY);
- PARAM_FLAG("ff_flag_emu_edge",CODEC_FLAG_EMU_EDGE);
- PARAM_FLAG("ff_flag_normalize_aqp",CODEC_FLAG_NORMALIZE_AQP);
+ PARAM_FLAG("ff_flag_gray",AV_CODEC_FLAG_GRAY);
+ PARAM_DICT_FLAG("ff_flag_normalize_aqp","naq");
// PARAM_FLAG("ff_flag_alt_scan",CODEC_FLAG_ALT_SCAN); // Unused
PARAM_INT("ff_trellis",trellis);
- PARAM_FLAG("ff_flag_bitexact",CODEC_FLAG_BITEXACT);
- PARAM_FLAG("ff_flag_ac_pred",CODEC_FLAG_AC_PRED);
+ PARAM_FLAG("ff_flag_bitexact",AV_CODEC_FLAG_BITEXACT);
+ PARAM_FLAG("ff_flag_ac_pred",AV_CODEC_FLAG_AC_PRED);
// PARAM_FLAG("ff_flag_h263p_umv",CODEC_FLAG_H263P_UMV); // Unused
#if LIBAVCODEC_VERSION_MAJOR >= 55
@@ -297,9 +273,9 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
PARAM_DICT_FLAG("ff_flag_qp_rd","qp_rd");
PARAM_DICT_FLAG("ff_flag2_strict_gop","strict_gop");
#else
- PARAM_FLAG("ff_flag_cbp_rd",CODEC_FLAG_CBP_RD);
- PARAM_FLAG("ff_flag_qp_rd",CODEC_FLAG_QP_RD);
- PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
+ PARAM_FLAG("ff_flag_cbp_rd",AV_CODEC_FLAG_CBP_RD);
+ PARAM_FLAG("ff_flag_qp_rd",AV_CODEC_FLAG_QP_RD);
+ PARAM_FLAG2("ff_flag2_strict_gop",AV_CODEC_FLAG2_STRICT_GOP);
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 54
@@ -307,14 +283,14 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
PARAM_DICT_FLAG("ff_flag_obmc","obmc");
PARAM_DICT_FLAG("ff_flag_h263p_slice_struct","structured_slices");
#else
- PARAM_FLAG("ff_flag_h263p_aiv",CODEC_FLAG_H263P_AIV);
- PARAM_FLAG("ff_flag_obmc",CODEC_FLAG_OBMC);
- PARAM_FLAG("ff_flag_h263p_slice_struct",CODEC_FLAG_H263P_SLICE_STRUCT);
+ PARAM_FLAG("ff_flag_h263p_aiv",AV_CODEC_FLAG_H263P_AIV);
+ PARAM_FLAG("ff_flag_obmc",AV_CODEC_FLAG_OBMC);
+ PARAM_FLAG("ff_flag_h263p_slice_struct",AV_CODEC_FLAG_H263P_SLICE_STRUCT);
#endif
- PARAM_FLAG("ff_flag_loop_filter",CODEC_FLAG_LOOP_FILTER);
- PARAM_FLAG("ff_flag_closed_gop",CODEC_FLAG_CLOSED_GOP);
- PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST);
- PARAM_ENUM("ff_coder_type",coder_type,coder_type);
+ PARAM_FLAG("ff_flag_loop_filter",AV_CODEC_FLAG_LOOP_FILTER);
+ PARAM_FLAG("ff_flag_closed_gop",AV_CODEC_FLAG_CLOSED_GOP);
+ PARAM_FLAG2("ff_flag2_fast",AV_CODEC_FLAG2_FAST);
+ PARAM_DICT_INT("ff_coder_type","coder");
}
diff --git a/plugins/ffmpeg/params.h b/plugins/ffmpeg/params.h
index 31388a5..78e1f3f 100644
--- a/plugins/ffmpeg/params.h
+++ b/plugins/ffmpeg/params.h
@@ -149,7 +149,7 @@ the reference. Unused for constant quantizer encoding") \
.type = LQT_PARAMETER_INT, \
.val_default = { .val_int = 0 }, \
.val_min = { .val_int = 0 }, \
- .val_max = { .val_int = FF_MAX_B_FRAMES }, \
+ .val_max = { .val_int = 16 }, \
.help_string = TRS("Maximum number of B-frames between non B-frames") \
}
diff --git a/plugins/ffmpeg/video.c b/plugins/ffmpeg/video.c
index a2a8d56..61563aa 100644
--- a/plugins/ffmpeg/video.c
+++ b/plugins/ffmpeg/video.c
@@ -833,7 +833,7 @@ static int lqt_ffmpeg_decode_video(quicktime_t *file, unsigned char **row_pointe
if(extradata)
{
codec->extradata =
- calloc(1, extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ calloc(1, extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
memcpy(codec->extradata, extradata, extradata_size);
codec->avctx->extradata_size = extradata_size;
codec->avctx->extradata = codec->extradata;
@@ -1356,8 +1356,8 @@ static int init_imx_encoder(quicktime_t *file, int track)
codec->avctx->qmin = 1;
codec->avctx->qmax = codec->imx_bitrate == 30 ? 8 : 3;
codec->avctx->rtp_payload_size = 1; // ??
- codec->avctx->rc_buffer_aggressivity = 0.25;
- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_LOW_DELAY;
+ av_dict_set(&codec->options, "rc_buf_aggressivity", "0.25", 0);
+ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_LOW_DELAY;
av_dict_set(&codec->options, "non_linear_quant", "1", 0);
av_dict_set(&codec->options, "intra_vlc", "1", 0);
@@ -1413,14 +1413,14 @@ static int init_xdcam_hd422_encoder(quicktime_t *file, int track)
codec->avctx->intra_dc_precision = 2;
codec->avctx->qmin = 1;
codec->avctx->qmax = 12; // The maximum value compatible with non_linear_quant option.
- codec->avctx->lmin = FF_QP2LAMBDA;
+ codec->avctx->mb_lmin = FF_QP2LAMBDA;
// XDCAM is meant to use open GOPs. From time to time we might want to insert closed GOPs
// like some other encoders do, but libavcodec only checks this flag once.
- codec->avctx->flags &= ~CODEC_FLAG_CLOSED_GOP;
+ codec->avctx->flags &= ~AV_CODEC_FLAG_CLOSED_GOP;
if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME;
+ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_INTERLACED_ME;
av_dict_set(&codec->options, "non_linear_quant", "1", 0);
av_dict_set(&codec->options, "intra_vlc", "1", 0);
@@ -1450,7 +1450,7 @@ static int init_prores_encoder(quicktime_t *file, int track)
int height = trak->tkhd.track_height;
if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT;
+ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
// Color parameters go into ProRes bitstream.
if (trak->mdia.minf.stbl.stsd.table->has_colr)
@@ -1646,7 +1646,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
default:;
}
- if(codec->avctx->flags & CODEC_FLAG_QSCALE)
+ if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
codec->avctx->global_quality = codec->qscale;
codec->avctx->width = width;
@@ -1665,7 +1665,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
{
if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
{
- codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
codec->write_global_header = 1;
}
@@ -1681,7 +1681,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
{
lqt_log(file, LQT_LOG_INFO, LOG_DOMAIN, "Enabling interlaced encoding");
codec->avctx->flags |=
- (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN);
+ (AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_INTERLACED_ME|AV_CODEC_FLAG_ALT_SCAN);
}
#endif
}
@@ -1708,7 +1708,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
{
if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
{
- codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
codec->write_global_header = 1;
}
}
@@ -1731,7 +1731,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
{
if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
{
- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT;
+ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
}
}
else if(codec->is_imx)
@@ -1747,7 +1747,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
if(codec->pass == 1)
{
codec->stats_file = fopen(codec->stats_filename, "w");
- codec->avctx->flags |= CODEC_FLAG_PASS1;
+ codec->avctx->flags |= AV_CODEC_FLAG_PASS1;
}
else if(codec->pass == codec->total_passes)
{
@@ -1763,7 +1763,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
fclose(codec->stats_file);
codec->stats_file = (FILE*)0;
- codec->avctx->flags |= CODEC_FLAG_PASS2;
+ codec->avctx->flags |= AV_CODEC_FLAG_PASS2;
}
}
/* Open codec */
@@ -1829,7 +1829,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
}
codec->frame->pts = vtrack->timestamp / codec->encoding_pts_factor;
- if(codec->avctx->flags & CODEC_FLAG_QSCALE)
+ if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
codec->frame->quality = codec->qscale;
#if 1
if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
@@ -1906,8 +1906,7 @@ static int lqt_ffmpeg_encode_video(quicktime_t *file,
else if(codec->encoder->id == AV_CODEC_ID_MPEG4)
{
int advanced = 0;
- if(codec->avctx->max_b_frames ||
- (codec->avctx->flags & (CODEC_FLAG_QPEL|CODEC_FLAG_GMC)))
+ if(codec->avctx->max_b_frames)
advanced = 1;
setup_header_mpeg4(file, track, codec->avctx->extradata,
--
2.17.1