Ticket #36606: patch-ffmpeg-0.11.diff
File patch-ffmpeg-0.11.diff, 12.3 KB (added by ak.ml@…, 12 years ago) |
---|
-
encode/encode_lavc.c
Fix build with ffmpeg 0.11. https://bugs.gentoo.org/show_bug.cgi?id=419551 Author: Brennan Shacklett
old new struct tclavcprivatedata_ { 114 114 115 115 AVFrame ff_venc_frame; 116 116 AVCodecContext ff_vcontext; 117 AVDictionary ** ff_opts; 117 118 118 119 AVCodec *ff_vcodec; 119 120 … … static void tc_lavc_dispatch_settings(TC 1036 1037 SET_FLAG(pd, mv0); 1037 1038 SET_FLAG(pd, cbp); 1038 1039 SET_FLAG(pd, qpel); 1039 SET_FLAG(pd, alt);1040 SET_FLAG(pd, vdpart);1041 1040 SET_FLAG(pd, naq); 1042 1041 SET_FLAG(pd, ilme); 1043 1042 SET_FLAG(pd, ildct); 1044 1043 SET_FLAG(pd, aic); 1045 SET_FLAG(pd, aiv);1046 SET_FLAG(pd, umv);1047 1044 SET_FLAG(pd, psnr); 1048 1045 SET_FLAG(pd, trell); 1049 1046 SET_FLAG(pd, gray); … … static void tc_lavc_dispatch_settings(TC 1064 1061 pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT; 1065 1062 pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME; 1066 1063 } 1064 if (pd->confdata.flags.alt) { 1065 av_dict_set(pd->ff_opts, "alternate_scan", "1", 0); 1066 } 1067 if (pd->confdata.flags.vdpart) { 1068 av_dict_set(pd->ff_opts, "data_partitioning", "1", 0); 1069 } 1070 if (pd->confdata.flags.umv) { 1071 av_dict_set(pd->ff_opts, "umv", "1", 0); 1072 } 1073 if (pd->confdata.flags.aiv) { 1074 av_dict_set(pd->ff_opts, "aiv", "1", 0); 1075 } 1067 1076 } 1068 1077 1069 1078 #undef SET_FLAG … … static int tc_lavc_read_config(TCLavcPri 1184 1193 { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 }, 1185 1194 { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD }, 1186 1195 { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL }, 1187 { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN},1196 { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 }, 1188 1197 { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME }, 1189 1198 { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT }, 1190 1199 { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP }, 1191 { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},1200 { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 }, 1192 1201 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 1193 1202 { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC }, 1194 1203 #else 1195 1204 { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED }, 1196 1205 #endif 1197 { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIV},1198 { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV},1206 { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 }, 1207 { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 }, 1199 1208 { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR }, 1200 1209 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 1201 1210 { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT }, … … static int tc_lavc_configure(TCModuleIns 1387 1396 pd->confdata.thread_count, 1388 1397 (pd->confdata.thread_count > 1) ?"s" :""); 1389 1398 } 1390 avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count);1399 pd->ff_vcontext.thread_count = pd->confdata.thread_count; 1391 1400 1392 1401 pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd)); 1393 1402 if (pd->ff_vcodec == NULL) { … … static int tc_lavc_configure(TCModuleIns 1397 1406 } 1398 1407 1399 1408 TC_LOCK_LIBAVCODEC; 1400 ret = avcodec_open (&pd->ff_vcontext, pd->ff_vcodec);1409 ret = avcodec_open2(&pd->ff_vcontext, pd->ff_vcodec, pd->ff_opts); 1401 1410 TC_UNLOCK_LIBAVCODEC; 1402 1411 1403 1412 if (ret < 0) { 1404 tc_log_error(MOD_NAME, "avcodec_open () failed");1413 tc_log_error(MOD_NAME, "avcodec_open2() failed"); 1405 1414 goto failed; 1406 1415 } 1407 1416 /* finally, pass up the extradata, if any */ -
export/export_ffmpeg.c
old new static uint8_t *img_buffer = 122 122 static AVFrame *lavc_convert_frame = NULL; 123 123 124 124 static AVCodec *lavc_venc_codec = NULL; 125 static AVDictionary **lavc_venc_opts = NULL; 125 126 static AVFrame *lavc_venc_frame = NULL; 126 127 static AVCodecContext *lavc_venc_context; 127 128 static avi_t *avifile = NULL; … … static char *tc_strchrnul(const char *s, 180 181 181 182 182 183 /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */ 183 #include <libav codec/opt.h>184 #include <libavutil/opt.h> 184 185 #include <libavutil/avstring.h> 185 186 #include <libswscale/swscale.h> 186 187 … … MOD_init 470 471 } 471 472 472 473 TC_LOCK_LIBAVCODEC; 473 avcodec_init();474 474 avcodec_register_all(); 475 475 TC_UNLOCK_LIBAVCODEC; 476 476 … … MOD_init 634 634 lavc_param_rc_max_rate = 2516; 635 635 lavc_param_rc_buffer_size = 224 * 8; 636 636 lavc_param_rc_buffer_aggressivity = 99; 637 lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;637 lavc_param_scan_offset = 1; 638 638 639 639 break; 640 640 … … MOD_init 674 674 675 675 lavc_param_rc_buffer_size = 224 * 8; 676 676 lavc_param_rc_buffer_aggressivity = 99; 677 lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;677 lavc_param_scan_offset = 1; 678 678 679 679 break; 680 680 … … MOD_init 887 887 lavc_venc_context->thread_count); 888 888 } 889 889 890 avcodec_thread_init(lavc_venc_context, lavc_param_threads);890 lavc_venc_context->thread_count = lavc_param_threads; 891 891 892 892 if (lavc_param_intra_matrix) { 893 893 char *tmp; … … MOD_init 1065 1065 lavc_venc_context->flags |= lavc_param_closedgop; 1066 1066 lavc_venc_context->flags |= lavc_param_trunc; 1067 1067 lavc_venc_context->flags |= lavc_param_aic; 1068 lavc_venc_context->flags |= lavc_param_umv;1069 1068 lavc_venc_context->flags |= lavc_param_v4mv; 1070 lavc_venc_context->flags |= lavc_param_data_partitioning;1071 1069 lavc_venc_context->flags |= lavc_param_cbp; 1072 1070 lavc_venc_context->flags |= lavc_param_mv0; 1073 1071 lavc_venc_context->flags |= lavc_param_qp_rd; 1074 lavc_venc_context->flags |= lavc_param_scan_offset;1075 lavc_venc_context->flags |= lavc_param_ss;1076 lavc_venc_context->flags |= lavc_param_alt;1077 1072 lavc_venc_context->flags |= lavc_param_ilme; 1078 1073 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 1079 1074 lavc_venc_context->flags |= lavc_param_trell; … … MOD_init 1203 1198 1204 1199 lavc_venc_context->me_method = ME_ZERO + lavc_param_vme; 1205 1200 1206 1207 1201 /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */ 1208 1202 if (lavc_param_video_preset) { 1209 1203 avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context; … … MOD_init 1241 1235 } 1242 1236 } 1243 1237 1238 if (lavc_param_scan_offset) { 1239 av_dict_set(lavc_venc_opts, "scan_offset", "1", 0); 1240 } 1241 1242 if (lavc_param_ss) { 1243 av_dict_set(lavc_venc_opts, "structured_slices", "1", 0); 1244 } 1245 1246 if (lavc_param_alt) { 1247 av_dict_set(lavc_venc_opts, "alternate_scan", "1", 0); 1248 } 1249 1250 if (lavc_param_umv) { 1251 av_dict_set(lavc_venc_opts, "umv", "1", 0); 1252 } 1253 1254 if (lavc_param_data_partitioning) { 1255 av_dict_set(lavc_venc_opts, "vdpart", "1", 0); 1256 } 1244 1257 1245 1258 //-- open codec -- 1246 1259 //---------------- 1247 1260 TC_LOCK_LIBAVCODEC; 1248 ret = avcodec_open (lavc_venc_context, lavc_venc_codec);1261 ret = avcodec_open2(lavc_venc_context, lavc_venc_codec, lavc_venc_opts); 1249 1262 TC_UNLOCK_LIBAVCODEC; 1250 1263 if (ret < 0) { 1251 1264 tc_log_warn(MOD_NAME, "could not open FFMPEG codec"); 1252 1265 return TC_EXPORT_ERROR; 1253 1266 } 1254 1267 1255 if ( lavc_venc_context->codec->encode == NULL) {1268 if (av_codec_is_encoder(lavc_venc_context->codec) == 0) { 1256 1269 tc_log_warn(MOD_NAME, "could not open FFMPEG codec " 1257 "( lavc_venc_context->codec->encode == NULL)");1270 "(av_codec_is_encoder(lavc_venc_context->codec) == 0)"); 1258 1271 return TC_EXPORT_ERROR; 1259 1272 } 1260 1273 -
export/ffmpeg_cfg.c
old new TCConfigEntry lavcopts_conf[]={ 160 160 {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, 161 161 {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000}, 162 162 {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, 163 {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},163 {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1}, 164 164 // {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0}, 165 {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ PART},165 {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY}, 166 166 {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1}, 167 167 {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0}, 168 168 {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0}, … … TCConfigEntry lavcopts_conf[]={ 211 211 #else 212 212 {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED}, 213 213 #endif 214 {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV},214 {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1}, 215 215 {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, 216 216 {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, 217 217 {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, … … TCConfigEntry lavcopts_conf[]={ 223 223 {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000}, 224 224 {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD}, 225 225 {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16}, 226 {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT},227 {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET},228 {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN},226 {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1}, 227 {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1}, 228 {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1}, 229 229 {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME}, 230 230 {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, 231 231 {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, -
import/decode_lavc.c
old new void decode_lavc(decode_t *decode) 181 181 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 182 182 lavc_dec_context->error_resilience = 2; 183 183 #else 184 lavc_dec_context->err or_recognition = 2;184 lavc_dec_context->err_recognition = 2; 185 185 #endif 186 186 lavc_dec_context->error_concealment = 3; 187 187 lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT; -
import/import_ffmpeg.c
old new do_avi: 314 314 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 315 315 lavc_dec_context->error_resilience = 2; 316 316 #else 317 lavc_dec_context->err or_recognition = 2;317 lavc_dec_context->err_recognition = 2; 318 318 #endif 319 319 lavc_dec_context->error_concealment = 3; 320 320 lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT; -
import/probe_ffmpeg.c
old new void probe_ffmpeg(info_t *ipipe) 99 99 100 100 TC_INIT_LIBAVCODEC; 101 101 102 ret = av _open_input_file(&lavf_dmx_context, ipipe->name,103 NULL, 0,NULL);102 ret = avformat_open_input(&lavf_dmx_context, ipipe->name, 103 NULL, NULL); 104 104 if (ret != 0) { 105 105 tc_log_error(__FILE__, "unable to open '%s'" 106 106 " (libavformat failure)", -
libtc/tcavcodec.h
old new extern pthread_mutex_t tc_libavcodec_mut 53 53 54 54 #define TC_INIT_LIBAVCODEC do { \ 55 55 TC_LOCK_LIBAVCODEC; \ 56 avcodec_init(); \57 56 avcodec_register_all(); \ 58 57 TC_UNLOCK_LIBAVCODEC; \ 59 58 } while (0)