summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-04-28 00:41:39 +0000
committerjstebbins <[email protected]>2011-04-28 00:41:39 +0000
commit8b65e3d13fbc73d94b0a5b265da23579382c93bf (patch)
tree245ff942a37f74ff6845f54d192c1901e10c3b7f
parentd845d7d9fd637a91235ed3d0e5c6394c6d8a48e3 (diff)
libhb: don't use deprecated elements of the FFmpeg/Libav API
HandBrake uses many attributes of the FFmpeg API that are were deprecated when we did the last bump. Many of them no longer exist in current FFmpeg/Libav git, or are going to be removed soon. Replaces them with non-deprecated attributes that already exist in the build we currently use. Thanks to Rodeo for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3964 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/decavcodec.c2
-rw-r--r--libhb/encac3.c8
-rw-r--r--libhb/hb.c26
-rw-r--r--libhb/hbffmpeg.h2
-rw-r--r--libhb/stream.c34
5 files changed, 33 insertions, 39 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 9efa3da8f..3279feef4 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1022,7 +1022,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
int codec_id = w->codec_param;
pv->parser = av_parser_init( codec_id );
- pv->context = avcodec_alloc_context2( CODEC_TYPE_VIDEO );
+ pv->context = avcodec_alloc_context2( AVMEDIA_TYPE_VIDEO );
/* we have to wrap ffmpeg's get_buffer to be able to set the pts (?!) */
pv->context->opaque = pv;
diff --git a/libhb/encac3.c b/libhb/encac3.c
index 693e8b02e..d0c27f419 100644
--- a/libhb/encac3.c
+++ b/libhb/encac3.c
@@ -62,21 +62,21 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job )
context = avcodec_alloc_context();
avcodec_get_context_defaults3(context, codec);
- context->channel_layout = CH_LAYOUT_STEREO;
+ context->channel_layout = AV_CH_LAYOUT_STEREO;
switch( audio->config.out.mixdown )
{
case HB_AMIXDOWN_MONO:
- context->channel_layout = CH_LAYOUT_MONO;
+ context->channel_layout = AV_CH_LAYOUT_MONO;
break;
case HB_AMIXDOWN_STEREO:
case HB_AMIXDOWN_DOLBY:
case HB_AMIXDOWN_DOLBYPLII:
- context->channel_layout = CH_LAYOUT_STEREO;
+ context->channel_layout = AV_CH_LAYOUT_STEREO;
break;
case HB_AMIXDOWN_6CH:
- context->channel_layout = CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY;
+ context->channel_layout = AV_CH_LAYOUT_5POINT1;
break;
default:
diff --git a/libhb/hb.c b/libhb/hb.c
index 411e4bd66..c877ae91e 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -154,43 +154,43 @@ int hb_ff_layout_xlat(int64_t ff_channel_layout, int channels)
switch (ff_channel_layout)
{
- case CH_LAYOUT_MONO:
+ case AV_CH_LAYOUT_MONO:
hb_layout = HB_INPUT_CH_LAYOUT_MONO;
break;
- case CH_LAYOUT_STEREO:
+ case AV_CH_LAYOUT_STEREO:
hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
break;
- case CH_LAYOUT_SURROUND:
+ case AV_CH_LAYOUT_SURROUND:
hb_layout = HB_INPUT_CH_LAYOUT_3F;
break;
- case CH_LAYOUT_4POINT0:
+ case AV_CH_LAYOUT_4POINT0:
hb_layout = HB_INPUT_CH_LAYOUT_3F1R;
break;
- case CH_LAYOUT_2_2:
+ case AV_CH_LAYOUT_2_2:
hb_layout = HB_INPUT_CH_LAYOUT_2F2R;
break;
- case CH_LAYOUT_QUAD:
+ case AV_CH_LAYOUT_QUAD:
hb_layout = HB_INPUT_CH_LAYOUT_2F2R;
break;
- case CH_LAYOUT_5POINT0:
+ case AV_CH_LAYOUT_5POINT0:
hb_layout = HB_INPUT_CH_LAYOUT_3F2R;
break;
- case CH_LAYOUT_5POINT1:
+ case AV_CH_LAYOUT_5POINT1:
hb_layout = HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE;
break;
- case CH_LAYOUT_5POINT0_BACK:
+ case AV_CH_LAYOUT_5POINT0_BACK:
hb_layout = HB_INPUT_CH_LAYOUT_3F2R;
break;
- case CH_LAYOUT_5POINT1_BACK:
+ case AV_CH_LAYOUT_5POINT1_BACK:
hb_layout = HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE;
break;
- case CH_LAYOUT_7POINT0:
+ case AV_CH_LAYOUT_7POINT0:
hb_layout = HB_INPUT_CH_LAYOUT_3F4R;
break;
- case CH_LAYOUT_7POINT1:
+ case AV_CH_LAYOUT_7POINT1:
hb_layout = HB_INPUT_CH_LAYOUT_3F4R|HB_INPUT_CH_LAYOUT_HAS_LFE;
break;
- case CH_LAYOUT_STEREO_DOWNMIX:
+ case AV_CH_LAYOUT_STEREO_DOWNMIX:
hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
break;
default:
diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h
index 3c7d1ead6..568eb5340 100644
--- a/libhb/hbffmpeg.h
+++ b/libhb/hbffmpeg.h
@@ -2,9 +2,9 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-#include "libavcodec/opt.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
+#include "libavutil/opt.h"
#include "libswscale/swscale.h"
void hb_avcodec_init(void);
diff --git a/libhb/stream.c b/libhb/stream.c
index 77bdc3c8b..3467b1c97 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -166,7 +166,6 @@ struct hb_stream_s
AVFormatContext *ffmpeg_ic;
AVPacket *ffmpeg_pkt;
- double ffmpeg_tsconv[MAX_STREAMS];
uint8_t ffmpeg_video_id;
struct
@@ -3265,7 +3264,7 @@ static int ffmpeg_open( hb_stream_t *stream, hb_title_t *title )
int i;
for (i = 0; i < ic->nb_streams; ++i )
{
- if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
+ if ( ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
{
break;
}
@@ -3597,7 +3596,7 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream )
int i;
for (i = 0; i < ic->nb_streams; ++i )
{
- if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO &&
+ if ( ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
avcodec_find_decoder( ic->streams[i]->codec->codec_id ) &&
title->video_codec == 0 )
{
@@ -3621,16 +3620,16 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream )
title->video_codec = WORK_DECAVCODECVI;
title->video_codec_param = ffmpeg_codec_param( stream, i );
}
- else if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO &&
+ else if ( ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
avcodec_find_decoder( ic->streams[i]->codec->codec_id ) )
{
add_ffmpeg_audio( title, stream, i );
}
- else if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_SUBTITLE )
+ else if ( ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE )
{
add_ffmpeg_subtitle( title, stream, i );
}
- else if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_ATTACHMENT )
+ else if ( ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_ATTACHMENT )
{
add_ffmpeg_attachment( title, stream, i );
}
@@ -3738,7 +3737,7 @@ static int ffmpeg_is_keyframe( hb_stream_t *stream )
default:
break;
}
- return ( stream->ffmpeg_pkt->flags & PKT_FLAG_KEY );
+ return ( stream->ffmpeg_pkt->flags & AV_PKT_FLAG_KEY );
}
static hb_buffer_t * ffmpeg_read( hb_stream_t *stream )
@@ -3758,7 +3757,7 @@ static hb_buffer_t * ffmpeg_read( hb_stream_t *stream )
// XXX the following conditional is to handle avi files that
// use M$ 'packed b-frames' and occasionally have negative
// sizes for the null frames these require.
- if ( err != AVERROR_NOMEM || stream->ffmpeg_pkt->size >= 0 )
+ if ( err != AVERROR(ENOMEM) || stream->ffmpeg_pkt->size >= 0 )
// eof
return NULL;
}
@@ -3806,15 +3805,10 @@ static hb_buffer_t * ffmpeg_read( hb_stream_t *stream )
}
buf->id = stream->ffmpeg_pkt->stream_index;
- // if we haven't done it already, compute a conversion factor to go
- // from the ffmpeg timebase for the stream to HB's 90KHz timebase.
- double tsconv = stream->ffmpeg_tsconv[stream->ffmpeg_pkt->stream_index];
- if ( ! tsconv )
- {
- AVStream *s = stream->ffmpeg_ic->streams[stream->ffmpeg_pkt->stream_index];
- tsconv = 90000. * (double)s->time_base.num / (double)s->time_base.den;
- stream->ffmpeg_tsconv[stream->ffmpeg_pkt->stream_index] = tsconv;
- }
+ // compute a conversion factor to go from the ffmpeg
+ // timebase for the stream to HB's 90kHz timebase.
+ AVStream *s = stream->ffmpeg_ic->streams[stream->ffmpeg_pkt->stream_index];
+ double tsconv = 90000. * (double)s->time_base.num / (double)s->time_base.den;
buf->start = av_to_hb_pts( stream->ffmpeg_pkt->pts, tsconv );
buf->renderOffset = av_to_hb_pts( stream->ffmpeg_pkt->dts, tsconv );
@@ -3849,15 +3843,15 @@ static hb_buffer_t * ffmpeg_read( hb_stream_t *stream )
codec_type = stream->ffmpeg_ic->streams[stream->ffmpeg_pkt->stream_index]->codec->codec_type;
switch ( codec_type )
{
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
buf->type = VIDEO_BUF;
break;
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
buf->type = AUDIO_BUF;
break;
- case CODEC_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_SUBTITLE:
buf->type = SUBTITLE_BUF;
break;