Update for newer FFmpeg API.

ok sebastia@
This commit is contained in:
brad 2013-01-20 12:52:34 +00:00
parent 1731ebf411
commit 0ac92be1f4
2 changed files with 89 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.22 2012/08/23 17:42:27 sthen Exp $
# $OpenBSD: Makefile,v 1.23 2013/01/20 12:52:34 brad Exp $
COMMENT-main= IAX client library
COMMENT-tcl= IAX client library, tcl bindings
@ -6,11 +6,11 @@ COMMENT-iaxcomm=IAX softphone
DISTNAME= iaxclient-2.1beta3
PKGNAME-main= ${DISTNAME}
REVISION-main= 9
REVISION-main= 10
PKGNAME-tcl= ${DISTNAME:S/iaxclient/iaxclient-tcl/}
REVISION-tcl= 12
REVISION-tcl= 13
PKGNAME-iaxcomm= iaxcomm-1.1.0
REVISION-iaxcomm= 13
REVISION-iaxcomm= 14
CATEGORIES= telephony
USE_LIBTOOL= Yes
@ -30,12 +30,11 @@ PERMIT_DISTFILES_FTP= Yes
MULTI_PACKAGES= -main -tcl -iaxcomm
MODULES= devel/gettext x11/tk
cWANTLIB += avcodec avutil gsm m mp3lame ogg orc-0.4 ossaudio portaudio
cWANTLIB += pthread schroedinger-1.0 speex speexdsp sndio theora
cWANTLIB += theoradec theoraenc vidcap vorbis vorbisenc vpx x264
cWANTLIB += xvidcore z
cWANTLIB += avcodec gsm m ogg orc-0.4 ossaudio portaudio pthread speex
cWANTLIB += speexdsp sndio theora vidcap z
WANTLIB-main += c ${cWANTLIB}
WANTLIB-main += avutil c mp3lame schroedinger-1.0 theoradec theoraenc vorbis
WANTLIB-main += vorbisenc vpx x264 ${cWANTLIB}
WANTLIB-tcl += GL X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes
WANTLIB-tcl += Xi Xinerama Xrandr Xrender Xxf86vm atk-1.0 c cairo
@ -61,7 +60,7 @@ BUILD_DEPENDS= ${MODTK_BUILD_DEPENDS}
LIB_DEPENDS= audio/gsm \
audio/portaudio-svn \
audio/speex \
graphics/ffmpeg \
graphics/ffmpeg>=20121026 \
graphics/libvidcap
LIB_DEPENDS-tcl=${LIB_DEPENDS} \

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-lib_codec_ffmpeg_c,v 1.2 2012/04/30 09:48:21 sebastia Exp $
$OpenBSD: patch-lib_codec_ffmpeg_c,v 1.3 2013/01/20 12:52:35 brad Exp $
Update for newer FFmpeg API.
--- lib/codec_ffmpeg.c.orig Mon Apr 7 12:05:42 2008
+++ lib/codec_ffmpeg.c Sat Apr 28 23:31:52 2012
+++ lib/codec_ffmpeg.c Fri Jan 18 21:21:18 2013
@@ -23,11 +23,7 @@
#include "codec_ffmpeg.h"
#include "iaxclient_lib.h"
@ -50,13 +50,87 @@ Update for newer FFmpeg API.
if ( bytes_decoded < 0 )
{
fprintf(stderr,
@@ -523,9 +527,6 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
e->avctx->gop_size = framerate * 3;
@@ -441,6 +445,7 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
{
struct encoder_ctx *e;
struct decoder_ctx *d;
+ AVDictionary *opts = NULL;
AVCodec *codec;
int ff_enc_id, ff_dec_id;
char *name;
@@ -454,7 +459,6 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
return NULL;
}
- avcodec_init();
avcodec_register_all();
c->format = format;
@@ -524,9 +528,6 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
e->avctx->pix_fmt = PIX_FMT_YUV420P;
e->avctx->has_b_frames = 0;
-
- e->avctx->mb_qmin = e->avctx->qmin = 10;
- e->avctx->mb_qmax = e->avctx->qmax = 10;
-
e->avctx->lmin = 2 * FF_QP2LAMBDA;
e->avctx->lmax = 10 * FF_QP2LAMBDA;
e->avctx->global_quality = FF_QP2LAMBDA * 2;
@@ -581,9 +582,9 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
e->avctx->rtp_payload_size = fragsize;
e->avctx->flags |=
CODEC_FLAG_TRUNCATED |
- CODEC_FLAG_H263P_SLICE_STRUCT |
CODEC_FLAG2_STRICT_GOP |
CODEC_FLAG2_LOCAL_HEADER;
+ av_dict_set(&opts, "structured_slices", "1", 0);
e->avctx->rtp_callback = encode_rtp_callback;
d->avctx->flags |= CODEC_FLAG_TRUNCATED;
}
@@ -596,10 +597,9 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
e->avctx->rtp_callback = encode_rtp_callback;
e->avctx->flags |=
CODEC_FLAG_TRUNCATED |
- CODEC_FLAG_H263P_SLICE_STRUCT |
CODEC_FLAG2_STRICT_GOP |
CODEC_FLAG2_LOCAL_HEADER;
-
+ av_dict_set(&opts, "structured_slices", "1", 0);
d->avctx->flags |= CODEC_FLAG_TRUNCATED;
break;
@@ -625,7 +625,7 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
/* e->avctx->flags2 |= CODEC_FLAG2_8X8DCT; */
/* Access Unit Delimiters */
- e->avctx->flags2 |= CODEC_FLAG2_AUD;
+ av_dict_set(&opts, "aud", "1", 0);
/* Allow b-frames to be used as reference */
/* e->avctx->flags2 |= CODEC_FLAG2_BPYRAMID; */
@@ -686,7 +686,7 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
goto bail;
}
- if (avcodec_open(e->avctx, codec))
+ if (avcodec_open2(e->avctx, codec, &opts))
{
iaxci_usermsg(IAXC_TEXT_TYPE_ERROR,
"codec_ffmpeg: cannot open encoder %s\n", name);
@@ -701,7 +701,7 @@ struct iaxc_video_codec *codec_video_ffmpeg_new(int fo
ff_dec_id);
goto bail;
}
- if (avcodec_open(d->avctx, codec))
+ if (avcodec_open2(d->avctx, codec, NULL))
{
iaxci_usermsg(IAXC_TEXT_TYPE_ERROR,
"codec_ffmpeg: cannot open decoder %s\n", name);
@@ -733,7 +733,6 @@ int codec_video_ffmpeg_check_codec(int format)
/* These functions are idempotent, so it is okay that we
* may call them elsewhere at a different time.
*/
- avcodec_init();
avcodec_register_all();
codec_id = map_iaxc_codec_to_avcodec(format);