transcode: use ffmpeg4diff -r1.118 -r1.119 pkgsrc/multimedia/transcode/Makefile
(markd)
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.118 2019/07/21 22:25:28 wiz Exp $ | 1 | # $NetBSD: Makefile,v 1.119 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | DISTNAME= transcode-1.1.7 | 3 | DISTNAME= transcode-1.1.7 | |
4 | PKGREVISION= 36 | 4 | PKGREVISION= 37 | |
5 | CATEGORIES= multimedia | 5 | CATEGORIES= multimedia | |
6 | MASTER_SITES= http://bitbucket.org/france/transcode-tcforge/downloads/ | 6 | MASTER_SITES= http://bitbucket.org/france/transcode-tcforge/downloads/ | |
7 | EXTRACT_SUFX= .tar.bz2 | 7 | EXTRACT_SUFX= .tar.bz2 | |
8 | 8 | |||
9 | MAINTAINER= pkgsrc-users@NetBSD.org | 9 | MAINTAINER= pkgsrc-users@NetBSD.org | |
10 | HOMEPAGE= https://bitbucket.org/achurch_/transcode/wiki/Home | 10 | HOMEPAGE= https://bitbucket.org/achurch_/transcode/wiki/Home | |
11 | # or https://bitbucket.org/france/transcode-tcforge/wiki/Home | 11 | # or https://bitbucket.org/france/transcode-tcforge/wiki/Home | |
12 | COMMENT= Command line video-stream processing tool | 12 | COMMENT= Command line video-stream processing tool | |
13 | LICENSE= gnu-gpl-v2 | 13 | LICENSE= gnu-gpl-v2 | |
14 | 14 | |||
15 | USE_LANGUAGES= c c++ | 15 | USE_LANGUAGES= c c++ | |
16 | USE_LIBTOOL= yes | 16 | USE_LIBTOOL= yes | |
17 | USE_TOOLS+= awk:run gmake pkg-config | 17 | USE_TOOLS+= awk:run gmake pkg-config | |
@@ -45,27 +45,27 @@ LIBS+= ${LIBOSSAUDIO} | @@ -45,27 +45,27 @@ LIBS+= ${LIBOSSAUDIO} | |||
45 | .endif | 45 | .endif | |
46 | 46 | |||
47 | .include "options.mk" | 47 | .include "options.mk" | |
48 | 48 | |||
49 | .include "../../audio/lame/buildlink3.mk" | 49 | .include "../../audio/lame/buildlink3.mk" | |
50 | .include "../../audio/libvorbis/buildlink3.mk" | 50 | .include "../../audio/libvorbis/buildlink3.mk" | |
51 | .include "../../converters/libiconv/buildlink3.mk" | 51 | .include "../../converters/libiconv/buildlink3.mk" | |
52 | .include "../../devel/glib2/buildlink3.mk" | 52 | .include "../../devel/glib2/buildlink3.mk" | |
53 | .include "../../devel/pcre/buildlink3.mk" | 53 | .include "../../devel/pcre/buildlink3.mk" | |
54 | .include "../../devel/zlib/buildlink3.mk" | 54 | .include "../../devel/zlib/buildlink3.mk" | |
55 | .include "../../graphics/freetype2/buildlink3.mk" | 55 | .include "../../graphics/freetype2/buildlink3.mk" | |
56 | .include "../../graphics/liblqr/buildlink3.mk" | 56 | .include "../../graphics/liblqr/buildlink3.mk" | |
57 | .include "../../graphics/png/buildlink3.mk" | 57 | .include "../../graphics/png/buildlink3.mk" | |
58 | .include "../../multimedia/ffmpeg2/buildlink3.mk" | 58 | .include "../../multimedia/ffmpeg4/buildlink3.mk" | |
59 | .include "../../multimedia/libdvdread/buildlink3.mk" | 59 | .include "../../multimedia/libdvdread/buildlink3.mk" | |
60 | .include "../../multimedia/libmpeg2/buildlink3.mk" | 60 | .include "../../multimedia/libmpeg2/buildlink3.mk" | |
61 | .include "../../multimedia/libogg/buildlink3.mk" | 61 | .include "../../multimedia/libogg/buildlink3.mk" | |
62 | .include "../../multimedia/libtheora/buildlink3.mk" | 62 | .include "../../multimedia/libtheora/buildlink3.mk" | |
63 | .include "../../multimedia/xvidcore/buildlink3.mk" | 63 | .include "../../multimedia/xvidcore/buildlink3.mk" | |
64 | .if ${OPSYS} != "Darwin" | 64 | .if ${OPSYS} != "Darwin" | |
65 | .include "../../x11/libXaw/buildlink3.mk" | 65 | .include "../../x11/libXaw/buildlink3.mk" | |
66 | .include "../../x11/libXext/buildlink3.mk" | 66 | .include "../../x11/libXext/buildlink3.mk" | |
67 | .include "../../x11/libXpm/buildlink3.mk" | 67 | .include "../../x11/libXpm/buildlink3.mk" | |
68 | .include "../../x11/libXv/buildlink3.mk" | 68 | .include "../../x11/libXv/buildlink3.mk" | |
69 | .include "../../mk/oss.buildlink3.mk" | 69 | .include "../../mk/oss.buildlink3.mk" | |
70 | .endif | 70 | .endif | |
71 | .include "../../mk/jpeg.buildlink3.mk" | 71 | .include "../../mk/jpeg.buildlink3.mk" |
@@ -1,27 +1,28 @@ | @@ -1,27 +1,28 @@ | |||
1 | $NetBSD: distinfo,v 1.26 2016/05/16 19:41:17 adam Exp $ | 1 | $NetBSD: distinfo,v 1.27 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | SHA1 (transcode-1.1.7.tar.bz2) = e35df68b960eb56ef0a59a4cdbed1491be56aee6 | 3 | SHA1 (transcode-1.1.7.tar.bz2) = e35df68b960eb56ef0a59a4cdbed1491be56aee6 | |
4 | RMD160 (transcode-1.1.7.tar.bz2) = faa854acbbfd52faaa216505176f94d756d77841 | 4 | RMD160 (transcode-1.1.7.tar.bz2) = faa854acbbfd52faaa216505176f94d756d77841 | |
5 | SHA512 (transcode-1.1.7.tar.bz2) = d6f9674f3f5c3346194120585741ca660eb9ee133085cfce9460a14eaa0cf16fdf291761bd1db78e1c784e4d69a9481c7470cf8357dc7638ee3017620500f45f | 5 | SHA512 (transcode-1.1.7.tar.bz2) = d6f9674f3f5c3346194120585741ca660eb9ee133085cfce9460a14eaa0cf16fdf291761bd1db78e1c784e4d69a9481c7470cf8357dc7638ee3017620500f45f | |
6 | Size (transcode-1.1.7.tar.bz2) = 2183627 bytes | 6 | Size (transcode-1.1.7.tar.bz2) = 2183627 bytes | |
7 | SHA1 (patch-avilib_avidump.c) = 640aac6fc274a685b1847b48870b37b2c2ab1e88 | 7 | SHA1 (patch-avilib_avidump.c) = 640aac6fc274a685b1847b48870b37b2c2ab1e88 | |
8 | SHA1 (patch-configure) = 38418cd91750f55828124b5895d42d3af5c2d56a | 8 | SHA1 (patch-configure) = 38418cd91750f55828124b5895d42d3af5c2d56a | |
9 | SHA1 (patch-encode_encode_lavc.c) = c33f40dab212b601e5d808d972d132db4eee2d2e | 9 | SHA1 (patch-encode_encode_lavc.c) = 5ce01220933d58ab09a58c37146da290a3d91164 | |
10 | SHA1 (patch-export_aud__aux.c) = 84b774d13e363721db692b1edc53589e165b094e | 10 | SHA1 (patch-export_aud__aux.c) = 437ffde84123eccfe496c478a9db0066208fe256 | |
11 | SHA1 (patch-export_export__im.c) = 3a4f08d548cdebdfa618aeff2df398bd61002120 | 11 | SHA1 (patch-export_export__im.c) = 3a4f08d548cdebdfa618aeff2df398bd61002120 | |
12 | SHA1 (patch-export_export_ffmpeg.c) = 4367d16ba83ccc5c868f0dc470dcd0b64770b185 | 12 | SHA1 (patch-export_export_ffmpeg.c) = 2cc6100ab5e837b8d3fe66ec55c88962e6fbfb26 | |
13 | SHA1 (patch-export_ffmpeg_cfg.c) = 216f7970f3885a3f7fc8c229e4d1950cd6430cff | 13 | SHA1 (patch-export_ffmpeg_cfg.c) = d1678b2b6bdd2a9353d1fb34d72c2cc2d1aa1fa4 | |
14 | SHA1 (patch-export_ffmpeg_cfg.h) = 7cf230de948de004cc0500f0ae2511561081e952 | 14 | SHA1 (patch-export_ffmpeg_cfg.h) = 7cf230de948de004cc0500f0ae2511561081e952 | |
15 | SHA1 (patch-filter_filter__compare.c) = b866aa3f36607bee87aad4eb7023b0e5087b1c25 | 15 | SHA1 (patch-filter_filter__compare.c) = b866aa3f36607bee87aad4eb7023b0e5087b1c25 | |
16 | SHA1 (patch-filter_filter__logo.c) = 4cff9a4123797d3a25df17b22f3922260ed3a7d4 | 16 | SHA1 (patch-filter_filter__logo.c) = 4cff9a4123797d3a25df17b22f3922260ed3a7d4 | |
17 | SHA1 (patch-filter_filter__logoaway.c) = 252986a1e3ce9969e97bfeedd63bec6e3cf6273c | 17 | SHA1 (patch-filter_filter__logoaway.c) = 252986a1e3ce9969e97bfeedd63bec6e3cf6273c | |
18 | SHA1 (patch-filter_filter__pp.c) = a7a3f9c49e65e87bed343dd2d045457341e42114 | 18 | SHA1 (patch-filter_filter__pp.c) = a7a3f9c49e65e87bed343dd2d045457341e42114 | |
19 | SHA1 (patch-filter_filter__resample.c) = 9e8176070682984b4f7f0cc29d21437ff5ba4710 | |||
19 | SHA1 (patch-filter_subtitler_load_font.c) = 2c496c63f4fe27190761d170cc825633eb63c11f | 20 | SHA1 (patch-filter_subtitler_load_font.c) = 2c496c63f4fe27190761d170cc825633eb63c11f | |
20 | SHA1 (patch-import_decode_lavc.c) = adf9274c5085012adcfeeb2f2366600155f0994c | 21 | SHA1 (patch-import_decode_lavc.c) = 37c172b40858028592ced6a35f19fdd2873a07c6 | |
21 | SHA1 (patch-import_import__im.c) = 30fdb4ce905c0bdd959964b1455f31823b681e9e | 22 | SHA1 (patch-import_import__im.c) = 30fdb4ce905c0bdd959964b1455f31823b681e9e | |
22 | SHA1 (patch-import_import__imlist.c) = 677ffc2c4ed48ab1e9f4f3f4a28f53b368ae7651 | 23 | SHA1 (patch-import_import__imlist.c) = 677ffc2c4ed48ab1e9f4f3f4a28f53b368ae7651 | |
23 | SHA1 (patch-import_import_ffmpeg.c) = bbbbdec6a1c20a9c02a1e2ef4cca10919eb2854c | 24 | SHA1 (patch-import_import_ffmpeg.c) = 601ff0f67727c7dc3bdad8c5c43a8b8b4baae5ea | |
24 | SHA1 (patch-import_nuv_import__nuv.c) = e4a57c29b97b23aed068c06a2ed29dd9e29a9919 | 25 | SHA1 (patch-import_nuv_import__nuv.c) = e4a57c29b97b23aed068c06a2ed29dd9e29a9919 | |
25 | SHA1 (patch-import_probe_ffmpeg.c) = 6bbf65b513e999ac770bafc6aa9b508bfdb5ae15 | 26 | SHA1 (patch-import_probe_ffmpeg.c) = eabbdbc2ffad5da51cb77547ac6a3f92c7bafcdb | |
26 | SHA1 (patch-import_probe_im.c) = 27bce069c78e5eee94c14d3f5f03cc14145f85ac | 27 | SHA1 (patch-import_probe_im.c) = 27bce069c78e5eee94c14d3f5f03cc14145f85ac | |
27 | SHA1 (patch-libtc_tcavcodec.h) = 6fcef1e338e53c974b295b1a10b2cb06e6fcfbd3 | 28 | SHA1 (patch-libtc_tcavcodec.h) = 6fcef1e338e53c974b295b1a10b2cb06e6fcfbd3 |
@@ -1,226 +1,515 @@ | @@ -1,226 +1,515 @@ | |||
1 | $NetBSD: patch-encode_encode_lavc.c,v 1.2 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-encode_encode_lavc.c,v 1.3 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- encode/encode_lavc.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- encode/encode_lavc.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ encode/encode_lavc.c | 6 | +++ encode/encode_lavc.c | |
7 | @@ -74,6 +74,9 @@ struct tclavcconfigdata_ { | 7 | @@ -74,6 +74,16 @@ struct tclavcconfigdata_ { | |
8 | int lmin; | 8 | int lmin; | |
9 | int lmax; | 9 | int lmax; | |
10 | int me_method; | 10 | int me_method; | |
11 | + int luma_elim_threshold; | 11 | + int luma_elim_threshold; | |
12 | + int chroma_elim_threshold; | 12 | + int chroma_elim_threshold; | |
13 | + int quantizer_noise_shaping; | 13 | + int quantizer_noise_shaping; | |
14 | + int inter_quant_bias; | |||
15 | + int intra_quant_bias; | |||
16 | + int scenechange_factor; | |||
17 | + int rc_strategy; | |||
18 | + float rc_initial_cplx; | |||
19 | + float rc_qsquish; | |||
20 | + float border_masking; | |||
14 | 21 | |||
15 | /* same as above for flags */ | 22 | /* same as above for flags */ | |
16 | struct { | 23 | struct { | |
17 | @@ -114,6 +117,7 @@ struct tclavcprivatedata_ { | 24 | @@ -114,6 +124,7 @@ struct tclavcprivatedata_ { | |
18 | 25 | |||
19 | AVFrame ff_venc_frame; | 26 | AVFrame ff_venc_frame; | |
20 | AVCodecContext ff_vcontext; | 27 | AVCodecContext ff_vcontext; | |
21 | + AVDictionary * ff_opts; | 28 | + AVDictionary * ff_opts; | |
22 | 29 | |||
23 | AVCodec *ff_vcodec; | 30 | AVCodec *ff_vcodec; | |
24 | 31 | |||
25 | @@ -164,6 +168,7 @@ static const TCCodecID tc_lavc_codecs_ou | 32 | @@ -164,6 +175,7 @@ static const TCCodecID tc_lavc_codecs_ou | |
26 | TC_CODEC_ERROR | 33 | TC_CODEC_ERROR | |
27 | }; | 34 | }; | |
28 | 35 | |||
29 | +#if LIBAVCODEC_VERSION_MAJOR < 55 | 36 | +#if LIBAVCODEC_VERSION_MAJOR < 55 | |
30 | static const enum CodecID tc_lavc_internal_codecs[] = { | 37 | static const enum CodecID tc_lavc_internal_codecs[] = { | |
31 | CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, CODEC_ID_MPEG4, | 38 | CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, CODEC_ID_MPEG4, | |
32 | CODEC_ID_H263I, CODEC_ID_H263P, | 39 | CODEC_ID_H263I, CODEC_ID_H263P, | |
33 | @@ -176,6 +181,20 @@ static const enum CodecID tc_lavc_intern | 40 | @@ -176,6 +188,20 @@ static const enum CodecID tc_lavc_intern | |
34 | CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, | 41 | CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, | |
35 | CODEC_ID_NONE | 42 | CODEC_ID_NONE | |
36 | }; | 43 | }; | |
37 | +#else | 44 | +#else | |
38 | +static const enum AVCodecID tc_lavc_internal_codecs[] = { | 45 | +static const enum AVCodecID tc_lavc_internal_codecs[] = { | |
39 | + AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_MPEG4, | 46 | + AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_MPEG4, | |
40 | + AV_CODEC_ID_H263I, AV_CODEC_ID_H263P, | 47 | + AV_CODEC_ID_H263I, AV_CODEC_ID_H263P, | |
41 | + AV_CODEC_ID_H264, | 48 | + AV_CODEC_ID_H264, | |
42 | + AV_CODEC_ID_WMV1, AV_CODEC_ID_WMV2, | 49 | + AV_CODEC_ID_WMV1, AV_CODEC_ID_WMV2, | |
43 | + AV_CODEC_ID_RV10, | 50 | + AV_CODEC_ID_RV10, | |
44 | + AV_CODEC_ID_HUFFYUV, AV_CODEC_ID_FFV1, | 51 | + AV_CODEC_ID_HUFFYUV, AV_CODEC_ID_FFV1, | |
45 | + AV_CODEC_ID_DVVIDEO, | 52 | + AV_CODEC_ID_DVVIDEO, | |
46 | + AV_CODEC_ID_MJPEG, AV_CODEC_ID_LJPEG, | 53 | + AV_CODEC_ID_MJPEG, AV_CODEC_ID_LJPEG, | |
47 | + AV_CODEC_ID_MSMPEG4V2, AV_CODEC_ID_MSMPEG4V3, | 54 | + AV_CODEC_ID_MSMPEG4V2, AV_CODEC_ID_MSMPEG4V3, | |
48 | + AV_CODEC_ID_NONE | 55 | + AV_CODEC_ID_NONE | |
49 | +}; | 56 | +}; | |
50 | +#endif | 57 | +#endif | |
51 | 58 | |||
52 | static const TCFormatID tc_lavc_formats[] = { TC_FORMAT_ERROR }; | 59 | static const TCFormatID tc_lavc_formats[] = { TC_FORMAT_ERROR }; | |
53 | 60 | |||
54 | @@ -937,7 +956,11 @@ static int tc_lavc_settings_from_vob(TCL | 61 | @@ -214,7 +240,7 @@ static void pre_encode_video_yuv420p(TCL | |
62 | vframe_list_t *vframe) | |||
63 | { | |||
64 | avpicture_fill((AVPicture *)&pd->ff_venc_frame, vframe->video_buf, | |||
65 | - PIX_FMT_YUV420P, | |||
66 | + AV_PIX_FMT_YUV420P, | |||
67 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
68 | } | |||
69 | ||||
70 | @@ -228,7 +254,7 @@ static void pre_encode_video_yuv420p_huf | |||
71 | IMG_YUV_DEFAULT, | |||
72 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
73 | avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf, | |||
74 | - PIX_FMT_YUV422P, | |||
75 | + AV_PIX_FMT_YUV422P, | |||
76 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
77 | ac_imgconvert(src, IMG_YUV_DEFAULT, | |||
78 | pd->ff_venc_frame.data, IMG_YUV422P, | |||
79 | @@ -244,7 +270,7 @@ static void pre_encode_video_yuv422p(TCL | |||
80 | IMG_YUV422P, | |||
81 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
82 | avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf, | |||
83 | - PIX_FMT_YUV420P, | |||
84 | + AV_PIX_FMT_YUV420P, | |||
85 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
86 | ac_imgconvert(src, IMG_YUV422P, | |||
87 | pd->ff_venc_frame.data, IMG_YUV420P, | |||
88 | @@ -256,7 +282,7 @@ static void pre_encode_video_yuv422p_huf | |||
89 | vframe_list_t *vframe) | |||
90 | { | |||
91 | avpicture_fill((AVPicture *)&pd->ff_venc_frame, vframe->video_buf, | |||
92 | - PIX_FMT_YUV422P, | |||
93 | + AV_PIX_FMT_YUV422P, | |||
94 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
95 | ||||
96 | } | |||
97 | @@ -266,7 +292,7 @@ static void pre_encode_video_rgb24(TCLav | |||
98 | vframe_list_t *vframe) | |||
99 | { | |||
100 | avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf, | |||
101 | - PIX_FMT_YUV420P, | |||
102 | + AV_PIX_FMT_YUV420P, | |||
103 | pd->ff_vcontext.width, pd->ff_vcontext.height); | |||
104 | ac_imgconvert(&vframe->video_buf, IMG_RGB_DEFAULT, | |||
105 | pd->ff_venc_frame.data, IMG_YUV420P, | |||
106 | @@ -591,21 +617,21 @@ static int tc_lavc_set_pix_fmt(TCLavcPri | |||
107 | case CODEC_YUV: | |||
108 | if (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV) { | |||
109 | pd->tc_pix_fmt = TC_CODEC_YUV422P; | |||
110 | - pd->ff_vcontext.pix_fmt = PIX_FMT_YUV422P; | |||
111 | + pd->ff_vcontext.pix_fmt = AV_PIX_FMT_YUV422P; | |||
112 | pd->pre_encode_video = pre_encode_video_yuv420p_huffyuv; | |||
113 | } else { | |||
114 | pd->tc_pix_fmt = TC_CODEC_YUV420P; | |||
115 | pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) | |||
116 | - ? PIX_FMT_YUVJ420P | |||
117 | - : PIX_FMT_YUV420P; | |||
118 | + ? AV_PIX_FMT_YUVJ420P | |||
119 | + : AV_PIX_FMT_YUV420P; | |||
120 | pd->pre_encode_video = pre_encode_video_yuv420p; | |||
121 | } | |||
122 | break; | |||
123 | case CODEC_YUV422: | |||
124 | pd->tc_pix_fmt = TC_CODEC_YUV422P; | |||
125 | pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) | |||
126 | - ? PIX_FMT_YUVJ422P | |||
127 | - : PIX_FMT_YUV422P; | |||
128 | + ? AV_PIX_FMT_YUVJ422P | |||
129 | + : AV_PIX_FMT_YUV422P; | |||
130 | if (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV) { | |||
131 | pd->pre_encode_video = pre_encode_video_yuv422p_huffyuv; | |||
132 | } else { | |||
133 | @@ -615,10 +641,10 @@ static int tc_lavc_set_pix_fmt(TCLavcPri | |||
134 | case CODEC_RGB: | |||
135 | pd->tc_pix_fmt = TC_CODEC_RGB; | |||
136 | pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV) | |||
137 | - ? PIX_FMT_YUV422P | |||
138 | + ? AV_PIX_FMT_YUV422P | |||
139 | : (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) | |||
140 | - ? PIX_FMT_YUVJ420P | |||
141 | - : PIX_FMT_YUV420P; | |||
142 | + ? AV_PIX_FMT_YUVJ420P | |||
143 | + : AV_PIX_FMT_YUV420P; | |||
144 | pd->pre_encode_video = pre_encode_video_rgb24; | |||
145 | break; | |||
146 | default: | |||
147 | @@ -665,7 +691,7 @@ static int tc_lavc_init_multipass(TCLavc | |||
148 | switch (vob->divxmultipass) { | |||
149 | case 1: | |||
150 | CAN_DO_MULTIPASS(multipass_flag); | |||
151 | - pd->ff_vcontext.flags |= CODEC_FLAG_PASS1; | |||
152 | + pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS1; | |||
153 | pd->stats_file = fopen(vob->divxlogfile, "w"); | |||
154 | if (pd->stats_file == NULL) { | |||
155 | tc_log_error(MOD_NAME, "could not create 2pass log file" | |||
156 | @@ -675,7 +701,7 @@ static int tc_lavc_init_multipass(TCLavc | |||
157 | break; | |||
158 | case 2: | |||
159 | CAN_DO_MULTIPASS(multipass_flag); | |||
160 | - pd->ff_vcontext.flags |= CODEC_FLAG_PASS2; | |||
161 | + pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS2; | |||
162 | pd->stats_file = fopen(vob->divxlogfile, "r"); | |||
163 | if (pd->stats_file == NULL){ | |||
164 | tc_log_error(MOD_NAME, "could not open 2pass log file \"%s\"" | |||
165 | @@ -704,7 +730,7 @@ static int tc_lavc_init_multipass(TCLavc | |||
166 | break; | |||
167 | case 3: | |||
168 | /* fixed qscale :p */ | |||
169 | - pd->ff_vcontext.flags |= CODEC_FLAG_QSCALE; | |||
170 | + pd->ff_vcontext.flags |= AV_CODEC_FLAG_QSCALE; | |||
171 | pd->ff_venc_frame.quality = vob->divxbitrate; | |||
172 | break; | |||
173 | } | |||
174 | @@ -937,7 +963,11 @@ static int tc_lavc_settings_from_vob(TCL | |||
55 | static void tc_lavc_config_defaults(TCLavcPrivateData *pd) | 175 | static void tc_lavc_config_defaults(TCLavcPrivateData *pd) | |
56 | { | 176 | { | |
57 | /* first of all reinitialize lavc data */ | 177 | /* first of all reinitialize lavc data */ | |
58 | +#if LIBAVCODEC_VERSION_MAJOR < 55 | 178 | +#if LIBAVCODEC_VERSION_MAJOR < 55 | |
59 | avcodec_get_context_defaults(&pd->ff_vcontext); | 179 | avcodec_get_context_defaults(&pd->ff_vcontext); | |
60 | +#else | 180 | +#else | |
61 | + avcodec_get_context_defaults3(&pd->ff_vcontext, NULL); | 181 | + avcodec_get_context_defaults3(&pd->ff_vcontext, NULL); | |
62 | +#endif | 182 | +#endif | |
63 | 183 | |||
64 | pd->confdata.thread_count = 1; | 184 | pd->confdata.thread_count = 1; | |
65 | 185 | |||
66 | @@ -955,8 +978,6 @@ static void tc_lavc_config_defaults(TCLa | 186 | @@ -947,7 +977,7 @@ static void tc_lavc_config_defaults(TCLa | |
187 | pd->confdata.rc_buffer_size = 0; | |||
188 | pd->confdata.lmin = 2; | |||
189 | pd->confdata.lmax = 31; | |||
190 | - pd->confdata.me_method = ME_EPZS; | |||
191 | + pd->confdata.me_method = 0; | |||
192 | ||||
193 | memset(&pd->confdata.flags, 0, sizeof(pd->confdata.flags)); | |||
194 | pd->confdata.turbo_setup = 0; | |||
195 | @@ -955,19 +985,17 @@ static void tc_lavc_config_defaults(TCLa | |||
67 | /* | 196 | /* | |
68 | * context *transcode* (not libavcodec) defaults | 197 | * context *transcode* (not libavcodec) defaults | |
69 | */ | 198 | */ | |
70 | - pd->ff_vcontext.mb_qmin = 2; | 199 | - pd->ff_vcontext.mb_qmin = 2; | |
71 | - pd->ff_vcontext.mb_qmax = 31; | 200 | - pd->ff_vcontext.mb_qmax = 31; | |
72 | pd->ff_vcontext.max_qdiff = 3; | 201 | pd->ff_vcontext.max_qdiff = 3; | |
73 | pd->ff_vcontext.max_b_frames = 0; | 202 | pd->ff_vcontext.max_b_frames = 0; | |
74 | pd->ff_vcontext.me_range = 0; | 203 | pd->ff_vcontext.me_range = 0; | |
75 | @@ -977,8 +998,8 @@ static void tc_lavc_config_defaults(TCLa | 204 | pd->ff_vcontext.mb_decision = 0; | |
205 | pd->ff_vcontext.scenechange_threshold = 0; | |||
206 | - pd->ff_vcontext.scenechange_factor = 1; | |||
207 | + pd->confdata.scenechange_factor = 1; | |||
208 | pd->ff_vcontext.b_frame_strategy = 0; | |||
209 | pd->ff_vcontext.b_sensitivity = 40; | |||
210 | pd->ff_vcontext.brd_scale = 0; | |||
211 | pd->ff_vcontext.bidir_refine = 0; | |||
212 | - pd->ff_vcontext.rc_strategy = 2; | |||
213 | + pd->confdata.rc_strategy = 2; | |||
214 | pd->ff_vcontext.b_quant_factor = 1.25; | |||
215 | pd->ff_vcontext.i_quant_factor = 0.8; | |||
216 | pd->ff_vcontext.b_quant_offset = 1.25; | |||
217 | @@ -975,10 +1003,10 @@ static void tc_lavc_config_defaults(TCLa | |||
218 | pd->ff_vcontext.qblur = 0.5; | |||
219 | pd->ff_vcontext.qcompress = 0.5; | |||
76 | pd->ff_vcontext.mpeg_quant = 0; | 220 | pd->ff_vcontext.mpeg_quant = 0; | |
77 | pd->ff_vcontext.rc_initial_cplx = 0.0; | 221 | - pd->ff_vcontext.rc_initial_cplx = 0.0; | |
78 | pd->ff_vcontext.rc_qsquish = 1.0; | 222 | - pd->ff_vcontext.rc_qsquish = 1.0; | |
79 | - pd->ff_vcontext.luma_elim_threshold = 0; | 223 | - pd->ff_vcontext.luma_elim_threshold = 0; | |
80 | - pd->ff_vcontext.chroma_elim_threshold = 0; | 224 | - pd->ff_vcontext.chroma_elim_threshold = 0; | |
225 | + pd->confdata.rc_initial_cplx = 0.0; | |||
226 | + pd->confdata.rc_qsquish = 1.0; | |||
81 | + pd->confdata.luma_elim_threshold = 0; | 227 | + pd->confdata.luma_elim_threshold = 0; | |
82 | + pd->confdata.chroma_elim_threshold = 0; | 228 | + pd->confdata.chroma_elim_threshold = 0; | |
83 | pd->ff_vcontext.strict_std_compliance = 0; | 229 | pd->ff_vcontext.strict_std_compliance = 0; | |
84 | pd->ff_vcontext.dct_algo = FF_DCT_AUTO; | 230 | pd->ff_vcontext.dct_algo = FF_DCT_AUTO; | |
85 | pd->ff_vcontext.idct_algo = FF_IDCT_AUTO; | 231 | pd->ff_vcontext.idct_algo = FF_IDCT_AUTO; | |
86 | @@ -1002,7 +1023,7 @@ static void tc_lavc_config_defaults(TCLa | 232 | @@ -987,7 +1015,7 @@ static void tc_lavc_config_defaults(TCLa | |
87 | pd->ff_vcontext.intra_quant_bias = FF_DEFAULT_QUANT_BIAS; | 233 | pd->ff_vcontext.temporal_cplx_masking = 0.0; | |
88 | pd->ff_vcontext.inter_quant_bias = FF_DEFAULT_QUANT_BIAS; | 234 | pd->ff_vcontext.spatial_cplx_masking = 0.0; | |
235 | pd->ff_vcontext.p_masking = 0.0; | |||
236 | - pd->ff_vcontext.border_masking = 0.0; | |||
237 | + pd->confdata.border_masking = 0.0; | |||
238 | pd->ff_vcontext.me_pre_cmp = 0; | |||
239 | pd->ff_vcontext.me_cmp = 0; | |||
240 | pd->ff_vcontext.me_sub_cmp = 0; | |||
241 | @@ -999,10 +1027,8 @@ static void tc_lavc_config_defaults(TCLa | |||
242 | pd->ff_vcontext.pre_me = 1; | |||
243 | pd->ff_vcontext.me_subpel_quality = 8; | |||
244 | pd->ff_vcontext.refs = 1; | |||
245 | - pd->ff_vcontext.intra_quant_bias = FF_DEFAULT_QUANT_BIAS; | |||
246 | - pd->ff_vcontext.inter_quant_bias = FF_DEFAULT_QUANT_BIAS; | |||
89 | pd->ff_vcontext.noise_reduction = 0; | 247 | pd->ff_vcontext.noise_reduction = 0; | |
90 | - pd->ff_vcontext.quantizer_noise_shaping = 0; | 248 | - pd->ff_vcontext.quantizer_noise_shaping = 0; | |
91 | + pd->confdata.quantizer_noise_shaping = 0; | 249 | + pd->confdata.quantizer_noise_shaping = 0; | |
92 | pd->ff_vcontext.flags = 0; | 250 | pd->ff_vcontext.flags = 0; | |
93 | } | 251 | } | |
94 | 252 | |||
95 | @@ -1034,16 +1055,11 @@ static void tc_lavc_dispatch_settings(TC | 253 | @@ -1023,27 +1049,22 @@ static void tc_lavc_config_defaults(TCLa | |
254 | */ | |||
255 | static void tc_lavc_dispatch_settings(TCLavcPrivateData *pd) | |||
256 | { | |||
257 | + char buf[1024]; | |||
258 | /* some translation... */ | |||
259 | pd->ff_vcontext.bit_rate_tolerance = pd->confdata.vrate_tolerance * 1000; | |||
260 | pd->ff_vcontext.rc_min_rate = pd->confdata.rc_min_rate * 1000; | |||
261 | pd->ff_vcontext.rc_max_rate = pd->confdata.rc_max_rate * 1000; | |||
262 | pd->ff_vcontext.rc_buffer_size = pd->confdata.rc_buffer_size * 1024; | |||
263 | - pd->ff_vcontext.lmin = (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5); | |||
264 | - pd->ff_vcontext.lmax = (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5); | |||
265 | - pd->ff_vcontext.me_method = ME_ZERO + pd->confdata.me_method; | |||
266 | + snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5)); | |||
267 | + av_dict_set(&(pd->ff_opts), "lmin", buf, 0); | |||
268 | + snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5)); | |||
269 | + av_dict_set(&(pd->ff_opts), "lmax", buf, 0); | |||
96 | 270 | |||
97 | pd->ff_vcontext.flags = 0; | 271 | pd->ff_vcontext.flags = 0; | |
98 | SET_FLAG(pd, mv0); | 272 | - SET_FLAG(pd, mv0); | |
99 | - SET_FLAG(pd, cbp); | 273 | - SET_FLAG(pd, cbp); | |
100 | SET_FLAG(pd, qpel); | 274 | SET_FLAG(pd, qpel); | |
101 | - SET_FLAG(pd, alt); | 275 | - SET_FLAG(pd, alt); | |
102 | - SET_FLAG(pd, vdpart); | 276 | - SET_FLAG(pd, vdpart); | |
103 | SET_FLAG(pd, naq); | 277 | - SET_FLAG(pd, naq); | |
104 | SET_FLAG(pd, ilme); | 278 | SET_FLAG(pd, ilme); | |
105 | SET_FLAG(pd, ildct); | 279 | SET_FLAG(pd, ildct); | |
106 | SET_FLAG(pd, aic); | 280 | SET_FLAG(pd, aic); | |
107 | - SET_FLAG(pd, aiv); | 281 | - SET_FLAG(pd, aiv); | |
108 | - SET_FLAG(pd, umv); | 282 | - SET_FLAG(pd, umv); | |
109 | SET_FLAG(pd, psnr); | 283 | SET_FLAG(pd, psnr); | |
110 | SET_FLAG(pd, trell); | 284 | SET_FLAG(pd, trell); | |
111 | SET_FLAG(pd, gray); | 285 | SET_FLAG(pd, gray); | |
112 | @@ -1064,6 +1080,30 @@ static void tc_lavc_dispatch_settings(TC | 286 | @@ -1061,9 +1082,49 @@ static void tc_lavc_dispatch_settings(TC | |
113 | pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT; | 287 | } | |
114 | pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME; | 288 | if (pd->interlacing.active) { | |
289 | /* enforce interlacing */ | |||
290 | - pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT; | |||
291 | - pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME; | |||
292 | + pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_DCT; | |||
293 | + pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_ME; | |||
115 | } | 294 | } | |
116 | + if (pd->confdata.flags.alt) { | 295 | + if (pd->confdata.flags.alt) { | |
117 | + av_dict_set(&(pd->ff_opts), "alternate_scan", "1", 0); | 296 | + av_dict_set(&(pd->ff_opts), "alternate_scan", "1", 0); | |
118 | + } | 297 | + } | |
119 | + if (pd->confdata.flags.vdpart) { | 298 | + if (pd->confdata.flags.vdpart) { | |
120 | + av_dict_set(&(pd->ff_opts), "data_partitioning", "1", 0); | 299 | + av_dict_set(&(pd->ff_opts), "data_partitioning", "1", 0); | |
121 | + } | 300 | + } | |
122 | + if (pd->confdata.flags.umv) { | 301 | + if (pd->confdata.flags.umv) { | |
123 | + av_dict_set(&(pd->ff_opts), "umv", "1", 0); | 302 | + av_dict_set(&(pd->ff_opts), "umv", "1", 0); | |
124 | + } | 303 | + } | |
125 | + if (pd->confdata.flags.aiv) { | 304 | + if (pd->confdata.flags.aiv) { | |
126 | + av_dict_set(&(pd->ff_opts), "aiv", "1", 0); | 305 | + av_dict_set(&(pd->ff_opts), "aiv", "1", 0); | |
127 | + } | 306 | + } | |
128 | + if (pd->confdata.flags.cbp) { | 307 | + if (pd->confdata.flags.cbp) { | |
129 | + av_dict_set(&(pd->ff_opts), "mpv_flags", "+cbp_rd", 0); | 308 | + av_dict_set(&(pd->ff_opts), "mpv_flags", "+cbp_rd", 0); | |
130 | + } | 309 | + } | |
310 | + if (pd->confdata.flags.mv0) { | |||
311 | + av_dict_set(&(pd->ff_opts), "mpv_flags", "+mv0", 0); | |||
312 | + } | |||
313 | + if (pd->confdata.flags.naq) { | |||
314 | + av_dict_set(&(pd->ff_opts), "mpv_flags", "+naq", 0); | |||
315 | + } | |||
131 | + | 316 | + | |
132 | + char buf[1024]; | |||
133 | +#define set_dict_opt(val, opt) \ | 317 | +#define set_dict_opt(val, opt) \ | |
134 | + snprintf(buf, sizeof(buf), "%i", pd->confdata.val);\ | 318 | + snprintf(buf, sizeof(buf), "%i", pd->confdata.val);\ | |
135 | + av_dict_set(&(pd->ff_opts), opt, buf, 0) | 319 | + av_dict_set(&(pd->ff_opts), opt, buf, 0) | |
320 | +#define set_dict_float_opt(val, opt) \ | |||
321 | + snprintf(buf, sizeof(buf), "%f", pd->confdata.val);\ | |||
322 | + av_dict_set(&(pd->ff_opts), opt, buf, 0) | |||
136 | + | 323 | + | |
137 | + set_dict_opt(luma_elim_threshold, "luma_elim_threshold"); | 324 | + set_dict_opt(luma_elim_threshold, "luma_elim_threshold"); | |
138 | + set_dict_opt(chroma_elim_threshold, "chroma_elim_threshold"); | 325 | + set_dict_opt(chroma_elim_threshold, "chroma_elim_threshold"); | |
139 | + set_dict_opt(quantizer_noise_shaping, "quantizer_noise_shaping"); | 326 | + set_dict_opt(quantizer_noise_shaping, "quantizer_noise_shaping"); | |
327 | + set_dict_opt(inter_quant_bias, "pbias"); | |||
328 | + set_dict_opt(intra_quant_bias, "ibias"); | |||
329 | + set_dict_opt(me_method, "me_method"); | |||
330 | + set_dict_opt(scenechange_factor, "sc_factor"); | |||
331 | + set_dict_opt(rc_strategy, "rc_strategy"); | |||
332 | + set_dict_float_opt(rc_initial_cplx, "rc_init_cplx"); | |||
333 | + set_dict_float_opt(rc_qsquish, "qsquish"); | |||
334 | + set_dict_float_opt(border_masking, "border_mask"); | |||
140 | } | 335 | } | |
141 | 336 | |||
142 | #undef SET_FLAG | 337 | #undef SET_FLAG | |
143 | @@ -1116,8 +1156,6 @@ static int tc_lavc_read_config(TCLavcPri | 338 | @@ -1116,17 +1177,15 @@ static int tc_lavc_read_config(TCLavcPri | |
144 | // handled by transcode core | 339 | // handled by transcode core | |
145 | // { "vqmax", PCTX(qmax), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | 340 | // { "vqmax", PCTX(qmax), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | |
146 | // handled by transcode core | 341 | // handled by transcode core | |
147 | - { "mbqmin", PCTX(mb_qmin), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | 342 | - { "mbqmin", PCTX(mb_qmin), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | |
148 | - { "mbqmax", PCTX(mb_qmax), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | 343 | - { "mbqmax", PCTX(mb_qmax), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 60 }, | |
149 | { "lmin", PAUX(lmin), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 }, | 344 | { "lmin", PAUX(lmin), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 }, | |
150 | { "lmax", PAUX(lmax), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 }, | 345 | { "lmax", PAUX(lmax), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 }, | |
151 | { "vqdiff", PCTX(max_qdiff), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31 }, | 346 | { "vqdiff", PCTX(max_qdiff), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31 }, | |
152 | @@ -1150,8 +1188,8 @@ static int tc_lavc_read_config(TCLavcPri | 347 | - { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES }, | |
153 | { "vrc_init_cplx", PCTX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 }, | 348 | + { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX }, | |
349 | { "vme", PAUX(me_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16, }, | |||
350 | { "me_range", PCTX(me_range), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000 }, | |||
351 | { "mbd", PCTX(mb_decision), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 }, | |||
352 | { "sc_threshold", PCTX(scenechange_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000 }, | |||
353 | - { "sc_factor", PCTX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 }, | |||
354 | + { "sc_factor", PAUX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 }, | |||
355 | { "vb_strategy", PCTX(b_frame_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 }, | |||
356 | { "b_sensitivity", PCTX(b_sensitivity), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 100 }, | |||
357 | { "brd_scale", PCTX(brd_scale), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 }, | |||
358 | @@ -1137,7 +1196,7 @@ static int tc_lavc_read_config(TCLavcPri | |||
359 | { "vrc_maxrate", PAUX(rc_max_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 }, | |||
360 | { "vrc_minrate", PAUX(rc_min_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 }, | |||
361 | { "vrc_buf_size", PAUX(rc_buffer_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000 }, | |||
362 | - { "vrc_strategy", PCTX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 }, | |||
363 | + { "vrc_strategy", PAUX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 }, | |||
364 | { "vb_qfactor", PCTX(b_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 }, | |||
365 | { "vi_qfactor", PCTX(i_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 }, | |||
366 | { "vb_qoffset", PCTX(b_quant_offset), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0 }, | |||
367 | @@ -1147,11 +1206,11 @@ static int tc_lavc_read_config(TCLavcPri | |||
368 | { "mpeg_quant", PCTX(mpeg_quant), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
369 | // { "vrc_eq", }, // not yet supported | |||
370 | { "vrc_override", rc_override_buf, TCCONF_TYPE_STRING, 0, 0, 0 }, | |||
371 | - { "vrc_init_cplx", PCTX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 }, | |||
372 | + { "vrc_init_cplx", PAUX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 }, | |||
154 | // { "vrc_init_occupancy", }, // not yet supported | 373 | // { "vrc_init_occupancy", }, // not yet supported | |
155 | { "vqsquish", PCTX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 }, | 374 | - { "vqsquish", PCTX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 }, | |
156 | - { "vlelim", PCTX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | 375 | - { "vlelim", PCTX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | |
157 | - { "vcelim", PCTX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | 376 | - { "vcelim", PCTX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | |
377 | + { "vqsquish", PAUX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 }, | |||
158 | + { "vlelim", PAUX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | 378 | + { "vlelim", PAUX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | |
159 | + { "vcelim", PAUX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | 379 | + { "vcelim", PAUX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | |
160 | { "vstrict", PCTX(strict_std_compliance), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | 380 | { "vstrict", PCTX(strict_std_compliance), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 }, | |
161 | { "vpsize", PCTX(rtp_payload_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000 }, | 381 | { "vpsize", PCTX(rtp_payload_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000 }, | |
162 | { "dct", PCTX(dct_algo), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 }, | 382 | { "dct", PCTX(dct_algo), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 }, | |
163 | @@ -1177,25 +1215,25 @@ static int tc_lavc_read_config(TCLavcPri | 383 | @@ -1161,7 +1220,7 @@ static int tc_lavc_read_config(TCLavcPri | |
164 | { "ibias", PCTX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | 384 | { "tcplx_mask", PCTX(temporal_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 }, | |
165 | { "pbias", PCTX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | 385 | { "scplx_mask", PCTX(spatial_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 }, | |
386 | { "p_mask", PCTX(p_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 }, | |||
387 | - { "border_mask", PCTX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 }, | |||
388 | + { "border_mask", PAUX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 }, | |||
389 | { "pred", PCTX(prediction_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 4 }, | |||
390 | { "precmp", PCTX(me_pre_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 }, | |||
391 | { "cmp", PCTX(me_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 }, | |||
392 | @@ -1174,37 +1233,37 @@ static int tc_lavc_read_config(TCLavcPri | |||
393 | { "pre_me", PCTX(pre_me), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000}, | |||
394 | { "subq", PCTX(me_subpel_quality), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8 }, | |||
395 | { "refs", PCTX(refs), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 8 }, | |||
396 | - { "ibias", PCTX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | |||
397 | - { "pbias", PCTX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | |||
398 | + { "ibias", PAUX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | |||
399 | + { "pbias", PAUX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 }, | |||
166 | { "nr", PCTX(noise_reduction), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000}, | 400 | { "nr", PCTX(noise_reduction), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000}, | |
167 | - { "qns", PCTX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 }, | 401 | - { "qns", PCTX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 }, | |
168 | + { "qns", PAUX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 }, | 402 | + { "qns", PAUX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 }, | |
169 | { "inter_matrix_file", inter_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 }, | 403 | { "inter_matrix_file", inter_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 }, | |
170 | { "intra_matrix_file", intra_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 }, | 404 | { "intra_matrix_file", intra_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 }, | |
171 | 405 | |||
172 | { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 }, | 406 | - { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 }, | |
173 | - { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD }, | 407 | - { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD }, | |
174 | + { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, 1 }, | 408 | - { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL }, | |
175 | { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL }, | |||
176 | - { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN }, | 409 | - { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN }, | |
177 | + { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 }, | 410 | - { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME }, | |
178 | { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME }, | 411 | - { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT }, | |
179 | { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT }, | 412 | - { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP }, | |
180 | { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP }, | |||
181 | - { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART }, | 413 | - { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART }, | |
414 | + { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
415 | + { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
416 | + { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL }, | |||
417 | + { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
418 | + { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME }, | |||
419 | + { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_DCT }, | |||
420 | + { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
182 | + { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 }, | 421 | + { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |
183 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 422 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
184 | { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC }, | 423 | { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC }, | |
185 | #else | 424 | #else | |
186 | { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED }, | 425 | - { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED }, | |
426 | + { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED }, | |||
187 | #endif | 427 | #endif | |
188 | - { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIV }, | 428 | - { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIV }, | |
189 | - { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV }, | 429 | - { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV }, | |
430 | - { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR }, | |||
190 | + { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 }, | 431 | + { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |
191 | + { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 }, | 432 | + { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |
192 | { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR }, | 433 | + { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR }, | |
193 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 434 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
194 | { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT }, | 435 | { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT }, | |
195 | @@ -1345,6 +1383,8 @@ static int tc_lavc_configure(TCModuleIns | 436 | #else | |
437 | { "trell", PCTX(trellis), TCCONF_TYPE_FLAG, 0, 0, 1 }, | |||
438 | #endif | |||
439 | - { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY }, | |||
440 | - { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV }, | |||
441 | - { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP }, | |||
442 | + { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY }, | |||
443 | + { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV }, | |||
444 | + { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP }, | |||
445 | ||||
446 | // { "turbo", PAUX(turbo_setup), TCCONF_TYPE_FLAG, 0, 0, 1 }, // not yet supported | |||
447 | /* End of the config file */ | |||
448 | @@ -1345,12 +1404,14 @@ static int tc_lavc_configure(TCModuleIns | |||
196 | 449 | |||
197 | pd = self->userdata; | 450 | pd = self->userdata; | |
198 | 451 | |||
199 | + pd->ff_opts = NULL; | 452 | + pd->ff_opts = NULL; | |
200 | + | 453 | + | |
201 | pd->flush_flag = vob->encoder_flush; | 454 | pd->flush_flag = vob->encoder_flush; | |
202 | 455 | |||
203 | /* FIXME: move into core? */ | 456 | /* FIXME: move into core? */ | |
204 | @@ -1387,7 +1427,7 @@ static int tc_lavc_configure(TCModuleIns | 457 | TC_INIT_LIBAVCODEC; | |
458 | ||||
459 | - avcodec_get_frame_defaults(&pd->ff_venc_frame); | |||
460 | + av_frame_unref(&pd->ff_venc_frame); | |||
461 | /* | |||
462 | * auxiliary config data needs to be blanked too | |||
463 | * before any other operation | |||
464 | @@ -1387,7 +1448,7 @@ static int tc_lavc_configure(TCModuleIns | |||
205 | pd->confdata.thread_count, | 465 | pd->confdata.thread_count, | |
206 | (pd->confdata.thread_count > 1) ?"s" :""); | 466 | (pd->confdata.thread_count > 1) ?"s" :""); | |
207 | } | 467 | } | |
208 | - avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count); | 468 | - avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count); | |
209 | + pd->ff_vcontext.thread_count = pd->confdata.thread_count; | 469 | + pd->ff_vcontext.thread_count = pd->confdata.thread_count; | |
210 | 470 | |||
211 | pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd)); | 471 | pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd)); | |
212 | if (pd->ff_vcodec == NULL) { | 472 | if (pd->ff_vcodec == NULL) { | |
213 | @@ -1397,11 +1437,11 @@ static int tc_lavc_configure(TCModuleIns | 473 | @@ -1397,11 +1458,11 @@ static int tc_lavc_configure(TCModuleIns | |
214 | } | 474 | } | |
215 | 475 | |||
216 | TC_LOCK_LIBAVCODEC; | 476 | TC_LOCK_LIBAVCODEC; | |
217 | - ret = avcodec_open(&pd->ff_vcontext, pd->ff_vcodec); | 477 | - ret = avcodec_open(&pd->ff_vcontext, pd->ff_vcodec); | |
218 | + ret = avcodec_open2(&pd->ff_vcontext, pd->ff_vcodec, &(pd->ff_opts)); | 478 | + ret = avcodec_open2(&pd->ff_vcontext, pd->ff_vcodec, &(pd->ff_opts)); | |
219 | TC_UNLOCK_LIBAVCODEC; | 479 | TC_UNLOCK_LIBAVCODEC; | |
220 | 480 | |||
221 | if (ret < 0) { | 481 | if (ret < 0) { | |
222 | - tc_log_error(MOD_NAME, "avcodec_open() failed"); | 482 | - tc_log_error(MOD_NAME, "avcodec_open() failed"); | |
223 | + tc_log_error(MOD_NAME, "avcodec_open2() failed"); | 483 | + tc_log_error(MOD_NAME, "avcodec_open2() failed"); | |
224 | goto failed; | 484 | goto failed; | |
225 | } | 485 | } | |
226 | /* finally, pass up the extradata, if any */ | 486 | /* finally, pass up the extradata, if any */ | |
487 | @@ -1483,6 +1544,8 @@ static int tc_lavc_encode_video(TCModule | |||
488 | vframe_list_t *outframe) | |||
489 | { | |||
490 | TCLavcPrivateData *pd = NULL; | |||
491 | + AVPacket pkt; | |||
492 | + int ret, got_packet = 0; | |||
493 | ||||
494 | TC_MODULE_SELF_CHECK(self, "encode_video"); | |||
495 | ||||
496 | @@ -1497,12 +1560,15 @@ static int tc_lavc_encode_video(TCModule | |||
497 | ||||
498 | pd->pre_encode_video(pd, inframe); | |||
499 | ||||
500 | + av_init_packet(&pkt); | |||
501 | + pkt.data = outframe->video_buf; | |||
502 | + pkt.size = inframe->video_size; | |||
503 | + | |||
504 | TC_LOCK_LIBAVCODEC; | |||
505 | - outframe->video_len = avcodec_encode_video(&pd->ff_vcontext, | |||
506 | - outframe->video_buf, | |||
507 | - inframe->video_size, | |||
508 | - &pd->ff_venc_frame); | |||
509 | + ret = avcodec_encode_video2(&pd->ff_vcontext, &pkt, | |||
510 | + &pd->ff_venc_frame, &got_packet); | |||
511 | TC_UNLOCK_LIBAVCODEC; | |||
512 | + outframe->video_len = ret ? ret : pkt.size; | |||
513 | ||||
514 | if (outframe->video_len < 0) { | |||
515 | tc_log_warn(MOD_NAME, "encoder error: size (%i)", |
@@ -1,137 +1,307 @@ | @@ -1,137 +1,307 @@ | |||
1 | $NetBSD: patch-export_export_ffmpeg.c,v 1.2 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-export_export_ffmpeg.c,v 1.3 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- export/export_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- export/export_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ export/export_ffmpeg.c | 6 | +++ export/export_ffmpeg.c | |
7 | @@ -122,6 +122,7 @@ static uint8_t *img_buffer = | 7 | @@ -122,6 +122,7 @@ static uint8_t *img_buffer = | |
8 | static AVFrame *lavc_convert_frame = NULL; | 8 | static AVFrame *lavc_convert_frame = NULL; | |
9 | 9 | |||
10 | static AVCodec *lavc_venc_codec = NULL; | 10 | static AVCodec *lavc_venc_codec = NULL; | |
11 | +static AVDictionary *lavc_venc_opts = NULL; | 11 | +static AVDictionary *lavc_venc_opts = NULL; | |
12 | static AVFrame *lavc_venc_frame = NULL; | 12 | static AVFrame *lavc_venc_frame = NULL; | |
13 | static AVCodecContext *lavc_venc_context; | 13 | static AVCodecContext *lavc_venc_context; | |
14 | static avi_t *avifile = NULL; | 14 | static avi_t *avifile = NULL; | |
15 | @@ -180,7 +181,7 @@ static char *tc_strchrnul(const char *s, | 15 | @@ -180,7 +181,7 @@ static char *tc_strchrnul(const char *s, | |
16 | 16 | |||
17 | 17 | |||
18 | /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */ | 18 | /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */ | |
19 | -#include <libavcodec/opt.h> | 19 | -#include <libavcodec/opt.h> | |
20 | +#include <libavutil/opt.h> | 20 | +#include <libavutil/opt.h> | |
21 | #include <libavutil/avstring.h> | 21 | #include <libavutil/avstring.h> | |
22 | #include <libswscale/swscale.h> | 22 | #include <libswscale/swscale.h> | |
23 | 23 | |||
24 | @@ -470,7 +471,6 @@ MOD_init | 24 | @@ -249,9 +250,9 @@ int opt_default(const char *opt, const c | |
25 | for(type=0; type<AVMEDIA_TYPE_NB && ret>= 0; type++){ | |||
26 | /* GLUE: +if */ | |||
27 | if (type == AVMEDIA_TYPE_VIDEO) { | |||
28 | - const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]); | |||
29 | - if(o2) | |||
30 | - ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o); | |||
31 | + o = av_opt_find(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]); | |||
32 | + if(o) | |||
33 | + ret = av_opt_set(avcodec_opts[type], opt, arg, 0); | |||
34 | /* GLUE: +if */ | |||
35 | } | |||
36 | } | |||
37 | @@ -266,7 +267,10 @@ int opt_default(const char *opt, const c | |||
38 | if(opt[0] == 'a') | |||
39 | ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o); | |||
40 | else */ if(opt[0] == 'v') | |||
41 | - ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o); | |||
42 | + { | |||
43 | + o = av_opt_find(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, NULL, 0, 0); | |||
44 | + ret = av_opt_set(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 0); | |||
45 | + } | |||
46 | /* GLUE: disabling | |||
47 | else if(opt[0] == 's') | |||
48 | ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o); | |||
49 | @@ -470,7 +474,6 @@ MOD_init | |||
25 | } | 50 | } | |
26 | 51 | |||
27 | TC_LOCK_LIBAVCODEC; | 52 | TC_LOCK_LIBAVCODEC; | |
28 | - avcodec_init(); | 53 | - avcodec_init(); | |
29 | avcodec_register_all(); | 54 | avcodec_register_all(); | |
30 | TC_UNLOCK_LIBAVCODEC; | 55 | TC_UNLOCK_LIBAVCODEC; | |
31 | 56 | |||
32 | @@ -486,7 +486,7 @@ MOD_init | 57 | @@ -486,11 +489,11 @@ MOD_init | |
33 | codec->name, codec->fourCC, codec->comments); | 58 | codec->name, codec->fourCC, codec->comments); | |
34 | } | 59 | } | |
35 | 60 | |||
36 | - lavc_venc_context = avcodec_alloc_context(); | 61 | - lavc_venc_context = avcodec_alloc_context(); | |
62 | - lavc_venc_frame = avcodec_alloc_frame(); | |||
37 | + lavc_venc_context = avcodec_alloc_context3(lavc_venc_codec); | 63 | + lavc_venc_context = avcodec_alloc_context3(lavc_venc_codec); | |
38 | lavc_venc_frame = avcodec_alloc_frame(); | 64 | + lavc_venc_frame = av_frame_alloc(); | |
65 | ||||
66 | - lavc_convert_frame= avcodec_alloc_frame(); | |||
67 | - size = avpicture_get_size(PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height); | |||
68 | + lavc_convert_frame= av_frame_alloc(); | |||
69 | + size = avpicture_get_size(AV_PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height); | |||
70 | enc_buffer = tc_malloc(size); | |||
39 | 71 | |||
40 | lavc_convert_frame= avcodec_alloc_frame(); | 72 | if (lavc_venc_context == NULL || !enc_buffer || !lavc_convert_frame) { | |
41 | @@ -634,7 +634,7 @@ MOD_init | 73 | @@ -634,7 +637,7 @@ MOD_init | |
42 | lavc_param_rc_max_rate = 2516; | 74 | lavc_param_rc_max_rate = 2516; | |
43 | lavc_param_rc_buffer_size = 224 * 8; | 75 | lavc_param_rc_buffer_size = 224 * 8; | |
44 | lavc_param_rc_buffer_aggressivity = 99; | 76 | lavc_param_rc_buffer_aggressivity = 99; | |
45 | - lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET; | 77 | - lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET; | |
46 | + lavc_param_scan_offset = 1; | 78 | + lavc_param_scan_offset = 1; | |
47 | 79 | |||
48 | break; | 80 | break; | |
49 | 81 | |||
50 | @@ -674,7 +674,7 @@ MOD_init | 82 | @@ -674,7 +677,7 @@ MOD_init | |
51 | 83 | |||
52 | lavc_param_rc_buffer_size = 224 * 8; | 84 | lavc_param_rc_buffer_size = 224 * 8; | |
53 | lavc_param_rc_buffer_aggressivity = 99; | 85 | lavc_param_rc_buffer_aggressivity = 99; | |
54 | - lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET; | 86 | - lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET; | |
55 | + lavc_param_scan_offset = 1; | 87 | + lavc_param_scan_offset = 1; | |
56 | 88 | |||
57 | break; | 89 | break; | |
58 | 90 | |||
59 | @@ -838,8 +838,13 @@ MOD_init | 91 | @@ -828,18 +831,35 @@ MOD_init | |
60 | lavc_venc_context->rc_strategy = lavc_param_vrc_strategy; | 92 | ||
93 | lavc_venc_context->bit_rate = vob->divxbitrate * 1000; | |||
94 | lavc_venc_context->bit_rate_tolerance = lavc_param_vrate_tolerance * 1000; | |||
95 | - lavc_venc_context->lmin= (int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5); | |||
96 | - lavc_venc_context->lmax= (int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5); | |||
97 | lavc_venc_context->max_qdiff = lavc_param_vqdiff; | |||
98 | lavc_venc_context->qcompress = lavc_param_vqcompress; | |||
99 | lavc_venc_context->qblur = lavc_param_vqblur; | |||
100 | lavc_venc_context->max_b_frames = lavc_param_vmax_b_frames; | |||
101 | lavc_venc_context->b_quant_factor = lavc_param_vb_qfactor; | |||
102 | - lavc_venc_context->rc_strategy = lavc_param_vrc_strategy; | |||
61 | lavc_venc_context->b_frame_strategy = lavc_param_vb_strategy; | 103 | lavc_venc_context->b_frame_strategy = lavc_param_vb_strategy; | |
62 | lavc_venc_context->b_quant_offset = lavc_param_vb_qoffset; | 104 | lavc_venc_context->b_quant_offset = lavc_param_vb_qoffset; | |
63 | - lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold; | 105 | - lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold; | |
64 | - lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold; | 106 | - lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold; | |
65 | + | 107 | + | |
66 | + char buf[1024]; | 108 | + char buf[1024]; | |
67 | +#define set_dict_opt(val, opt) \ | 109 | +#define set_dict_opt(val, opt) \ | |
68 | + snprintf(buf, sizeof(buf), "%i", val); \ | 110 | + snprintf(buf, sizeof(buf), "%i", val); \ | |
69 | + av_dict_set(&lavc_venc_opts, opt, buf, 0) | 111 | + av_dict_set(&lavc_venc_opts, opt, buf, 0) | |
112 | +#define set_dict_float_opt(val, opt) \ | |||
113 | + snprintf(buf, sizeof(buf), "%f", val); \ | |||
114 | + av_dict_set(&lavc_venc_opts, opt, buf, 0) | |||
70 | + set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold"); | 115 | + set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold"); | |
71 | + set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold"); | 116 | + set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold"); | |
117 | + set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5), "lmin"); | |||
118 | + set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5), "lmax"); | |||
119 | + set_dict_opt(lavc_param_vrc_strategy, "rc_strategy"); | |||
120 | + set_dict_float_opt(lavc_param_rc_qsquish, "qsquish"); | |||
121 | + set_dict_float_opt(lavc_param_rc_qmod_amp, "rc_qmod_amp"); | |||
122 | + set_dict_opt(lavc_param_rc_qmod_freq, "rc_qmod_freq"); | |||
123 | + set_dict_opt(lavc_param_rc_eq, "rc_eq"); | |||
124 | + set_dict_opt(lavc_param_vme, "me_method"); | |||
125 | + set_dict_opt(lavc_param_ibias, "ibias"); | |||
126 | + set_dict_opt(lavc_param_pbias, "pbias"); | |||
127 | + set_dict_float_opt(lavc_param_rc_buffer_aggressivity, "rc_buf_aggressivity"); | |||
128 | + set_dict_float_opt(lavc_param_rc_initial_cplx, "rc_init_cplx"); | |||
72 | lavc_venc_context->rtp_payload_size = lavc_param_packet_size; | 129 | lavc_venc_context->rtp_payload_size = lavc_param_packet_size; | |
73 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 130 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
74 | if (lavc_param_packet_size) | 131 | if (lavc_param_packet_size) | |
75 | @@ -870,7 +875,7 @@ MOD_init | 132 | @@ -848,15 +868,9 @@ MOD_init | |
133 | lavc_venc_context->strict_std_compliance= lavc_param_strict; | |||
134 | lavc_venc_context->i_quant_factor = lavc_param_vi_qfactor; | |||
135 | lavc_venc_context->i_quant_offset = lavc_param_vi_qoffset; | |||
136 | - lavc_venc_context->rc_qsquish = lavc_param_rc_qsquish; | |||
137 | - lavc_venc_context->rc_qmod_amp = lavc_param_rc_qmod_amp; | |||
138 | - lavc_venc_context->rc_qmod_freq = lavc_param_rc_qmod_freq; | |||
139 | - lavc_venc_context->rc_eq = lavc_param_rc_eq; | |||
140 | lavc_venc_context->rc_max_rate = lavc_param_rc_max_rate * 1000; | |||
141 | lavc_venc_context->rc_min_rate = lavc_param_rc_min_rate * 1000; | |||
142 | lavc_venc_context->rc_buffer_size = lavc_param_rc_buffer_size * 1024; | |||
143 | - lavc_venc_context->rc_buffer_aggressivity= lavc_param_rc_buffer_aggressivity; | |||
144 | - lavc_venc_context->rc_initial_cplx = lavc_param_rc_initial_cplx; | |||
145 | lavc_venc_context->debug = lavc_param_debug; | |||
146 | lavc_venc_context->last_predictor_count= lavc_param_last_pred; | |||
147 | lavc_venc_context->pre_me = lavc_param_pre_me; | |||
148 | @@ -864,13 +878,11 @@ MOD_init | |||
149 | lavc_venc_context->pre_dia_size = lavc_param_pre_dia_size; | |||
150 | lavc_venc_context->me_subpel_quality = lavc_param_me_subpel_quality; | |||
151 | lavc_venc_context->me_range = lavc_param_me_range; | |||
152 | - lavc_venc_context->intra_quant_bias = lavc_param_ibias; | |||
153 | - lavc_venc_context->inter_quant_bias = lavc_param_pbias; | |||
154 | lavc_venc_context->coder_type = lavc_param_coder; | |||
76 | lavc_venc_context->context_model = lavc_param_context; | 155 | lavc_venc_context->context_model = lavc_param_context; | |
77 | lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold; | 156 | lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold; | |
78 | lavc_venc_context->noise_reduction = lavc_param_noise_reduction; | 157 | lavc_venc_context->noise_reduction = lavc_param_noise_reduction; | |
79 | - lavc_venc_context->inter_threshold = lavc_param_inter_threshold; | 158 | - lavc_venc_context->inter_threshold = lavc_param_inter_threshold; | |
80 | + set_dict_opt(lavc_param_inter_threshold, "inter_threshold"); | 159 | + set_dict_opt(lavc_param_inter_threshold, "inter_threshold"); | |
81 | lavc_venc_context->intra_dc_precision = lavc_param_intra_dc_precision; | 160 | lavc_venc_context->intra_dc_precision = lavc_param_intra_dc_precision; | |
82 | lavc_venc_context->skip_top = lavc_param_skip_top; | 161 | lavc_venc_context->skip_top = lavc_param_skip_top; | |
83 | lavc_venc_context->skip_bottom = lavc_param_skip_bottom; | 162 | lavc_venc_context->skip_bottom = lavc_param_skip_bottom; | |
84 | @@ -887,7 +892,7 @@ MOD_init | 163 | @@ -887,7 +899,7 @@ MOD_init | |
85 | lavc_venc_context->thread_count); | 164 | lavc_venc_context->thread_count); | |
86 | } | 165 | } | |
87 | 166 | |||
88 | - avcodec_thread_init(lavc_venc_context, lavc_param_threads); | 167 | - avcodec_thread_init(lavc_venc_context, lavc_param_threads); | |
89 | + lavc_venc_context->thread_count = lavc_param_threads; | 168 | + lavc_venc_context->thread_count = lavc_param_threads; | |
90 | 169 | |||
91 | if (lavc_param_intra_matrix) { | 170 | if (lavc_param_intra_matrix) { | |
92 | char *tmp; | 171 | char *tmp; | |
93 | @@ -1065,15 +1070,12 @@ MOD_init | 172 | @@ -1061,19 +1073,20 @@ MOD_init | |
173 | lavc_venc_context->ildct_cmp = lavc_param_ildct_cmp; | |||
174 | lavc_venc_context->dia_size = lavc_param_dia_size; | |||
175 | lavc_venc_context->flags |= lavc_param_qpel; | |||
176 | - lavc_venc_context->flags |= lavc_param_gmc; | |||
177 | + if(lavc_param_gmc) | |||
178 | + av_dict_set(&lavc_venc_opts, "gmc", "1", 0); | |||
94 | lavc_venc_context->flags |= lavc_param_closedgop; | 179 | lavc_venc_context->flags |= lavc_param_closedgop; | |
95 | lavc_venc_context->flags |= lavc_param_trunc; | 180 | lavc_venc_context->flags |= lavc_param_trunc; | |
96 | lavc_venc_context->flags |= lavc_param_aic; | 181 | lavc_venc_context->flags |= lavc_param_aic; | |
97 | - lavc_venc_context->flags |= lavc_param_umv; | 182 | - lavc_venc_context->flags |= lavc_param_umv; | |
98 | lavc_venc_context->flags |= lavc_param_v4mv; | 183 | lavc_venc_context->flags |= lavc_param_v4mv; | |
99 | - lavc_venc_context->flags |= lavc_param_data_partitioning; | 184 | - lavc_venc_context->flags |= lavc_param_data_partitioning; | |
100 | - lavc_venc_context->flags |= lavc_param_cbp; | 185 | - lavc_venc_context->flags |= lavc_param_cbp; | |
101 | + if(lavc_param_cbp) | 186 | - lavc_venc_context->flags |= lavc_param_mv0; | |
102 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+cbp_rd", 0); | |||
103 | lavc_venc_context->flags |= lavc_param_mv0; | |||
104 | - lavc_venc_context->flags |= lavc_param_qp_rd; | 187 | - lavc_venc_context->flags |= lavc_param_qp_rd; | |
105 | - lavc_venc_context->flags |= lavc_param_scan_offset; | 188 | - lavc_venc_context->flags |= lavc_param_scan_offset; | |
106 | - lavc_venc_context->flags |= lavc_param_ss; | 189 | - lavc_venc_context->flags |= lavc_param_ss; | |
107 | - lavc_venc_context->flags |= lavc_param_alt; | 190 | - lavc_venc_context->flags |= lavc_param_alt; | |
191 | + if(lavc_param_cbp) | |||
192 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+cbp_rd", 0); | |||
193 | + if(lavc_param_mv0) | |||
194 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+mv0", 0); | |||
108 | + if(lavc_param_qp_rd) | 195 | + if(lavc_param_qp_rd) | |
109 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0); | 196 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0); | |
197 | + if (lavc_param_normalize_aqp) | |||
198 | + av_dict_set(&lavc_venc_opts, "mpv_flags", "+naq", 0); | |||
110 | lavc_venc_context->flags |= lavc_param_ilme; | 199 | lavc_venc_context->flags |= lavc_param_ilme; | |
111 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 200 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
112 | lavc_venc_context->flags |= lavc_param_trell; | 201 | lavc_venc_context->flags |= lavc_param_trell; | |
113 | @@ -1203,9 +1205,8 @@ MOD_init | 202 | @@ -1082,9 +1095,7 @@ MOD_init | |
203 | #endif | |||
114 | 204 | |||
115 | lavc_venc_context->me_method = ME_ZERO + lavc_param_vme; | 205 | if (lavc_param_gray) | |
206 | - lavc_venc_context->flags |= CODEC_FLAG_GRAY; | |||
207 | - if (lavc_param_normalize_aqp) | |||
208 | - lavc_venc_context->flags |= CODEC_FLAG_NORMALIZE_AQP; | |||
209 | + lavc_venc_context->flags |= AV_CODEC_FLAG_GRAY; | |||
210 | ||||
211 | switch(vob->encode_fields) { | |||
212 | case TC_ENCODE_FIELDS_TOP_FIRST: | |||
213 | @@ -1102,9 +1113,9 @@ MOD_init | |||
214 | } | |||
215 | ||||
216 | lavc_venc_context->flags |= interlacing_active ? | |||
217 | - CODEC_FLAG_INTERLACED_DCT : 0; | |||
218 | + AV_CODEC_FLAG_INTERLACED_DCT : 0; | |||
219 | lavc_venc_context->flags |= interlacing_active ? | |||
220 | - CODEC_FLAG_INTERLACED_ME : 0; | |||
221 | + AV_CODEC_FLAG_INTERLACED_ME : 0; | |||
222 | ||||
223 | lavc_venc_context->flags |= lavc_param_psnr; | |||
224 | do_psnr = lavc_param_psnr; | |||
225 | @@ -1112,7 +1123,7 @@ MOD_init | |||
226 | lavc_venc_context->prediction_method = lavc_param_prediction_method; | |||
227 | ||||
228 | if(is_huffyuv) | |||
229 | - lavc_venc_context->pix_fmt = PIX_FMT_YUV422P; | |||
230 | + lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P; | |||
231 | else | |||
232 | { | |||
233 | switch(pix_fmt) | |||
234 | @@ -1121,18 +1132,18 @@ MOD_init | |||
235 | case CODEC_RGB: | |||
236 | { | |||
237 | if(is_mjpeg) | |||
238 | - lavc_venc_context->pix_fmt = PIX_FMT_YUVJ420P; | |||
239 | + lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ420P; | |||
240 | else | |||
241 | - lavc_venc_context->pix_fmt = PIX_FMT_YUV420P; | |||
242 | + lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV420P; | |||
243 | break; | |||
244 | } | |||
245 | ||||
246 | case CODEC_YUV422: | |||
247 | { | |||
248 | if(is_mjpeg) | |||
249 | - lavc_venc_context->pix_fmt = PIX_FMT_YUVJ422P; | |||
250 | + lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ422P; | |||
251 | else | |||
252 | - lavc_venc_context->pix_fmt = PIX_FMT_YUV422P; | |||
253 | + lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P; | |||
254 | break; | |||
255 | } | |||
256 | ||||
257 | @@ -1151,7 +1162,7 @@ MOD_init | |||
258 | "encoding."); | |||
259 | return TC_EXPORT_ERROR; | |||
260 | } | |||
261 | - lavc_venc_context->flags |= CODEC_FLAG_PASS1; | |||
262 | + lavc_venc_context->flags |= AV_CODEC_FLAG_PASS1; | |||
263 | stats_file = fopen(vob->divxlogfile, "w"); | |||
264 | if (stats_file == NULL){ | |||
265 | tc_log_warn(MOD_NAME, "Could not create 2pass log file \"%s\".", | |||
266 | @@ -1165,7 +1176,7 @@ MOD_init | |||
267 | "encoding."); | |||
268 | return TC_EXPORT_ERROR; | |||
269 | } | |||
270 | - lavc_venc_context->flags |= CODEC_FLAG_PASS2; | |||
271 | + lavc_venc_context->flags |= AV_CODEC_FLAG_PASS2; | |||
272 | stats_file= fopen(vob->divxlogfile, "r"); | |||
273 | if (stats_file==NULL){ | |||
274 | tc_log_warn(MOD_NAME, "Could not open 2pass log file \"%s\" for " | |||
275 | @@ -1196,16 +1207,14 @@ MOD_init | |||
276 | break; | |||
277 | case 3: | |||
278 | /* fixed qscale :p */ | |||
279 | - lavc_venc_context->flags |= CODEC_FLAG_QSCALE; | |||
280 | + lavc_venc_context->flags |= AV_CODEC_FLAG_QSCALE; | |||
281 | lavc_venc_frame->quality = vob->divxbitrate; | |||
282 | break; | |||
283 | } | |||
116 | 284 | |||
285 | - lavc_venc_context->me_method = ME_ZERO + lavc_param_vme; | |||
117 | - | 286 | - | |
287 | ||||
118 | /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */ | 288 | /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */ | |
119 | - if (lavc_param_video_preset) { | 289 | - if (lavc_param_video_preset) { | |
120 | + if (lavc_param_video_preset && strcmp(lavc_param_video_preset, "none")) { | 290 | + if (lavc_param_video_preset && strcmp(lavc_param_video_preset, "none")) { | |
121 | avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context; | 291 | avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context; | |
122 | video_codec_name = ffmpeg_codec_name(codec->name); | 292 | video_codec_name = ffmpeg_codec_name(codec->name); | |
123 | 293 | |||
124 | @@ -1241,20 +1242,39 @@ MOD_init | 294 | @@ -1241,20 +1250,39 @@ MOD_init | |
125 | } | 295 | } | |
126 | } | 296 | } | |
127 | 297 | |||
128 | + if (lavc_param_scan_offset) { | 298 | + if (lavc_param_scan_offset) { | |
129 | + av_dict_set(&lavc_venc_opts, "scan_offset", "1", 0); | 299 | + av_dict_set(&lavc_venc_opts, "scan_offset", "1", 0); | |
130 | + } | 300 | + } | |
131 | + | 301 | + | |
132 | + if (lavc_param_ss) { | 302 | + if (lavc_param_ss) { | |
133 | + av_dict_set(&lavc_venc_opts, "structured_slices", "1", 0); | 303 | + av_dict_set(&lavc_venc_opts, "structured_slices", "1", 0); | |
134 | + } | 304 | + } | |
135 | + | 305 | + | |
136 | + if (lavc_param_alt) { | 306 | + if (lavc_param_alt) { | |
137 | + av_dict_set(&lavc_venc_opts, "alternate_scan", "1", 0); | 307 | + av_dict_set(&lavc_venc_opts, "alternate_scan", "1", 0); | |
@@ -154,13 +324,70 @@ Fixes building against FFmpeg version >= | @@ -154,13 +324,70 @@ Fixes building against FFmpeg version >= | |||
154 | if (ret < 0) { | 324 | if (ret < 0) { | |
155 | tc_log_warn(MOD_NAME, "could not open FFMPEG codec"); | 325 | tc_log_warn(MOD_NAME, "could not open FFMPEG codec"); | |
156 | return TC_EXPORT_ERROR; | 326 | return TC_EXPORT_ERROR; | |
157 | } | 327 | } | |
158 | 328 | |||
159 | - if (lavc_venc_context->codec->encode == NULL) { | 329 | - if (lavc_venc_context->codec->encode == NULL) { | |
160 | + if (av_codec_is_encoder(lavc_venc_context->codec) == 0) { | 330 | + if (av_codec_is_encoder(lavc_venc_context->codec) == 0) { | |
161 | tc_log_warn(MOD_NAME, "could not open FFMPEG codec " | 331 | tc_log_warn(MOD_NAME, "could not open FFMPEG codec " | |
162 | - "(lavc_venc_context->codec->encode == NULL)"); | 332 | - "(lavc_venc_context->codec->encode == NULL)"); | |
163 | + "(av_codec_is_encoder(lavc_venc_context->codec) == 0)"); | 333 | + "(av_codec_is_encoder(lavc_venc_context->codec) == 0)"); | |
164 | return TC_EXPORT_ERROR; | 334 | return TC_EXPORT_ERROR; | |
165 | } | 335 | } | |
166 | 336 | |||
337 | @@ -1574,6 +1602,8 @@ MOD_encode | |||
338 | ||||
339 | int out_size; | |||
340 | const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'}; | |||
341 | + AVPacket pkt; | |||
342 | + int ret, got_packet = 0; | |||
343 | ||||
344 | if (param->flag == TC_VIDEO) { | |||
345 | ||||
346 | @@ -1598,7 +1628,7 @@ MOD_encode | |||
347 | YUV_INIT_PLANES(src, param->buffer, IMG_YUV_DEFAULT, | |||
348 | lavc_venc_context->width, lavc_venc_context->height); | |||
349 | avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer, | |||
350 | - PIX_FMT_YUV422P, lavc_venc_context->width, | |||
351 | + AV_PIX_FMT_YUV422P, lavc_venc_context->width, | |||
352 | lavc_venc_context->height); | |||
353 | /* FIXME: can't use tcv_convert (see decode_lavc.c) */ | |||
354 | ac_imgconvert(src, IMG_YUV_DEFAULT, | |||
355 | @@ -1628,7 +1658,7 @@ MOD_encode | |||
356 | lavc_venc_context->width, | |||
357 | lavc_venc_context->height); | |||
358 | avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer, | |||
359 | - PIX_FMT_YUV420P, lavc_venc_context->width, | |||
360 | + AV_PIX_FMT_YUV420P, lavc_venc_context->width, | |||
361 | lavc_venc_context->height); | |||
362 | ac_imgconvert(src, IMG_YUV422P, | |||
363 | lavc_venc_frame->data, IMG_YUV420P, | |||
364 | @@ -1639,7 +1669,7 @@ MOD_encode | |||
365 | ||||
366 | case CODEC_RGB: | |||
367 | avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer, | |||
368 | - PIX_FMT_YUV420P, lavc_venc_context->width, | |||
369 | + AV_PIX_FMT_YUV420P, lavc_venc_context->width, | |||
370 | lavc_venc_context->height); | |||
371 | ac_imgconvert(¶m->buffer, IMG_RGB_DEFAULT, | |||
372 | lavc_venc_frame->data, IMG_YUV420P, | |||
373 | @@ -1652,13 +1682,17 @@ MOD_encode | |||
374 | return TC_EXPORT_ERROR; | |||
375 | } | |||
376 | ||||
377 | + av_init_packet(&pkt); | |||
378 | + pkt.data = enc_buffer; | |||
379 | + pkt.size = size; | |||
380 | ||||
381 | TC_LOCK_LIBAVCODEC; | |||
382 | - out_size = avcodec_encode_video(lavc_venc_context, | |||
383 | - enc_buffer, size, | |||
384 | - lavc_venc_frame); | |||
385 | + ret = avcodec_encode_video2(lavc_venc_context, &pkt, | |||
386 | + lavc_venc_frame, &got_packet); | |||
387 | TC_UNLOCK_LIBAVCODEC; | |||
388 | ||||
389 | + out_size = ret ? ret : pkt.size; | |||
390 | + | |||
391 | if (out_size < 0) { | |||
392 | tc_log_warn(MOD_NAME, "encoder error: size (%d)", out_size); | |||
393 | return TC_EXPORT_ERROR; |
@@ -1,73 +1,137 @@ | @@ -1,73 +1,137 @@ | |||
1 | $NetBSD: patch-export_ffmpeg_cfg.c,v 1.2 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-export_ffmpeg_cfg.c,v 1.3 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- export/ffmpeg_cfg.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- export/ffmpeg_cfg.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ export/ffmpeg_cfg.c | 6 | +++ export/ffmpeg_cfg.c | |
7 | @@ -34,8 +34,6 @@ int lavc_param_vme = 4; | 7 | @@ -34,8 +34,6 @@ int lavc_param_vme = 4; | |
8 | //int lavc_param_vqscale = 0; | 8 | //int lavc_param_vqscale = 0; | |
9 | //int lavc_param_vqmin = 2; | 9 | //int lavc_param_vqmin = 2; | |
10 | //int lavc_param_vqmax = 31; | 10 | //int lavc_param_vqmax = 31; | |
11 | -int lavc_param_mb_qmin = 2; | 11 | -int lavc_param_mb_qmin = 2; | |
12 | -int lavc_param_mb_qmax = 31; | 12 | -int lavc_param_mb_qmax = 31; | |
13 | int lavc_param_lmin = 2; | 13 | int lavc_param_lmin = 2; | |
14 | int lavc_param_lmax = 31; | 14 | int lavc_param_lmax = 31; | |
15 | int lavc_param_vqdiff = 3; | 15 | int lavc_param_vqdiff = 3; | |
16 | @@ -95,8 +93,8 @@ int lavc_param_last_pred= 0; | |||
17 | int lavc_param_pre_me= 1; | |||
18 | int lavc_param_me_subpel_quality= 8; | |||
19 | int lavc_param_me_range=0; | |||
20 | -int lavc_param_ibias=FF_DEFAULT_QUANT_BIAS; | |||
21 | -int lavc_param_pbias=FF_DEFAULT_QUANT_BIAS; | |||
22 | +int lavc_param_ibias=0; | |||
23 | +int lavc_param_pbias=0; | |||
24 | int lavc_param_coder=0; | |||
25 | int lavc_param_context=0; | |||
26 | char *lavc_param_intra_matrix = NULL; | |||
16 | @@ -126,7 +124,7 @@ int lavc_param_gmc = 0; | 27 | @@ -126,7 +124,7 @@ int lavc_param_gmc = 0; | |
17 | //int lavc_param_atag = 0; | 28 | //int lavc_param_atag = 0; | |
18 | //int lavc_param_abitrate = 224; | 29 | //int lavc_param_abitrate = 224; | |
19 | 30 | |||
20 | -char *lavc_param_video_preset = "medium"; | 31 | -char *lavc_param_video_preset = "medium"; | |
21 | +char *lavc_param_video_preset = "none"; | 32 | +char *lavc_param_video_preset = "none"; | |
22 | char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg"; | 33 | char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg"; | |
23 | 34 | |||
24 | TCConfigEntry lavcopts_conf[]={ | 35 | TCConfigEntry lavcopts_conf[]={ | |
25 | @@ -143,8 +141,6 @@ TCConfigEntry lavcopts_conf[]={ | 36 | @@ -138,20 +136,18 @@ TCConfigEntry lavcopts_conf[]={ | |
37 | {"vratetol", &lavc_param_vrate_tolerance, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000}, | |||
38 | {"vhq", &lavc_param_mb_decision, TCCONF_TYPE_FLAG, 0, 0, 1}, | |||
39 | {"mbd", &lavc_param_mb_decision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9}, | |||
40 | - {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV}, | |||
41 | + {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV}, | |||
42 | {"vme", &lavc_param_vme, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 5}, | |||
26 | // {"vqscale", &lavc_param_vqscale, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 43 | // {"vqscale", &lavc_param_vqscale, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
27 | // {"vqmin", &lavc_param_vqmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 44 | // {"vqmin", &lavc_param_vqmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
28 | // {"vqmax", &lavc_param_vqmax, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 45 | // {"vqmax", &lavc_param_vqmax, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
29 | - {"mbqmin", &lavc_param_mb_qmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 46 | - {"mbqmin", &lavc_param_mb_qmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
30 | - {"mbqmax", &lavc_param_mb_qmax, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 47 | - {"mbqmax", &lavc_param_mb_qmax, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
31 | {"lmin", &lavc_param_lmin, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0}, | 48 | {"lmin", &lavc_param_lmin, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0}, | |
32 | {"lmax", &lavc_param_lmax, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0}, | 49 | {"lmax", &lavc_param_lmax, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0}, | |
33 | {"vqdiff", &lavc_param_vqdiff, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | 50 | {"vqdiff", &lavc_param_vqdiff, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31}, | |
51 | {"vqcomp", &lavc_param_vqcompress, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0}, | |||
52 | {"vqblur", &lavc_param_vqblur, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0}, | |||
53 | {"vb_qfactor", &lavc_param_vb_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0}, | |||
54 | - {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES}, | |||
55 | + {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX}, | |||
56 | // {"vpass", &lavc_param_vpass, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2}, | |||
57 | {"vrc_strategy", &lavc_param_vrc_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2}, | |||
58 | {"vb_strategy", &lavc_param_vb_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, | |||
34 | @@ -160,9 +156,9 @@ TCConfigEntry lavcopts_conf[]={ | 59 | @@ -160,9 +156,9 @@ TCConfigEntry lavcopts_conf[]={ | |
35 | {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, | 60 | {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, | |
36 | {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000}, | 61 | {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000}, | |
37 | {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, | 62 | {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99}, | |
38 | - {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART}, | 63 | - {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART}, | |
39 | + {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1}, | 64 | + {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
40 | // {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0}, | 65 | // {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0}, | |
41 | - {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART}, | 66 | - {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART}, | |
42 | + {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY}, | 67 | + {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY}, | |
43 | {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1}, | 68 | {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
44 | {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0}, | 69 | {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0}, | |
45 | {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0}, | 70 | {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0}, | |
46 | @@ -211,21 +207,21 @@ TCConfigEntry lavcopts_conf[]={ | 71 | @@ -188,7 +184,7 @@ TCConfigEntry lavcopts_conf[]={ | |
72 | {"pred", &lavc_param_prediction_method, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 20}, | |||
73 | {"format", &lavc_param_format, TCCONF_TYPE_STRING, 0, 0, 0}, | |||
74 | {"debug", &lavc_param_debug, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000}, | |||
75 | - {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR}, | |||
76 | + {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR}, | |||
77 | {"precmp", &lavc_param_me_pre_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000}, | |||
78 | {"cmp", &lavc_param_me_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000}, | |||
79 | {"subcmp", &lavc_param_me_sub_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000}, | |||
80 | @@ -196,9 +192,9 @@ TCConfigEntry lavcopts_conf[]={ | |||
81 | {"ildctcmp", &lavc_param_ildct_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000}, | |||
82 | {"predia", &lavc_param_pre_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000}, | |||
83 | {"dia", &lavc_param_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000}, | |||
84 | - {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL}, | |||
85 | + {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL}, | |||
86 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |||
87 | - {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT}, | |||
88 | + {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRELLIS_QUANT}, | |||
47 | #else | 89 | #else | |
48 | {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED}, | 90 | {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
91 | #endif | |||
92 | @@ -207,32 +203,32 @@ TCConfigEntry lavcopts_conf[]={ | |||
93 | {"subq", &lavc_param_me_subpel_quality, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8}, | |||
94 | {"me_range", &lavc_param_me_range, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000}, | |||
95 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |||
96 | - {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC}, | |||
97 | + {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_H263P_AIC}, | |||
98 | #else | |||
99 | - {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED}, | |||
100 | + {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED}, | |||
49 | #endif | 101 | #endif | |
50 | - {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV}, | 102 | - {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV}, | |
51 | + {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1}, | 103 | + {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
52 | {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, | 104 | {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, | |
53 | {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, | 105 | {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512}, | |
54 | {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, | 106 | {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, | |
55 | {"context", &lavc_param_context, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, | 107 | {"context", &lavc_param_context, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10}, | |
56 | {"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0}, | 108 | {"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0}, | |
57 | {"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0}, | 109 | {"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0}, | |
58 | - {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD}, | 110 | - {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD}, | |
111 | - {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0}, | |||
59 | + {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1}, | 112 | + {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
60 | {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0}, | 113 | + {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
61 | {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000}, | 114 | {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000}, | |
62 | - {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD}, | 115 | - {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD}, | |
63 | + {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1}, | 116 | + {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
64 | {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16}, | 117 | {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16}, | |
65 | - {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT}, | 118 | - {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT}, | |
66 | - {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET}, | 119 | - {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET}, | |
67 | - {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN}, | 120 | - {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN}, | |
121 | - {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME}, | |||
68 | + {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1}, | 122 | + {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
69 | + {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1}, | 123 | + {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
70 | + {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1}, | 124 | + {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1}, | |
71 | {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME}, | 125 | + {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME}, | |
72 | {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, | 126 | {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, | |
73 | {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, | 127 | {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000}, | |
128 | {"top", &lavc_param_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1, 1}, | |||
129 | - {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GMC}, | |||
130 | - {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRUNCATED}, | |||
131 | - {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP}, | |||
132 | + {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, 1}, | |||
133 | + {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRUNCATED}, | |||
134 | + {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP}, | |||
135 | {"intra_dc_precision", &lavc_param_intra_dc_precision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16}, | |||
136 | {"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000}, | |||
137 | {"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000}, |
@@ -1,33 +1,211 @@ | @@ -1,33 +1,211 @@ | |||
1 | $NetBSD: patch-import_import_ffmpeg.c,v 1.2 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-import_import_ffmpeg.c,v 1.3 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- import/import_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- import/import_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ import/import_ffmpeg.c | 6 | +++ import/import_ffmpeg.c | |
7 | @@ -59,51 +59,51 @@ struct ffmpeg_codec { | |||
8 | ||||
9 | // fourCC to ID mapping taken from MPlayer's codecs.conf | |||
10 | static struct ffmpeg_codec ffmpeg_codecs[] = { | |||
11 | - {CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41", | |||
12 | + {AV_CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41", | |||
13 | {"MP41", "DIV1", ""}}, | |||
14 | - {CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42", | |||
15 | + {AV_CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42", | |||
16 | {"MP42", "DIV2", ""}}, | |||
17 | - {CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4", | |||
18 | + {AV_CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4", | |||
19 | {"DIV3", "DIV5", "AP41", "MPG3", "MP43", ""}}, | |||
20 | - {CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4", | |||
21 | + {AV_CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4", | |||
22 | {"DIVX", "XVID", "MP4S", "M4S2", "MP4V", "UMP4", "DX50", ""}}, | |||
23 | - {CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg", | |||
24 | + {AV_CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg", | |||
25 | {"MJPG", "AVRN", "AVDJ", "JPEG", "MJPA", "JFIF", ""}}, | |||
26 | - {CODEC_ID_MPEG1VIDEO, TC_CODEC_MPG1, "mpeg1video", | |||
27 | + {AV_CODEC_ID_MPEG1VIDEO, TC_CODEC_MPG1, "mpeg1video", | |||
28 | {"MPG1", ""}}, | |||
29 | - {CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo", | |||
30 | + {AV_CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo", | |||
31 | {"DVSD", ""}}, | |||
32 | - {CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1", | |||
33 | + {AV_CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1", | |||
34 | {"WMV1", ""}}, | |||
35 | - {CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2", | |||
36 | + {AV_CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2", | |||
37 | {"WMV2", ""}}, | |||
38 | - {CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu", | |||
39 | + {AV_CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu", | |||
40 | {"HFYU", ""}}, | |||
41 | - {CODEC_ID_H263I, TC_CODEC_H263I, "h263i", | |||
42 | + {AV_CODEC_ID_H263I, TC_CODEC_H263I, "h263i", | |||
43 | {"I263", ""}}, | |||
44 | - {CODEC_ID_H263P, TC_CODEC_H263P, "h263p", | |||
45 | + {AV_CODEC_ID_H263P, TC_CODEC_H263P, "h263p", | |||
46 | {"H263", "U263", "VIV1", ""}}, | |||
47 | - {CODEC_ID_H264, TC_CODEC_H264, "h264", | |||
48 | + {AV_CODEC_ID_H264, TC_CODEC_H264, "h264", | |||
49 | {"H264", "h264", "X264", "x264", "avc1", ""}}, | |||
50 | - {CODEC_ID_RV10, TC_CODEC_RV10, "rv10", | |||
51 | + {AV_CODEC_ID_RV10, TC_CODEC_RV10, "rv10", | |||
52 | {"RV10", "RV13", ""}}, | |||
53 | - {CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1", | |||
54 | + {AV_CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1", | |||
55 | {"SVQ1", ""}}, | |||
56 | - {CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3", | |||
57 | + {AV_CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3", | |||
58 | {"SVQ3", ""}}, | |||
59 | - {CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video", | |||
60 | + {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video", | |||
61 | {"MPG2", ""}}, | |||
62 | - {CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG, "mpeg2video", | |||
63 | + {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG, "mpeg2video", | |||
64 | {"MPG2", ""}}, | |||
65 | - {CODEC_ID_ASV1, TC_CODEC_ASV1, "asv1", | |||
66 | + {AV_CODEC_ID_ASV1, TC_CODEC_ASV1, "asv1", | |||
67 | {"ASV1", ""}}, | |||
68 | - {CODEC_ID_ASV2, TC_CODEC_ASV2, "asv2", | |||
69 | + {AV_CODEC_ID_ASV2, TC_CODEC_ASV2, "asv2", | |||
70 | {"ASV2", ""}}, | |||
71 | - {CODEC_ID_FFV1, TC_CODEC_FFV1, "ffv1", | |||
72 | + {AV_CODEC_ID_FFV1, TC_CODEC_FFV1, "ffv1", | |||
73 | {"FFV1", ""}}, | |||
74 | - {CODEC_ID_RAWVIDEO, TC_CODEC_YUV420P, "raw", | |||
75 | + {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV420P, "raw", | |||
76 | {"I420", "IYUV", ""}}, | |||
77 | - {CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw", | |||
78 | + {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw", | |||
79 | {"Y42B", ""}}, | |||
80 | {0, TC_CODEC_UNKNOWN, NULL, {""}}}; | |||
81 | ||||
7 | @@ -302,7 +302,7 @@ do_avi: | 82 | @@ -302,7 +302,7 @@ do_avi: | |
8 | 83 | |||
9 | // Set these to the expected values so that ffmpeg's decoder can | 84 | // Set these to the expected values so that ffmpeg's decoder can | |
10 | // properly detect interlaced input. | 85 | // properly detect interlaced input. | |
11 | - lavc_dec_context = avcodec_alloc_context(); | 86 | - lavc_dec_context = avcodec_alloc_context(); | |
12 | + lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec); | 87 | + lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec); | |
13 | if (lavc_dec_context == NULL) { | 88 | if (lavc_dec_context == NULL) { | |
14 | tc_log_error(MOD_NAME, "Could not allocate enough memory."); | 89 | tc_log_error(MOD_NAME, "Could not allocate enough memory."); | |
15 | return TC_IMPORT_ERROR; | 90 | return TC_IMPORT_ERROR; | |
16 | @@ -314,7 +314,7 @@ do_avi: | 91 | @@ -310,11 +310,11 @@ do_avi: | |
92 | lavc_dec_context->width = x_dim; | |||
93 | lavc_dec_context->height = y_dim; | |||
94 | ||||
95 | - if (vob->decolor) lavc_dec_context->flags |= CODEC_FLAG_GRAY; | |||
96 | + if (vob->decolor) lavc_dec_context->flags |= AV_CODEC_FLAG_GRAY; | |||
17 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 97 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
18 | lavc_dec_context->error_resilience = 2; | 98 | lavc_dec_context->error_resilience = 2; | |
19 | #else | 99 | #else | |
20 | - lavc_dec_context->error_recognition = 2; | 100 | - lavc_dec_context->error_recognition = 2; | |
21 | + lavc_dec_context->err_recognition = 2; | 101 | + lavc_dec_context->err_recognition = 2; | |
22 | #endif | 102 | #endif | |
23 | lavc_dec_context->error_concealment = 3; | 103 | lavc_dec_context->error_concealment = 3; | |
24 | lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT; | 104 | lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT; | |
105 | @@ -324,13 +324,13 @@ do_avi: | |||
106 | // XXX: some codecs need extra data | |||
107 | switch (codec->id) | |||
108 | { | |||
109 | - case CODEC_ID_MJPEG: extra_data_size = 28; break; | |||
110 | - case CODEC_ID_LJPEG: extra_data_size = 28; break; | |||
111 | - case CODEC_ID_HUFFYUV: extra_data_size = 1000; break; | |||
112 | - case CODEC_ID_ASV1: extra_data_size = 8; break; | |||
113 | - case CODEC_ID_ASV2: extra_data_size = 8; break; | |||
114 | - case CODEC_ID_WMV1: extra_data_size = 4; break; | |||
115 | - case CODEC_ID_WMV2: extra_data_size = 4; break; | |||
116 | + case AV_CODEC_ID_MJPEG: extra_data_size = 28; break; | |||
117 | + case AV_CODEC_ID_LJPEG: extra_data_size = 28; break; | |||
118 | + case AV_CODEC_ID_HUFFYUV: extra_data_size = 1000; break; | |||
119 | + case AV_CODEC_ID_ASV1: extra_data_size = 8; break; | |||
120 | + case AV_CODEC_ID_ASV2: extra_data_size = 8; break; | |||
121 | + case AV_CODEC_ID_WMV1: extra_data_size = 4; break; | |||
122 | + case AV_CODEC_ID_WMV2: extra_data_size = 4; break; | |||
123 | default: extra_data_size = 0; break; | |||
124 | } | |||
125 | ||||
25 | @@ -344,7 +344,7 @@ do_avi: | 126 | @@ -344,7 +344,7 @@ do_avi: | |
26 | } | 127 | } | |
27 | 128 | |||
28 | TC_LOCK_LIBAVCODEC; | 129 | TC_LOCK_LIBAVCODEC; | |
29 | - ret = avcodec_open(lavc_dec_context, lavc_dec_codec); | 130 | - ret = avcodec_open(lavc_dec_context, lavc_dec_codec); | |
30 | + ret = avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL); | 131 | + ret = avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL); | |
31 | TC_UNLOCK_LIBAVCODEC; | 132 | TC_UNLOCK_LIBAVCODEC; | |
32 | if (ret < 0) { | 133 | if (ret < 0) { | |
33 | tc_log_warn(MOD_NAME, "Could not initialize the '%s' codec.", | 134 | tc_log_warn(MOD_NAME, "Could not initialize the '%s' codec.", | |
135 | @@ -360,7 +360,7 @@ do_avi: | |||
136 | frame_size = x_dim*y_dim + 2*UV_PLANE_SIZE(IMG_YUV_DEFAULT,x_dim,y_dim); | |||
137 | ||||
138 | // we adapt the color space | |||
139 | - if(codec->id == CODEC_ID_MJPEG) { | |||
140 | + if(codec->id == AV_CODEC_ID_MJPEG) { | |||
141 | enable_levels_filter(); | |||
142 | } | |||
143 | break; | |||
144 | @@ -434,7 +434,7 @@ do_dv: | |||
145 | } | |||
146 | ||||
147 | // we adapt the color space | |||
148 | - if(codec->id == CODEC_ID_MJPEG) { | |||
149 | + if(codec->id == AV_CODEC_ID_MJPEG) { | |||
150 | enable_levels_filter(); | |||
151 | } | |||
152 | ||||
153 | @@ -504,13 +504,13 @@ MOD_decode { | |||
154 | int bkey = 0; | |||
155 | ||||
156 | // check for keyframes | |||
157 | - if (codec->id == CODEC_ID_MSMPEG4V3) { | |||
158 | + if (codec->id == AV_CODEC_ID_MSMPEG4V3) { | |||
159 | if (divx3_is_key(buffer)) bkey = 1; | |||
160 | } | |||
161 | - else if (codec->id == CODEC_ID_MPEG4) { | |||
162 | + else if (codec->id == AV_CODEC_ID_MPEG4) { | |||
163 | if (mpeg4_is_key(buffer, bytes_read)) bkey = 1; | |||
164 | } | |||
165 | - else if (codec->id == CODEC_ID_MJPEG) { | |||
166 | + else if (codec->id == AV_CODEC_ID_MJPEG) { | |||
167 | bkey = 1; | |||
168 | } | |||
169 | ||||
170 | @@ -580,8 +580,8 @@ retry: | |||
171 | ||||
172 | // Convert avcodec image to our internal YUV or RGB format | |||
173 | switch (lavc_dec_context->pix_fmt) { | |||
174 | - case PIX_FMT_YUVJ420P: | |||
175 | - case PIX_FMT_YUV420P: | |||
176 | + case AV_PIX_FMT_YUVJ420P: | |||
177 | + case AV_PIX_FMT_YUV420P: | |||
178 | src_fmt = IMG_YUV420P; | |||
179 | YUV_INIT_PLANES(src_planes, frame, src_fmt, | |||
180 | lavc_dec_context->width, lavc_dec_context->height); | |||
181 | @@ -612,7 +612,7 @@ retry: | |||
182 | } | |||
183 | break; | |||
184 | ||||
185 | - case PIX_FMT_YUV411P: | |||
186 | + case AV_PIX_FMT_YUV411P: | |||
187 | src_fmt = IMG_YUV411P; | |||
188 | YUV_INIT_PLANES(src_planes, frame, src_fmt, | |||
189 | lavc_dec_context->width, lavc_dec_context->height); | |||
190 | @@ -640,8 +640,8 @@ retry: | |||
191 | } | |||
192 | break; | |||
193 | ||||
194 | - case PIX_FMT_YUVJ422P: | |||
195 | - case PIX_FMT_YUV422P: | |||
196 | + case AV_PIX_FMT_YUVJ422P: | |||
197 | + case AV_PIX_FMT_YUV422P: | |||
198 | src_fmt = IMG_YUV422P; | |||
199 | YUV_INIT_PLANES(src_planes, frame, src_fmt, | |||
200 | lavc_dec_context->width, lavc_dec_context->height); | |||
201 | @@ -669,8 +669,8 @@ retry: | |||
202 | } | |||
203 | break; | |||
204 | ||||
205 | - case PIX_FMT_YUVJ444P: | |||
206 | - case PIX_FMT_YUV444P: | |||
207 | + case AV_PIX_FMT_YUVJ444P: | |||
208 | + case AV_PIX_FMT_YUV444P: | |||
209 | src_fmt = IMG_YUV444P; | |||
210 | YUV_INIT_PLANES(src_planes, frame, src_fmt, | |||
211 | lavc_dec_context->width, lavc_dec_context->height); |
@@ -1,35 +1,49 @@ | @@ -1,35 +1,49 @@ | |||
1 | $NetBSD: patch-import_probe_ffmpeg.c,v 1.2 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-import_probe_ffmpeg.c,v 1.3 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- import/probe_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- import/probe_ffmpeg.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ import/probe_ffmpeg.c | 6 | +++ import/probe_ffmpeg.c | |
7 | @@ -51,8 +51,8 @@ static void translate_info(const AVForma | |||
8 | info->bitrate = st->codec->bit_rate / 1000; | |||
9 | info->width = st->codec->width; | |||
10 | info->height = st->codec->height; | |||
11 | - if (st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0) { | |||
12 | - info->fps = av_q2d(st->r_frame_rate); | |||
13 | + if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) { | |||
14 | + info->fps = av_q2d(st->avg_frame_rate); | |||
15 | } else { | |||
16 | /* watch out here */ | |||
17 | info->fps = 1.0/av_q2d(st->codec->time_base); | |||
7 | @@ -99,8 +99,8 @@ void probe_ffmpeg(info_t *ipipe) | 18 | @@ -99,8 +99,8 @@ void probe_ffmpeg(info_t *ipipe) | |
8 | 19 | |||
9 | TC_INIT_LIBAVCODEC; | 20 | TC_INIT_LIBAVCODEC; | |
10 | 21 | |||
11 | - ret = av_open_input_file(&lavf_dmx_context, ipipe->name, | 22 | - ret = av_open_input_file(&lavf_dmx_context, ipipe->name, | |
12 | - NULL, 0, NULL); | 23 | - NULL, 0, NULL); | |
13 | + ret = avformat_open_input(&lavf_dmx_context, ipipe->name, | 24 | + ret = avformat_open_input(&lavf_dmx_context, ipipe->name, | |
14 | + NULL, NULL); | 25 | + NULL, NULL); | |
15 | if (ret != 0) { | 26 | if (ret != 0) { | |
16 | tc_log_error(__FILE__, "unable to open '%s'" | 27 | tc_log_error(__FILE__, "unable to open '%s'" | |
17 | " (libavformat failure)", | 28 | " (libavformat failure)", | |
18 | @@ -109,7 +109,7 @@ void probe_ffmpeg(info_t *ipipe) | 29 | @@ -109,7 +109,7 @@ void probe_ffmpeg(info_t *ipipe) | |
19 | return; | 30 | return; | |
20 | } | 31 | } | |
21 | 32 | |||
22 | - ret = av_find_stream_info(lavf_dmx_context); | 33 | - ret = av_find_stream_info(lavf_dmx_context); | |
23 | + ret = avformat_find_stream_info(lavf_dmx_context, NULL); | 34 | + ret = avformat_find_stream_info(lavf_dmx_context, NULL); | |
24 | if (ret < 0) { | 35 | if (ret < 0) { | |
25 | tc_log_error(__FILE__, "unable to fetch informations from '%s'" | 36 | tc_log_error(__FILE__, "unable to fetch informations from '%s'" | |
26 | " (libavformat failure)", | 37 | " (libavformat failure)", | |
27 | @@ -120,7 +120,7 @@ void probe_ffmpeg(info_t *ipipe) | 38 | @@ -120,7 +120,11 @@ void probe_ffmpeg(info_t *ipipe) | |
28 | 39 | |||
29 | translate_info(lavf_dmx_context, ipipe->probe_info); | 40 | translate_info(lavf_dmx_context, ipipe->probe_info); | |
30 | 41 | |||
31 | - av_close_input_file(lavf_dmx_context); | 42 | +#if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(53,25,0) | |
32 | + avformat_close_input(&lavf_dmx_context); | 43 | + avformat_close_input(&lavf_dmx_context); | |
44 | +#else | |||
45 | av_close_input_file(lavf_dmx_context); | |||
46 | +#endif | |||
33 | return; | 47 | return; | |
34 | } | 48 | } | |
35 | 49 |
@@ -1,24 +1,104 @@ | @@ -1,24 +1,104 @@ | |||
1 | $NetBSD: patch-export_aud__aux.c,v 1.1 2015/11/21 17:14:26 adam Exp $ | 1 | $NetBSD: patch-export_aud__aux.c,v 1.2 2019/12/29 10:23:53 markd Exp $ | |
2 | 2 | |||
3 | Fixes building against FFmpeg version >= 2.0.0 (gentoo patch). | 3 | Fixes building against FFmpeg version >= 4.0.0 (gentoo patch). | |
4 | 4 | |||
5 | --- export/aud_aux.c.orig 2011-11-19 16:50:27.000000000 +0000 | 5 | --- export/aud_aux.c.orig 2011-11-19 16:50:27.000000000 +0000 | |
6 | +++ export/aud_aux.c | 6 | +++ export/aud_aux.c | |
7 | @@ -326,10 +326,10 @@ static int tc_audio_init_ffmpeg(vob_t *v | |||
8 | ||||
9 | switch (o_codec) { | |||
10 | case 0x50: | |||
11 | - codeid = CODEC_ID_MP2; | |||
12 | + codeid = AV_CODEC_ID_MP2; | |||
13 | break; | |||
14 | case 0x2000: | |||
15 | - codeid = CODEC_ID_AC3; | |||
16 | + codeid = AV_CODEC_ID_AC3; | |||
17 | break; | |||
18 | default: | |||
19 | tc_warn("cannot init ffmpeg with %x", o_codec); | |||
7 | @@ -346,7 +346,7 @@ static int tc_audio_init_ffmpeg(vob_t *v | 20 | @@ -346,7 +346,7 @@ static int tc_audio_init_ffmpeg(vob_t *v | |
8 | 21 | |||
9 | //-- set parameters (bitrate, channels and sample-rate) -- | 22 | //-- set parameters (bitrate, channels and sample-rate) -- | |
10 | //-------------------------------------------------------- | 23 | //-------------------------------------------------------- | |
11 | - avcodec_get_context_defaults(&mpa_ctx); | 24 | - avcodec_get_context_defaults(&mpa_ctx); | |
12 | + avcodec_get_context_defaults3(&mpa_ctx, mpa_codec); | 25 | + avcodec_get_context_defaults3(&mpa_ctx, mpa_codec); | |
13 | #if LIBAVCODEC_VERSION_MAJOR < 53 | 26 | #if LIBAVCODEC_VERSION_MAJOR < 53 | |
14 | mpa_ctx.codec_type = CODEC_TYPE_AUDIO; | 27 | mpa_ctx.codec_type = CODEC_TYPE_AUDIO; | |
15 | #else | 28 | #else | |
16 | @@ -359,7 +359,7 @@ static int tc_audio_init_ffmpeg(vob_t *v | 29 | @@ -359,11 +359,11 @@ static int tc_audio_init_ffmpeg(vob_t *v | |
17 | //-- open codec -- | 30 | //-- open codec -- | |
18 | //---------------- | 31 | //---------------- | |
19 | TC_LOCK_LIBAVCODEC; | 32 | TC_LOCK_LIBAVCODEC; | |
20 | - ret = avcodec_open(&mpa_ctx, mpa_codec); | 33 | - ret = avcodec_open(&mpa_ctx, mpa_codec); | |
21 | + ret = avcodec_open2(&mpa_ctx, mpa_codec, NULL); | 34 | + ret = avcodec_open2(&mpa_ctx, mpa_codec, NULL); | |
22 | TC_UNLOCK_LIBAVCODEC; | 35 | TC_UNLOCK_LIBAVCODEC; | |
23 | if (ret < 0) { | 36 | if (ret < 0) { | |
24 | tc_warn("tc_audio_init_ffmpeg: could not open %s codec !", | 37 | tc_warn("tc_audio_init_ffmpeg: could not open %s codec !", | |
38 | - (codeid == CODEC_ID_MP2) ?"mpa" :"ac3"); | |||
39 | + (codeid == AV_CODEC_ID_MP2) ?"mpa" :"ac3"); | |||
40 | return(TC_EXPORT_ERROR); | |||
41 | } | |||
42 | ||||
43 | @@ -846,6 +846,9 @@ static int tc_audio_encode_ffmpeg(char * | |||
44 | #ifdef HAVE_FFMPEG | |||
45 | int in_size, out_size; | |||
46 | char *in_buf; | |||
47 | + int got_packet; | |||
48 | + AVPacket avpkt = { 0 }; | |||
49 | + AVFrame *frame = av_frame_alloc(); | |||
50 | ||||
51 | //-- input buffer and amount of bytes -- | |||
52 | in_size = aud_size; | |||
53 | @@ -866,10 +869,14 @@ static int tc_audio_encode_ffmpeg(char * | |||
54 | ||||
55 | ac_memcpy(&mpa_buf[mpa_buf_ptr], in_buf, bytes_needed); | |||
56 | ||||
57 | + frame->nb_samples = mpa_ctx.frame_size; | |||
58 | + avcodec_fill_audio_frame(frame, mpa_ctx.channels, mpa_ctx.sample_fmt, (const uint8_t *)mpa_buf, mpa_bytes_pf, 1); | |||
59 | + avpkt.data = output; | |||
60 | + avpkt.size = OUTPUT_SIZE; | |||
61 | TC_LOCK_LIBAVCODEC; | |||
62 | - out_size = avcodec_encode_audio(&mpa_ctx, (unsigned char *)output, | |||
63 | - OUTPUT_SIZE, (short *)mpa_buf); | |||
64 | + out_size = avcodec_encode_audio2(&mpa_ctx, &avpkt, frame, &got_packet); | |||
65 | TC_UNLOCK_LIBAVCODEC; | |||
66 | + out_size = avpkt.size; | |||
67 | tc_audio_write(output, out_size, avifile); | |||
68 | ||||
69 | in_size -= bytes_needed; | |||
70 | @@ -884,6 +891,7 @@ static int tc_audio_encode_ffmpeg(char * | |||
71 | ||||
72 | ac_memcpy(&mpa_buf[mpa_buf_ptr], aud_buffer, bytes_avail); | |||
73 | mpa_buf_ptr += bytes_avail; | |||
74 | + av_frame_free(&frame); | |||
75 | return (0); | |||
76 | } | |||
77 | } //bytes availabe from last call? | |||
78 | @@ -893,10 +901,15 @@ static int tc_audio_encode_ffmpeg(char * | |||
79 | //---------------------------------------------------- | |||
80 | ||||
81 | while (in_size >= mpa_bytes_pf) { | |||
82 | + av_frame_unref(frame); | |||
83 | + frame->nb_samples = mpa_ctx.frame_size; | |||
84 | + avcodec_fill_audio_frame(frame, mpa_ctx.channels, mpa_ctx.sample_fmt, (const uint8_t *)in_buf, mpa_bytes_pf, 1); | |||
85 | + avpkt.data = output; | |||
86 | + avpkt.size = OUTPUT_SIZE; | |||
87 | TC_LOCK_LIBAVCODEC; | |||
88 | - out_size = avcodec_encode_audio(&mpa_ctx, (unsigned char *)output, | |||
89 | - OUTPUT_SIZE, (short *)in_buf); | |||
90 | + out_size = avcodec_encode_audio2(&mpa_ctx, &avpkt, frame, &got_packet); | |||
91 | TC_UNLOCK_LIBAVCODEC; | |||
92 | + out_size = avpkt.size; | |||
93 | ||||
94 | tc_audio_write(output, out_size, avifile); | |||
95 | ||||
96 | @@ -904,6 +917,8 @@ static int tc_audio_encode_ffmpeg(char * | |||
97 | in_buf += mpa_bytes_pf; | |||
98 | } | |||
99 | ||||
100 | + av_frame_free(&frame); | |||
101 | + | |||
102 | //-- hold rest of bytes in mpa-buffer -- | |||
103 | //-------------------------------------- | |||
104 | if (in_size > 0) { |
$NetBSD: patch-filter_filter__resample.c,v 1.1 2019/12/29 10:23:53 markd Exp $
Fixes building against FFmpeg version >= 4.0.0 (gentoo patch).
--- filter/filter_resample.c.orig 2011-11-19 16:50:27.000000000 +0000
+++ filter/filter_resample.c
@@ -37,6 +37,7 @@
#include "libtc/optstr.h"
#include "libtc/tcavcodec.h"
#include "libtc/tcmodule-plugin.h"
+#include <libavresample/avresample.h>
typedef struct {
@@ -45,7 +46,7 @@ typedef struct {
int bytes_per_sample;
- ReSampleContext *resample_ctx;
+ AVAudioResampleContext *resample_ctx;
} ResamplePrivateData;
static const char resample_help[] = ""