libquicktime-1.2.4-ffmpeg29.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. Index: libquicktime-1.2.4/plugins/ffmpeg/video.c
  2. ===================================================================
  3. --- libquicktime-1.2.4.orig/plugins/ffmpeg/video.c
  4. +++ libquicktime-1.2.4/plugins/ffmpeg/video.c
  5. @@ -37,10 +37,10 @@
  6. #endif
  7. -#ifdef PIX_FMT_YUV422P10
  8. -#define PIX_FMT_YUV422P10_OR_DUMMY PIX_FMT_YUV422P10
  9. +#ifdef AV_PIX_FMT_YUV422P10
  10. +#define AV_PIX_FMT_YUV422P10_OR_DUMMY AV_PIX_FMT_YUV422P10
  11. #else
  12. -#define PIX_FMT_YUV422P10_OR_DUMMY -1234
  13. +#define AV_PIX_FMT_YUV422P10_OR_DUMMY -1234
  14. #endif
  15. #if LIBAVCODEC_VERSION_INT >= ((54<<16)|(1<<8)|0)
  16. @@ -90,9 +90,9 @@ typedef struct
  17. int imx_bitrate;
  18. int imx_strip_vbi;
  19. - /* In some cases FFMpeg would report something like PIX_FMT_YUV422P, while
  20. - we would like to treat it as PIX_FMT_YUVJ422P. It's only used for decoding */
  21. - enum PixelFormat reinterpret_pix_fmt;
  22. + /* In some cases FFMpeg would report something like AV_PIX_FMT_YUV422P, while
  23. + we would like to treat it as AV_PIX_FMT_YUVJ422P. It's only used for decoding */
  24. + enum AVPixelFormat reinterpret_pix_fmt;
  25. int is_imx;
  26. int y_offset;
  27. @@ -137,42 +137,42 @@ typedef struct
  28. static const struct
  29. {
  30. - enum PixelFormat ffmpeg_id;
  31. + enum AVPixelFormat ffmpeg_id;
  32. int lqt_id;
  33. int exact;
  34. }
  35. colormodels[] =
  36. {
  37. - { PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
  38. + { AV_PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
  39. #if LIBAVUTIL_VERSION_INT < (50<<16)
  40. - { PIX_FMT_YUV422, BC_YUV422, 1 },
  41. + { AV_PIX_FMT_YUV422, BC_YUV422, 1 },
  42. #else
  43. - { PIX_FMT_YUYV422, BC_YUV422, 1 },
  44. + { AV_PIX_FMT_YUYV422, BC_YUV422, 1 },
  45. #endif
  46. - { PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
  47. - { PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
  48. - { PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  49. - { PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
  50. - { PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
  51. - { PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  52. -#ifdef PIX_FMT_YUV422P10
  53. - { PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
  54. -#endif
  55. - { PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness
  56. - { PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
  57. - { PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
  58. - { PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
  59. + { AV_PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
  60. + { AV_PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
  61. + { AV_PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  62. + { AV_PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
  63. + { AV_PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
  64. + { AV_PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  65. +#ifdef AV_PIX_FMT_YUV422P10
  66. + { AV_PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
  67. +#endif
  68. + { AV_PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness
  69. + { AV_PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
  70. + { AV_PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
  71. + { AV_PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
  72. #if LIBAVUTIL_VERSION_INT < (50<<16)
  73. - { PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
  74. + { AV_PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
  75. #else
  76. - { PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
  77. + { AV_PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
  78. #endif
  79. - { PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1
  80. - { PIX_FMT_GRAY8, BC_RGB888, 0 },
  81. - { PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white
  82. - { PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black
  83. - { PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette
  84. - { PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
  85. + { AV_PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1
  86. + { AV_PIX_FMT_GRAY8, BC_RGB888, 0 },
  87. + { AV_PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white
  88. + { AV_PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black
  89. + { AV_PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette
  90. + { AV_PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
  91. };
  92. static const struct
  93. @@ -343,16 +343,16 @@ static int lqt_tenbit_dnxhd_supported(AV
  94. if (!codec->pix_fmts)
  95. return 0;
  96. - for (i = 0; codec->pix_fmts[i] != PIX_FMT_NONE; ++i)
  97. + for (i = 0; codec->pix_fmts[i] != AV_PIX_FMT_NONE; ++i)
  98. {
  99. - if (codec->pix_fmts[i] == PIX_FMT_YUV422P10_OR_DUMMY)
  100. + if (codec->pix_fmts[i] == AV_PIX_FMT_YUV422P10_OR_DUMMY)
  101. return 1;
  102. }
  103. return 0;
  104. }
  105. -static enum PixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
  106. +static enum AVPixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
  107. {
  108. int i;
  109. @@ -361,10 +361,10 @@ static enum PixelFormat lqt_ffmpeg_get_f
  110. if(colormodels[i].lqt_id == id)
  111. return colormodels[i].ffmpeg_id;
  112. }
  113. - return PIX_FMT_NB;
  114. + return AV_PIX_FMT_NB;
  115. }
  116. -static int lqt_ffmpeg_get_lqt_colormodel(enum PixelFormat id, int * exact)
  117. +static int lqt_ffmpeg_get_lqt_colormodel(enum AVPixelFormat id, int * exact)
  118. {
  119. int i;
  120. @@ -402,24 +402,24 @@ static void lqt_ffmpeg_setup_decoding_co
  121. /* First we try codec-specific colormodel matching. */
  122. if(codec->decoder->id == AV_CODEC_ID_DNXHD)
  123. {
  124. - /* FFMpeg supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10 for DNxHD, which
  125. - we sometimes interpret as PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10. */
  126. - if (codec->avctx->pix_fmt == PIX_FMT_YUV422P || codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY)
  127. + /* FFMpeg supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10 for DNxHD, which
  128. + we sometimes interpret as AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10. */
  129. + if (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P || codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY)
  130. {
  131. - int p10 = (codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY);
  132. + int p10 = (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY);
  133. *exact = 1;
  134. if (lqt_ffmpeg_get_avid_yuv_range(vtrack->track) == AVID_FULL_YUV_RANGE)
  135. {
  136. vtrack->stream_cmodel = p10 ? BC_YUVJ422P10 : BC_YUVJ422P;
  137. - codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUVJ422P;
  138. - // Note: reinterpret_pix_fmt should really be PIX_FMT_YUVJ422P10, except
  139. + codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUVJ422P;
  140. + // Note: reinterpret_pix_fmt should really be AV_PIX_FMT_YUVJ422P10, except
  141. // there is no such colormodel in FFMpeg. Fortunately, it's not a problem
  142. // in this case, as reinterpret_pix_fmt is only used when *exact == 0.
  143. }
  144. else
  145. {
  146. vtrack->stream_cmodel = p10 ? BC_YUV422P10 : BC_YUV422P;
  147. - codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUV422P;
  148. + codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUV422P;
  149. }
  150. return;
  151. }
  152. @@ -440,14 +440,14 @@ static void lqt_ffmpeg_setup_encoding_co
  153. if (codec->encoder->id == AV_CODEC_ID_DNXHD)
  154. {
  155. - /* FFMpeg's DNxHD encoder only supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10
  156. - and doesn't know anything about PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10
  157. + /* FFMpeg's DNxHD encoder only supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10
  158. + and doesn't know anything about AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10
  159. (in fact, the latter doesn't even exist) */
  160. - codec->avctx->pix_fmt = PIX_FMT_YUV422P;
  161. + codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
  162. if (vtrack->stream_cmodel == BC_YUV422P10 || vtrack->stream_cmodel == BC_YUVJ422P10)
  163. {
  164. if (lqt_tenbit_dnxhd_supported(codec->encoder))
  165. - codec->avctx->pix_fmt = PIX_FMT_YUV422P10_OR_DUMMY;
  166. + codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P10_OR_DUMMY;
  167. }
  168. }
  169. }
  170. @@ -458,7 +458,7 @@ static void lqt_ffmpeg_setup_encoding_co
  171. /* From avcodec.h: */
  172. /*
  173. - * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
  174. + * AV_PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
  175. * color is put together as:
  176. * (A << 24) | (R << 16) | (G << 8) | B
  177. * This is stored as BGRA on little endian CPU architectures and ARGB on
  178. @@ -530,7 +530,7 @@ static void convert_rgba_to_argb(uint8_t
  179. */
  180. static void convert_image_decode(quicktime_ffmpeg_video_codec_t *codec,
  181. - AVFrame * in_frame, enum PixelFormat in_format,
  182. + AVFrame * in_frame, enum AVPixelFormat in_format,
  183. unsigned char ** out_frame, int out_format,
  184. int width, int height, int row_span, int row_span_uv)
  185. {
  186. @@ -547,9 +547,9 @@ static void convert_image_decode(quickti
  187. * RGBA format like in ffmpeg??
  188. */
  189. #if LIBAVUTIL_VERSION_INT < (50<<16)
  190. - if((in_format == PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
  191. + if((in_format == AV_PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
  192. #else
  193. - if((in_format == PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
  194. + if((in_format == AV_PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
  195. #endif
  196. {
  197. convert_image_decode_rgba(in_frame, out_frame, width, height, codec->y_offset);
  198. @@ -829,7 +829,7 @@ static int lqt_ffmpeg_decode_video(quick
  199. if(avcodec_open2(codec->avctx, codec->decoder, NULL) != 0)
  200. return -1;
  201. #endif
  202. - codec->frame = avcodec_alloc_frame();
  203. + codec->frame = av_frame_alloc();
  204. vtrack->stream_cmodel = LQT_COLORMODEL_NONE;
  205. codec->initialized = 1;
  206. }
  207. @@ -929,10 +929,10 @@ static int lqt_ffmpeg_decode_video(quick
  208. #ifdef HAVE_LIBSWSCALE
  209. #if LIBAVUTIL_VERSION_INT < (50<<16)
  210. - if(!((codec->avctx->pix_fmt == PIX_FMT_RGBA32) &&
  211. + if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGBA32) &&
  212. (vtrack->stream_cmodel == BC_RGBA8888)))
  213. #else
  214. - if(!((codec->avctx->pix_fmt == PIX_FMT_RGB32) &&
  215. + if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGB32) &&
  216. (vtrack->stream_cmodel == BC_RGBA8888)))
  217. #endif
  218. {
  219. @@ -1318,7 +1318,7 @@ static int lqt_ffmpeg_encode_video(quick
  220. if(!codec->initialized)
  221. {
  222. - codec->frame = avcodec_alloc_frame();
  223. + codec->frame = av_frame_alloc();
  224. /* time_base is 1/framerate for constant framerate */
  225. @@ -1396,9 +1396,9 @@ static int lqt_ffmpeg_encode_video(quick
  226. if(vtrack->stream_cmodel == BC_RGBA8888)
  227. {
  228. /* Libquicktime doesn't natively support a color model equivalent
  229. - to PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
  230. + to AV_PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
  231. So, we use BC_RGBA8888 and do ad hoc conversion below. */
  232. - codec->avctx->pix_fmt = PIX_FMT_ARGB;
  233. + codec->avctx->pix_fmt = AV_PIX_FMT_ARGB;
  234. vtrack->track->mdia.minf.stbl.stsd.table[0].depth = 32;
  235. }
  236. }
  237. @@ -1467,7 +1467,7 @@ static int lqt_ffmpeg_encode_video(quick
  238. }
  239. // codec->lqt_colormodel = ffmepg_2_lqt(codec->com.ffcodec_enc);
  240. - if(codec->y_offset != 0 || codec->avctx->pix_fmt == PIX_FMT_ARGB)
  241. + if(codec->y_offset != 0 || codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
  242. {
  243. if(!codec->tmp_rows)
  244. {
  245. @@ -1492,7 +1492,7 @@ static int lqt_ffmpeg_encode_video(quick
  246. vtrack->stream_cmodel,
  247. 0, 0, 0, codec->y_offset);
  248. }
  249. - else if(codec->avctx->pix_fmt == PIX_FMT_ARGB)
  250. + else if(codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
  251. {
  252. convert_rgba_to_argb(row_pointers[0], vtrack->stream_row_span,
  253. codec->tmp_rows[0], codec->tmp_row_span,
  254. Index: libquicktime-1.2.4/plugins/ffmpeg/audio.c
  255. ===================================================================
  256. --- libquicktime-1.2.4.orig/plugins/ffmpeg/audio.c
  257. +++ libquicktime-1.2.4/plugins/ffmpeg/audio.c
  258. @@ -1266,7 +1266,7 @@ static int lqt_ffmpeg_encode_audio(quick
  259. pkt.data = codec->chunk_buffer;
  260. pkt.size = codec->chunk_buffer_alloc;
  261. - avcodec_get_frame_defaults(&f);
  262. + av_frame_unref(&f);
  263. f.nb_samples = codec->avctx->frame_size;
  264. avcodec_fill_audio_frame(&f, channels, codec->avctx->sample_fmt,