patch-plugins_ffmpeg_params_c 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. $OpenBSD: patch-plugins_ffmpeg_params_c,v 1.3 2014/04/06 20:24:01 brad Exp $
  2. Deal with newer FFmpeg API.
  3. --- plugins/ffmpeg/params.c.orig Thu Mar 27 17:09:20 2014
  4. +++ plugins/ffmpeg/params.c Thu Mar 27 17:14:09 2014
  5. @@ -101,6 +101,17 @@ typedef struct
  6. } \
  7. }
  8. +#define PARAM_DICT_INT(name, dict_name) \
  9. + { \
  10. + if(!strcasecmp(name, key)) \
  11. + { \
  12. + char buf[128]; \
  13. + snprintf(buf, sizeof(buf), "%d", *(int*)value); \
  14. + av_dict_set(options, dict_name, buf, 0); \
  15. + found = 1; \
  16. + } \
  17. + }
  18. +
  19. #define PARAM_DICT_FLAG(name, dict_name) \
  20. { \
  21. if(!strcasecmp(name, key)) \
  22. @@ -202,8 +213,15 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
  23. PARAM_INT("ff_max_b_frames",max_b_frames);
  24. PARAM_FLOAT("ff_b_quant_factor",b_quant_factor);
  25. PARAM_INT("ff_b_frame_strategy",b_frame_strategy);
  26. +
  27. +#if LIBAVCODEC_VERSION_MAJOR >= 55
  28. + PARAM_DICT_INT("ff_luma_elim_threshold","luma_elim_threshold");
  29. + PARAM_DICT_INT("ff_chroma_elim_threshold","chroma_elim_threshold");
  30. +#else
  31. PARAM_INT("ff_luma_elim_threshold",luma_elim_threshold);
  32. PARAM_INT("ff_chroma_elim_threshold",chroma_elim_threshold);
  33. +#endif
  34. +
  35. PARAM_INT("ff_strict_std_compliance",strict_std_compliance);
  36. PARAM_QP2LAMBDA("ff_b_quant_offset",b_quant_offset);
  37. PARAM_INT("ff_rc_min_rate",rc_min_rate);
  38. @@ -241,8 +259,15 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
  39. PARAM_QP2LAMBDA("ff_lmax", lmax);
  40. PARAM_INT("ff_noise_reduction",noise_reduction);
  41. PARAM_INT_SCALE("ff_rc_initial_buffer_occupancy",rc_initial_buffer_occupancy,1000);
  42. +
  43. +#if LIBAVCODEC_VERSION_MAJOR >= 55
  44. + PARAM_DICT_INT("ff_inter_threshold","inter_threshold");
  45. + PARAM_DICT_INT("ff_quantizer_noise_shaping","quantizer_noise_shaping");
  46. +#else
  47. PARAM_INT("ff_inter_threshold",inter_threshold);
  48. PARAM_INT("ff_quantizer_noise_shaping",quantizer_noise_shaping);
  49. +#endif
  50. +
  51. PARAM_INT("ff_thread_count",thread_count);
  52. PARAM_INT("ff_me_threshold",me_threshold);
  53. PARAM_INT("ff_mb_threshold",mb_threshold);
  54. @@ -272,8 +297,16 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
  55. PARAM_FLAG("ff_flag_bitexact",CODEC_FLAG_BITEXACT);
  56. PARAM_FLAG("ff_flag_ac_pred",CODEC_FLAG_AC_PRED);
  57. // PARAM_FLAG("ff_flag_h263p_umv",CODEC_FLAG_H263P_UMV); // Unused
  58. +
  59. +#if LIBAVCODEC_VERSION_MAJOR >= 55
  60. + PARAM_DICT_FLAG("ff_flag_cbp_rd","cbp_rd");
  61. + PARAM_DICT_FLAG("ff_flag_qp_rd","qp_rd");
  62. + PARAM_DICT_FLAG("ff_flag2_strict_gop","strict_gop");
  63. +#else
  64. PARAM_FLAG("ff_flag_cbp_rd",CODEC_FLAG_CBP_RD);
  65. PARAM_FLAG("ff_flag_qp_rd",CODEC_FLAG_QP_RD);
  66. + PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
  67. +#endif
  68. #if LIBAVCODEC_VERSION_MAJOR >= 54
  69. PARAM_DICT_FLAG("ff_flag_h263p_aiv", "aiv");
  70. @@ -288,7 +321,6 @@ void lqt_ffmpeg_set_parameter(AVCodecContext * ctx,
  71. PARAM_FLAG("ff_flag_loop_filter",CODEC_FLAG_LOOP_FILTER);
  72. PARAM_FLAG("ff_flag_closed_gop",CODEC_FLAG_CLOSED_GOP);
  73. PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST);
  74. - PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
  75. PARAM_ENUM("ff_coder_type",coder_type,coder_type);
  76. }