- Pull in some bits to deal with newer FFmpeg API. While testing I found

transcode was already broken as is due to it relying on certain functionality
with presets which is no longer relevant for more modern FFmpeg. Searching
via Google showed the same bug being reported with Debian, Gentoo and Arch.
They have eliminted the use of presets but that just exposed another bug.
So this builds with newer FFmpeg but it is essentially just as broken as
before. If anyone wants to take a look at this and figure out why it is
crashing go ahead.
- Merge the quicktime FLAVOR into the main port / package. IMO it doesn't
make sense to have an app like this that cannot work with the MP4 container

FFmpeg bits taken from FreeBSD and Debian packages.

ok ajacoutot@
This commit is contained in:
brad 2014-05-05 11:51:37 +00:00
parent e2d6ffc1b4
commit e9f38dfab1
10 changed files with 249 additions and 89 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.56 2013/03/21 08:46:33 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.57 2014/05/05 11:51:37 brad Exp $
SHARED_ONLY= Yes
COMMENT= video stream processing tools
DISTNAME= transcode-1.1.7
REVISION= 3
REVISION= 4
CATEGORIES= multimedia
MASTER_SITES= http://cdn.bitbucket.org/france/transcode-tcforge/downloads/
EXTRACT_SUFX= .tar.bz2
@ -15,18 +15,18 @@ HOMEPAGE= http://www.transcoding.org/
# GPLv2
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += ICE SDL SM X11 Xau Xaw Xdmcp Xext Xmu Xpm Xt Xv a52
WANTLIB += avcodec avformat avutil bz2 c crypto dv dvdread freetype
WANTLIB += gsm jpeg m mp3lame mpeg2 mpeg2convert ogg orc-0.4 postproc
WANTLIB += pthread pthread-stubs schroedinger-1.0 sndio speex ssl
WANTLIB += theora theoradec theoraenc usbhid vorbis vorbisenc
WANTLIB += vorbisfile vpx x264 xcb xml2 z
WANTLIB += ICE SDL SM X11 Xau Xaw Xdmcp Xext Xmu Xpm Xt Xv a52 avcodec
WANTLIB += avformat avutil bz2 c crypto dv dvdcss dvdread freetype gsm jpeg
WANTLIB += m mp3lame mpeg2 mpeg2convert ogg opus orc-0.4 postproc pthread
WANTLIB += pthread-stubs quicktime schroedinger-1.0 sndio speex ssl theora
WANTLIB += theoradec theoraenc usbhid vorbis vorbisenc vorbisfile vpx x264
WANTLIB += xcb xml2 z
# xvidcore is dlopen()d so check-lib-depends shows it as Extra, however we
# want to track changes to the ABI to ensure transcode is updated if needed.
WANTLIB += xvidcore
FLAVORS= lzo mjpegtools quicktime altivec
FLAVORS= lzo mjpegtools altivec
FLAVOR?=
.if ${MACHINE_ARCH} == "i386"
@ -35,7 +35,7 @@ PKG_ARGS+= -Di386=1
PKG_ARGS+= -Di386=0
.endif
MODULES= converters/libiconv
MODULES= devel/gettext
AUTOCONF_VERSION= 2.68
AUTOMAKE_VERSION= 1.11
@ -50,6 +50,7 @@ LIB_DEPENDS= audio/lame \
graphics/jpeg \
graphics/libmpeg2 \
multimedia/libdv \
multimedia/libquicktime \
multimedia/libtheora \
multimedia/x264 \
multimedia/xvidcore \
@ -81,6 +82,7 @@ CONFIGURE_ARGS+=--enable-a52 \
--enable-libmpeg2 \
--enable-libmpeg2convert \
--enable-libpostproc \
--enable-libquicktime \
--enable-libxml2 \
--enable-netstream \
--enable-ogg \
@ -105,7 +107,7 @@ PKG_ARGS+= -Dlzo=0
.if ${FLAVOR:Mmjpegtools}
CONFIGURE_ARGS+=--enable-mjpegtools
WANTLIB += mjpegutils-1.9
WANTLIB += mjpegutils
LIB_DEPENDS+= multimedia/mjpegtools
RUN_DEPENDS+= multimedia/mjpegtools
PKG_ARGS+= -Dmjpegtools=1
@ -113,16 +115,6 @@ PKG_ARGS+= -Dmjpegtools=1
PKG_ARGS+= -Dmjpegtools=0
.endif
.if ${FLAVOR:Mquicktime}
CONFIGURE_ARGS+=--enable-libquicktime
LIB_DEPENDS+= multimedia/libquicktime
WANTLIB += quicktime
MODULES+= devel/gettext
PKG_ARGS+= -Dquicktime=1
.else
PKG_ARGS+= -Dquicktime=0
.endif
.if ${FLAVOR:Maltivec}
ONLY_FOR_ARCHS= powerpc
CONFIGURE_ARGS+=--enable-altivec

View File

@ -1,9 +1,18 @@
$OpenBSD: patch-export_aud_aux_c,v 1.6 2013/01/26 12:47:44 brad Exp $
$OpenBSD: patch-export_aud_aux_c,v 1.7 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- export/aud_aux.c.orig Sat Nov 19 11:50:27 2011
+++ export/aud_aux.c Fri Jan 18 22:28:02 2013
+++ export/aud_aux.c Sat Apr 26 00:57:34 2014
@@ -346,7 +346,7 @@ static int tc_audio_init_ffmpeg(vob_t *vob, int o_code
//-- set parameters (bitrate, channels and sample-rate) --
//--------------------------------------------------------
- avcodec_get_context_defaults(&mpa_ctx);
+ avcodec_get_context_defaults3(&mpa_ctx, mpa_codec);
#if LIBAVCODEC_VERSION_MAJOR < 53
mpa_ctx.codec_type = CODEC_TYPE_AUDIO;
#else
@@ -359,7 +359,7 @@ static int tc_audio_init_ffmpeg(vob_t *vob, int o_code
//-- open codec --
//----------------

View File

@ -1,10 +1,18 @@
$OpenBSD: patch-export_export_ffmpeg_c,v 1.7 2013/01/26 12:47:44 brad Exp $
$OpenBSD: patch-export_export_ffmpeg_c,v 1.8 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- export/export_ffmpeg.c.orig Sat Nov 19 11:50:27 2011
+++ export/export_ffmpeg.c Fri Jan 18 22:50:29 2013
@@ -180,7 +180,7 @@ static char *tc_strchrnul(const char *s, int c) {
+++ export/export_ffmpeg.c Mon May 5 02:55:13 2014
@@ -122,6 +122,7 @@ static uint8_t *img_buffer = NULL;
static AVFrame *lavc_convert_frame = NULL;
static AVCodec *lavc_venc_codec = NULL;
+static AVDictionary *lavc_venc_opts = NULL;
static AVFrame *lavc_venc_frame = NULL;
static AVCodecContext *lavc_venc_context;
static avi_t *avifile = NULL;
@@ -180,7 +181,7 @@ static char *tc_strchrnul(const char *s, int c) {
/* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */
@ -13,15 +21,43 @@ Update for newer FFmpeg API.
#include <libavutil/avstring.h>
#include <libswscale/swscale.h>
@@ -362,6 +362,7 @@ static int opt_preset(const char *opt, const char *arg
MOD_init
{
char *user_codec_string = NULL;
+ AVDictionary *opts = NULL;
@@ -239,6 +240,14 @@ static void opt_subtitle_codec(const char *arg)
opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
}
if (param->flag == TC_VIDEO) {
size_t fsize = 0;
@@ -470,7 +471,6 @@ MOD_init
+static int av_set_string3_fallback(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
+{
+ const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);
+ if (o_out)
+ *o_out = o;
+ return av_opt_set(obj, name, val, 0);
+}
+
static
int opt_default(const char *opt, const char *arg){
int type;
@@ -249,9 +258,9 @@ int opt_default(const char *opt, const char *arg){
for(type=0; type<AVMEDIA_TYPE_NB && ret>= 0; type++){
/* GLUE: +if */
if (type == AVMEDIA_TYPE_VIDEO) {
- const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]);
+ const AVOption *o2 = av_opt_find(avcodec_opts[0], opt, NULL, opt_types[type], 0);
if(o2)
- ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o);
+ ret = av_set_string3_fallback(avcodec_opts[type], opt, arg, 1, &o);
/* GLUE: +if */
}
}
@@ -266,7 +275,7 @@ int opt_default(const char *opt, const char *arg){
if(opt[0] == 'a')
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o);
else */ if(opt[0] == 'v')
- ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o);
+ ret = av_set_string3_fallback(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o);
/* GLUE: disabling
else if(opt[0] == 's')
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o);
@@ -470,7 +479,6 @@ MOD_init
}
TC_LOCK_LIBAVCODEC;
@ -29,73 +65,116 @@ Update for newer FFmpeg API.
avcodec_register_all();
TC_UNLOCK_LIBAVCODEC;
@@ -598,7 +598,6 @@ MOD_init
lavc_param_rc_max_rate = 1150;
lavc_param_rc_buffer_size = 40 * 8;
lavc_param_rc_buffer_aggressivity = 99;
- lavc_param_scan_offset = 0;
@@ -486,7 +494,7 @@ MOD_init
codec->name, codec->fourCC, codec->comments);
}
break;
- lavc_venc_context = avcodec_alloc_context();
+ lavc_venc_context = avcodec_alloc_context3(lavc_venc_codec);
lavc_venc_frame = avcodec_alloc_frame();
@@ -634,7 +633,7 @@ MOD_init
lavc_convert_frame= avcodec_alloc_frame();
@@ -634,7 +642,7 @@ MOD_init
lavc_param_rc_max_rate = 2516;
lavc_param_rc_buffer_size = 224 * 8;
lavc_param_rc_buffer_aggressivity = 99;
- lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
+ av_dict_set(&opts, "scan_offset", "1", 0);
+ lavc_param_scan_offset = 1;
break;
@@ -674,7 +673,7 @@ MOD_init
@@ -674,7 +682,7 @@ MOD_init
lavc_param_rc_buffer_size = 224 * 8;
lavc_param_rc_buffer_aggressivity = 99;
- lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
+ av_dict_set(&opts, "scan_offset", "1", 0);
+ lavc_param_scan_offset = 1;
break;
@@ -1065,15 +1064,20 @@ MOD_init
@@ -838,8 +846,13 @@ MOD_init
lavc_venc_context->rc_strategy = lavc_param_vrc_strategy;
lavc_venc_context->b_frame_strategy = lavc_param_vb_strategy;
lavc_venc_context->b_quant_offset = lavc_param_vb_qoffset;
- lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold;
- lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold;
+
+ char buf[1024];
+#define set_dict_opt(val, opt) \
+ snprintf(buf, sizeof(buf), "%i", val); \
+ av_dict_set(&lavc_venc_opts, opt, buf, 0)
+ set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold");
+ set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold");
lavc_venc_context->rtp_payload_size = lavc_param_packet_size;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
if (lavc_param_packet_size)
@@ -870,7 +883,7 @@ MOD_init
lavc_venc_context->context_model = lavc_param_context;
lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold;
lavc_venc_context->noise_reduction = lavc_param_noise_reduction;
- lavc_venc_context->inter_threshold = lavc_param_inter_threshold;
+ set_dict_opt(lavc_param_inter_threshold, "inter_threshold");
lavc_venc_context->intra_dc_precision = lavc_param_intra_dc_precision;
lavc_venc_context->skip_top = lavc_param_skip_top;
lavc_venc_context->skip_bottom = lavc_param_skip_bottom;
@@ -887,7 +900,7 @@ MOD_init
lavc_venc_context->thread_count);
}
- avcodec_thread_init(lavc_venc_context, lavc_param_threads);
+ lavc_venc_context->thread_count = lavc_param_threads;
if (lavc_param_intra_matrix) {
char *tmp;
@@ -1065,15 +1078,12 @@ MOD_init
lavc_venc_context->flags |= lavc_param_closedgop;
lavc_venc_context->flags |= lavc_param_trunc;
lavc_venc_context->flags |= lavc_param_aic;
- lavc_venc_context->flags |= lavc_param_umv;
+ if (lavc_param_umv)
+ av_dict_set(&opts, "umv", "1", 0);
lavc_venc_context->flags |= lavc_param_v4mv;
- lavc_venc_context->flags |= lavc_param_data_partitioning;
+ if (lavc_param_data_partitioning)
+ av_dict_set(&opts, "data_partitioning", "1", 0);
lavc_venc_context->flags |= lavc_param_cbp;
- lavc_venc_context->flags |= lavc_param_cbp;
+ if(lavc_param_cbp)
+ av_dict_set(&lavc_venc_opts, "mpv_flags", "+cbp_rd", 0);
lavc_venc_context->flags |= lavc_param_mv0;
lavc_venc_context->flags |= lavc_param_qp_rd;
- lavc_venc_context->flags |= lavc_param_qp_rd;
- lavc_venc_context->flags |= lavc_param_scan_offset;
- lavc_venc_context->flags |= lavc_param_ss;
- lavc_venc_context->flags |= lavc_param_alt;
+ if (lavc_param_scan_offset)
+ av_dict_set(&opts, "scan_offset", "1", 0);
+ if (lavc_param_ss)
+ av_dict_set(&opts, "structured_slices", "1", 0);
+ if (lavc_param_alt)
+ av_dict_set(&opts, "alternate_scan", "1", 0);
+ if(lavc_param_qp_rd)
+ av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0);
lavc_venc_context->flags |= lavc_param_ilme;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
lavc_venc_context->flags |= lavc_param_trell;
@@ -1082,7 +1086,7 @@ MOD_init
#endif
@@ -1241,20 +1251,39 @@ MOD_init
}
}
if (lavc_param_gray)
- lavc_venc_context->flags |= CODEC_FLAG_GRAY;
+ av_dict_set(&opts, "gray", "1", 0);
if (lavc_param_normalize_aqp)
lavc_venc_context->flags |= CODEC_FLAG_NORMALIZE_AQP;
+ if (lavc_param_scan_offset) {
+ av_dict_set(&lavc_venc_opts, "scan_offset", "1", 0);
+ }
@@ -1245,14 +1249,14 @@ MOD_init
+ if (lavc_param_ss) {
+ av_dict_set(&lavc_venc_opts, "structured_slices", "1", 0);
+ }
+
+ if (lavc_param_alt) {
+ av_dict_set(&lavc_venc_opts, "alternate_scan", "1", 0);
+ }
+
+ if (lavc_param_umv) {
+ av_dict_set(&lavc_venc_opts, "umv", "1", 0);
+ }
+
+ if (lavc_param_data_partitioning) {
+ av_dict_set(&lavc_venc_opts, "vdpart", "1", 0);
+ }
+
//-- open codec --
//----------------
TC_LOCK_LIBAVCODEC;
- ret = avcodec_open(lavc_venc_context, lavc_venc_codec);
+ ret = avcodec_open2(lavc_venc_context, lavc_venc_codec, &opts);
+ ret = avcodec_open2(lavc_venc_context, lavc_venc_codec, &lavc_venc_opts);
TC_UNLOCK_LIBAVCODEC;
if (ret < 0) {
tc_log_warn(MOD_NAME, "could not open FFMPEG codec");
@ -103,7 +182,10 @@ Update for newer FFmpeg API.
}
- if (lavc_venc_context->codec->encode == NULL) {
+ if (lavc_venc_context->codec->encode2 == NULL) {
+ if (av_codec_is_encoder(lavc_venc_context->codec) == 0) {
tc_log_warn(MOD_NAME, "could not open FFMPEG codec "
"(lavc_venc_context->codec->encode == NULL)");
- "(lavc_venc_context->codec->encode == NULL)");
+ "(av_codec_is_encoder(lavc_venc_context->codec) == 0)");
return TC_EXPORT_ERROR;
}

View File

@ -1,9 +1,18 @@
$OpenBSD: patch-export_ffmpeg_cfg_c,v 1.2 2013/01/26 12:47:44 brad Exp $
$OpenBSD: patch-export_ffmpeg_cfg_c,v 1.3 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- export/ffmpeg_cfg.c.orig Sat Nov 19 11:50:27 2011
+++ export/ffmpeg_cfg.c Fri Jan 18 22:38:18 2013
+++ export/ffmpeg_cfg.c Mon May 5 00:59:06 2014
@@ -126,7 +126,7 @@ int lavc_param_gmc = 0;
//int lavc_param_atag = 0;
//int lavc_param_abitrate = 224;
-char *lavc_param_video_preset = "medium";
+char *lavc_param_video_preset = NULL;
char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg";
TCConfigEntry lavcopts_conf[]={
@@ -160,9 +160,9 @@ TCConfigEntry lavcopts_conf[]={
{"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
{"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
@ -12,11 +21,11 @@ Update for newer FFmpeg API.
+ {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_INT, 0, 0, 1},
// {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0},
- {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
+ {"gray", &lavc_param_gray, TCCONF_TYPE_INT, 0, 0, 1},
+ {"gray", &lavc_param_gray, TCCONF_TYPE_INT, 0, 0, CODEC_FLAG_GRAY},
{"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1},
{"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
{"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0},
@@ -211,7 +211,7 @@ TCConfigEntry lavcopts_conf[]={
@@ -211,21 +211,21 @@ TCConfigEntry lavcopts_conf[]={
#else
{"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED},
#endif
@ -25,9 +34,15 @@ Update for newer FFmpeg API.
{"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
{"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
{"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
@@ -223,9 +223,9 @@ TCConfigEntry lavcopts_conf[]={
{"context", &lavc_param_context, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
{"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
{"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
- {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD},
+ {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1},
{"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0},
{"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
{"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD},
- {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD},
+ {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1},
{"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16},
- {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT},
- {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET},
@ -38,3 +53,11 @@ Update for newer FFmpeg API.
{"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME},
{"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
{"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
@@ -237,7 +237,6 @@ TCConfigEntry lavcopts_conf[]={
{"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
{"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
{"fps_code", &lavc_param_fps_code, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9},
- {"vpre", &lavc_param_video_preset, TCCONF_TYPE_STRING, 0, 0, 0},
{"ffmpeg_datadir", &lavc_param_ffmpeg_datadir, TCCONF_TYPE_STRING, 0, 0, 0},
{NULL, NULL, 0, 0, 0, 0}
};

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-import_decode_lavc_c,v 1.4 2013/01/26 12:47:44 brad Exp $
$OpenBSD: patch-import_decode_lavc_c,v 1.5 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- import/decode_lavc.c.orig Sat Nov 19 11:50:27 2011
+++ import/decode_lavc.c Fri Jan 18 22:01:06 2013
+++ import/decode_lavc.c Mon May 5 02:31:48 2014
@@ -120,6 +120,7 @@ void decode_lavc(decode_t *decode)
char *yuv2rgb_buffer = NULL;
AVCodec *lavc_dec_codec = NULL;
@ -12,7 +12,24 @@ Update for newer FFmpeg API.
int x_dim = 0, y_dim = 0;
int pix_fmt, frame_size = 0, bpp = 8;
struct ffmpeg_codec *codec;
@@ -177,16 +178,11 @@ void decode_lavc(decode_t *decode)
@@ -128,7 +129,7 @@ void decode_lavc(decode_t *decode)
char *mp4_ptr=NULL;
int flush = 0;
int mp4_size=0;
- int buf_len=0;
+ unsigned int buf_len=0;
int run=0;
// decoder
@@ -170,23 +171,18 @@ void decode_lavc(decode_t *decode)
// Set these to the expected values so that ffmpeg's decoder can
// properly detect interlaced input.
- lavc_dec_context = avcodec_alloc_context();
+ lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec);
if (lavc_dec_context == NULL) {
tc_log_error(__FILE__, "Could not allocate enough memory.");
goto decoder_error;
}
lavc_dec_context->width = x_dim;
lavc_dec_context->height = y_dim;

View File

@ -1,6 +1,9 @@
$OpenBSD: patch-import_import_ffmpeg_c,v 1.3 2013/01/19 08:42:35 brad Exp $
$OpenBSD: patch-import_import_ffmpeg_c,v 1.4 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- import/import_ffmpeg.c.orig Sat Nov 19 11:50:27 2011
+++ import/import_ffmpeg.c Fri Jan 18 22:02:05 2013
+++ import/import_ffmpeg.c Fri Apr 25 22:30:34 2014
@@ -225,6 +225,7 @@ MOD_open {
int extra_data_size = 0;
long sret;
@ -9,6 +12,15 @@ $OpenBSD: patch-import_import_ffmpeg_c,v 1.3 2013/01/19 08:42:35 brad Exp $
if (param->flag == TC_VIDEO) {
@@ -302,7 +303,7 @@ do_avi:
// Set these to the expected values so that ffmpeg's decoder can
// properly detect interlaced input.
- lavc_dec_context = avcodec_alloc_context();
+ lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec);
if (lavc_dec_context == NULL) {
tc_log_error(MOD_NAME, "Could not allocate enough memory.");
return TC_IMPORT_ERROR;
@@ -311,11 +312,7 @@ do_avi:
lavc_dec_context->height = y_dim;

View File

@ -1,9 +1,20 @@
$OpenBSD: patch-import_probe_ffmpeg_c,v 1.2 2013/01/26 12:47:44 brad Exp $
$OpenBSD: patch-import_probe_ffmpeg_c,v 1.3 2014/05/05 11:51:37 brad Exp $
Update for newer FFmpeg API.
--- import/probe_ffmpeg.c.orig Sat Nov 19 11:50:27 2011
+++ import/probe_ffmpeg.c Fri Jan 18 19:58:49 2013
+++ import/probe_ffmpeg.c Mon May 5 02:49:34 2014
@@ -51,8 +51,8 @@ static void translate_info(const AVFormatContext *ctx,
info->bitrate = st->codec->bit_rate / 1000;
info->width = st->codec->width;
info->height = st->codec->height;
- if (st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0) {
- info->fps = av_q2d(st->r_frame_rate);
+ if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) {
+ info->fps = av_q2d(st->avg_frame_rate);
} else {
/* watch out here */
info->fps = 1.0/av_q2d(st->codec->time_base);
@@ -99,8 +99,8 @@ void probe_ffmpeg(info_t *ipipe)
TC_INIT_LIBAVCODEC;
@ -15,3 +26,21 @@ Update for newer FFmpeg API.
if (ret != 0) {
tc_log_error(__FILE__, "unable to open '%s'"
" (libavformat failure)",
@@ -109,7 +109,7 @@ void probe_ffmpeg(info_t *ipipe)
return;
}
- ret = av_find_stream_info(lavf_dmx_context);
+ ret = avformat_find_stream_info(lavf_dmx_context, NULL);
if (ret < 0) {
tc_log_error(__FILE__, "unable to fetch informations from '%s'"
" (libavformat failure)",
@@ -120,7 +120,7 @@ void probe_ffmpeg(info_t *ipipe)
translate_info(lavf_dmx_context, ipipe->probe_info);
- av_close_input_file(lavf_dmx_context);
+ avformat_close_input(&lavf_dmx_context);
return;
}

View File

@ -15,9 +15,6 @@ There are a few FLAVORS that add functionality to transcode:
mjpegtools: adds video encoding with mpeg2enc and audio
encoding with mp2enc from the mjpegtools package.
also adds the ability to import YUV4MPEG streams.
quicktime: adds the ability to import and export using
the libquicktime API, thus it adds the ability to
import and export QuickTime-compatible .mov files.
altivec: uses altivec vector unit for a huge speed-up.
Only works on powerpc platform with altivec hardware support.
Altivec is present on all PowerPC G4 processors.

View File

@ -1,3 +0,0 @@
@comment $OpenBSD: PFRAG.quicktime,v 1.4 2013/01/19 08:42:35 brad Exp $
lib/transcode/export_mov.so
lib/transcode/import_mov.so

View File

@ -1,8 +1,8 @@
@comment $OpenBSD: PLIST,v 1.7 2013/01/19 08:42:35 brad Exp $
@comment $OpenBSD: PLIST,v 1.8 2014/05/05 11:51:37 brad Exp $
@pkgpath multimedia/transcode,quicktime
%%i386%%
%%lzo%%
%%mjpegtools%%
%%quicktime%%
@bin bin/avifix
@bin bin/aviindex
@bin bin/avimerge
@ -29,6 +29,7 @@ lib/transcode/export_dvraw.so
lib/transcode/export_ffmpeg.so
lib/transcode/export_jpg.so
lib/transcode/export_lame.so
lib/transcode/export_mov.so
lib/transcode/export_mp2.so
lib/transcode/export_null.so
lib/transcode/export_ogg.so
@ -103,6 +104,7 @@ lib/transcode/import_dv.so
lib/transcode/import_dvd.so
lib/transcode/import_ffmpeg.so
lib/transcode/import_framegen.so
lib/transcode/import_mov.so
lib/transcode/import_mp3.so
lib/transcode/import_mpeg2.so
lib/transcode/import_mplayer.so