ffmpeg: switch to 0.11.1
This commit is contained in:
parent
bef63a4442
commit
14b654326d
@ -224,14 +224,14 @@ if $(TARGET_ARCH) = x86 {
|
||||
local ffmpegBaseURL = $(baseURL)/lib ;
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-x86-gcc4-2012-03-28.zip ;
|
||||
HAIKU_FFMPEG_FILE = ffmpeg-0.11.1-x86-gcc4-2012-08-07.zip ;
|
||||
HAIKU_SPEEX_FILE = speex-1.2rc1-x86-gcc4-2012-03-12.zip ;
|
||||
HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-x86-gcc4-2012-03-12.zip ;
|
||||
HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-x86-gcc4-2012-03-12.zip ;
|
||||
HAIKU_LIBOGG_FILE = libogg-1.3.0-x86-gcc4-2012-03-12.zip ;
|
||||
HAIKU_LIBVPX_FILE = libvpx-1.0.0-x86-gcc4-2012-03-14.zip ;
|
||||
} else {
|
||||
HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-x86-gcc2-2012-03-28.zip ;
|
||||
HAIKU_FFMPEG_FILE = ffmpeg-0.11.1-x86-gcc2-2012-08-06.zip ;
|
||||
HAIKU_SPEEX_FILE = speex-1.2rc1-x86-gcc2-2012-03-11.zip ;
|
||||
HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-x86-gcc2-2012-03-11.zip ;
|
||||
HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-x86-gcc2-2012-03-11.zip ;
|
||||
|
@ -42,7 +42,7 @@ AVCodecEncoder::AVCodecEncoder(uint32 codecID, int bitRateScale)
|
||||
fBitRateScale(bitRateScale),
|
||||
fCodecID((enum CodecID)codecID),
|
||||
fCodec(NULL),
|
||||
fOwnContext(avcodec_alloc_context()),
|
||||
fOwnContext(avcodec_alloc_context3(NULL)),
|
||||
fContext(fOwnContext),
|
||||
fCodecInitStatus(CODEC_INIT_NEEDED),
|
||||
|
||||
@ -368,19 +368,19 @@ AVCodecEncoder::_Setup()
|
||||
// sample format
|
||||
switch (fInputFormat.u.raw_audio.format) {
|
||||
case media_raw_audio_format::B_AUDIO_FLOAT:
|
||||
fContext->sample_fmt = SAMPLE_FMT_FLT;
|
||||
fContext->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_DOUBLE:
|
||||
fContext->sample_fmt = SAMPLE_FMT_DBL;
|
||||
fContext->sample_fmt = AV_SAMPLE_FMT_DBL;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_INT:
|
||||
fContext->sample_fmt = SAMPLE_FMT_S32;
|
||||
fContext->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_SHORT:
|
||||
fContext->sample_fmt = SAMPLE_FMT_S16;
|
||||
fContext->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_UCHAR:
|
||||
fContext->sample_fmt = SAMPLE_FMT_U8;
|
||||
fContext->sample_fmt = AV_SAMPLE_FMT_U8;
|
||||
break;
|
||||
|
||||
case media_raw_audio_format::B_AUDIO_CHAR:
|
||||
@ -393,28 +393,28 @@ AVCodecEncoder::_Setup()
|
||||
switch (fInputFormat.u.raw_audio.channel_count) {
|
||||
default:
|
||||
case 2:
|
||||
fContext->channel_layout = CH_LAYOUT_STEREO;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
case 1:
|
||||
fContext->channel_layout = CH_LAYOUT_MONO;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case 3:
|
||||
fContext->channel_layout = CH_LAYOUT_SURROUND;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_SURROUND;
|
||||
break;
|
||||
case 4:
|
||||
fContext->channel_layout = CH_LAYOUT_QUAD;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_QUAD;
|
||||
break;
|
||||
case 5:
|
||||
fContext->channel_layout = CH_LAYOUT_5POINT0;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_5POINT0;
|
||||
break;
|
||||
case 6:
|
||||
fContext->channel_layout = CH_LAYOUT_5POINT1;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_5POINT1;
|
||||
break;
|
||||
case 8:
|
||||
fContext->channel_layout = CH_LAYOUT_7POINT1;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_7POINT1;
|
||||
break;
|
||||
case 10:
|
||||
fContext->channel_layout = CH_LAYOUT_7POINT1_WIDE;
|
||||
fContext->channel_layout = AV_CH_LAYOUT_7POINT1_WIDE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -492,7 +492,7 @@ AVCodecEncoder::_OpenCodecIfNeeded()
|
||||
return false;
|
||||
|
||||
// Open the codec
|
||||
int result = avcodec_open(fContext, fCodec);
|
||||
int result = avcodec_open2(fContext, fCodec, NULL);
|
||||
if (result >= 0)
|
||||
fCodecInitStatus = CODEC_INIT_DONE;
|
||||
else
|
||||
|
@ -52,14 +52,14 @@ static const int64 kNoPTSValue = 0x8000000000000000LL;
|
||||
|
||||
|
||||
static uint32
|
||||
avformat_to_beos_format(SampleFormat format)
|
||||
avformat_to_beos_format(AVSampleFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case SAMPLE_FMT_U8: return media_raw_audio_format::B_AUDIO_UCHAR;
|
||||
case SAMPLE_FMT_S16: return media_raw_audio_format::B_AUDIO_SHORT;
|
||||
case SAMPLE_FMT_S32: return media_raw_audio_format::B_AUDIO_INT;
|
||||
case SAMPLE_FMT_FLT: return media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
case SAMPLE_FMT_DBL: return media_raw_audio_format::B_AUDIO_DOUBLE;
|
||||
case AV_SAMPLE_FMT_U8: return media_raw_audio_format::B_AUDIO_UCHAR;
|
||||
case AV_SAMPLE_FMT_S16: return media_raw_audio_format::B_AUDIO_SHORT;
|
||||
case AV_SAMPLE_FMT_S32: return media_raw_audio_format::B_AUDIO_INT;
|
||||
case AV_SAMPLE_FMT_FLT: return media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
case AV_SAMPLE_FMT_DBL: return media_raw_audio_format::B_AUDIO_DOUBLE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -68,7 +68,7 @@ avformat_to_beos_format(SampleFormat format)
|
||||
|
||||
|
||||
static uint32
|
||||
avformat_to_beos_byte_order(SampleFormat format)
|
||||
avformat_to_beos_byte_order(AVSampleFormat format)
|
||||
{
|
||||
// TODO: Huh?
|
||||
return B_MEDIA_HOST_ENDIAN;
|
||||
@ -83,7 +83,7 @@ avdictionary_to_message(AVDictionary* dictionary, BMessage* message)
|
||||
|
||||
AVDictionaryEntry* entry = NULL;
|
||||
while ((entry = av_dict_get(dictionary, "", entry,
|
||||
AV_METADATA_IGNORE_SUFFIX))) {
|
||||
AV_DICT_IGNORE_SUFFIX))) {
|
||||
// convert entry keys into something more meaningful using the names from
|
||||
// id3v2.c
|
||||
if (strcmp(entry->key, "TALB") == 0 || strcmp(entry->key, "TAL") == 0)
|
||||
|
@ -109,12 +109,13 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
|
||||
BAutolock _(fStreamLock);
|
||||
|
||||
fPacket.stream_index = fContext->nb_streams;
|
||||
fStream = av_new_stream(fContext, fPacket.stream_index);
|
||||
fStream = avformat_new_stream(fContext, NULL);
|
||||
|
||||
if (fStream == NULL) {
|
||||
TRACE(" failed to add new stream\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
fStream->id = fPacket.stream_index;
|
||||
|
||||
// TRACE(" fStream->codec: %p\n", fStream->codec);
|
||||
// TODO: This is a hack for now! Use avcodec_find_encoder_by_name()
|
||||
@ -173,19 +174,19 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
|
||||
fStream->codec->channels = format->u.raw_audio.channel_count;
|
||||
switch (format->u.raw_audio.format) {
|
||||
case media_raw_audio_format::B_AUDIO_FLOAT:
|
||||
fStream->codec->sample_fmt = SAMPLE_FMT_FLT;
|
||||
fStream->codec->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_DOUBLE:
|
||||
fStream->codec->sample_fmt = SAMPLE_FMT_DBL;
|
||||
fStream->codec->sample_fmt = AV_SAMPLE_FMT_DBL;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_INT:
|
||||
fStream->codec->sample_fmt = SAMPLE_FMT_S32;
|
||||
fStream->codec->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_SHORT:
|
||||
fStream->codec->sample_fmt = SAMPLE_FMT_S16;
|
||||
fStream->codec->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
break;
|
||||
case media_raw_audio_format::B_AUDIO_UCHAR:
|
||||
fStream->codec->sample_fmt = SAMPLE_FMT_U8;
|
||||
fStream->codec->sample_fmt = AV_SAMPLE_FMT_U8;
|
||||
break;
|
||||
|
||||
case media_raw_audio_format::B_AUDIO_CHAR:
|
||||
@ -198,28 +199,28 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
|
||||
switch (format->u.raw_audio.channel_count) {
|
||||
default:
|
||||
case 2:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_STEREO;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
case 1:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_MONO;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case 3:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_SURROUND;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_SURROUND;
|
||||
break;
|
||||
case 4:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_QUAD;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_QUAD;
|
||||
break;
|
||||
case 5:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_5POINT0;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_5POINT0;
|
||||
break;
|
||||
case 6:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_5POINT1;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_5POINT1;
|
||||
break;
|
||||
case 8:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_7POINT1;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_7POINT1;
|
||||
break;
|
||||
case 10:
|
||||
fStream->codec->channel_layout = CH_LAYOUT_7POINT1_WIDE;
|
||||
fStream->codec->channel_layout = AV_CH_LAYOUT_7POINT1_WIDE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -365,9 +366,13 @@ AVFormatWriter::Init(const media_file_format* fileFormat)
|
||||
|
||||
// Init I/O context with buffer and hook functions, pass ourself as
|
||||
// cookie.
|
||||
if (init_put_byte(fIOContext, buffer, kIOBufferSize, 1, this,
|
||||
0, _Write, _Seek) != 0) {
|
||||
TRACE(" init_put_byte() failed!\n");
|
||||
// Allocate I/O context with buffer and hook functions, pass ourself as
|
||||
// cookie.
|
||||
memset(buffer, 0, kIOBufferSize);
|
||||
fIOContext = avio_alloc_context(buffer, kIOBufferSize, 1, this, 0, _Write,
|
||||
_Seek);
|
||||
if (fIOContext == NULL) {
|
||||
TRACE(" avio_alloc_context() failed!\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -410,12 +415,6 @@ AVFormatWriter::CommitHeader()
|
||||
if (fHeaderWritten)
|
||||
return B_NOT_ALLOWED;
|
||||
|
||||
// According to output_example.c, the output parameters must be set even
|
||||
// if none are specified. In the example, this call is used after the
|
||||
// streams have been created.
|
||||
if (av_set_parameters(fContext, NULL) < 0)
|
||||
return B_ERROR;
|
||||
|
||||
#if OPEN_CODEC_CONTEXT
|
||||
for (unsigned i = 0; i < fContext->nb_streams; i++) {
|
||||
AVStream* stream = fContext->streams[i];
|
||||
@ -424,7 +423,7 @@ AVFormatWriter::CommitHeader()
|
||||
// it may be an encoder from a different plugin.
|
||||
AVCodecContext* codecContext = stream->codec;
|
||||
AVCodec* codec = avcodec_find_encoder(codecContext->codec_id);
|
||||
if (codec == NULL || avcodec_open(codecContext, codec) < 0) {
|
||||
if (codec == NULL || avcodec_open2(codecContext, codec, NULL) < 0) {
|
||||
TRACE(" stream[%u] - failed to open AVCodecContext\n", i);
|
||||
}
|
||||
TRACE(" stream[%u] time_base: (%d/%d), codec->time_base: (%d/%d)\n",
|
||||
@ -433,9 +432,9 @@ AVFormatWriter::CommitHeader()
|
||||
}
|
||||
#endif
|
||||
|
||||
int result = av_write_header(fContext);
|
||||
int result = avformat_write_header(fContext, NULL);
|
||||
if (result < 0)
|
||||
TRACE(" av_write_header(): %d\n", result);
|
||||
TRACE(" avformat_write_header(): %d\n", result);
|
||||
|
||||
// We need to close the codecs we opened, even in case of failure.
|
||||
fHeaderWritten = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user