* Added support for Flash Video (VP6F video and MP3 audio tested only).
* Seeking does not work, since the duration extraction from libavformat does not work for this container (maybe there are ways/workarounds but I didn't look into it). * Automatic white space cleanup. TODO: Add MIME type with sniffer rule. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31605 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -46,7 +46,7 @@ extern "C" {
|
|||||||
static const size_t kIOBufferSize = 64 * 1024;
|
static const size_t kIOBufferSize = 64 * 1024;
|
||||||
// TODO: This could depend on the BMediaFile creation flags, IIRC,
|
// TODO: This could depend on the BMediaFile creation flags, IIRC,
|
||||||
// the allow to specify a buffering mode.
|
// the allow to specify a buffering mode.
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
avformat_to_beos_format(SampleFormat format)
|
avformat_to_beos_format(SampleFormat format)
|
||||||
{
|
{
|
||||||
@@ -369,7 +369,15 @@ AVFormatReader::StreamCookie::Init(int32 virtualIndex)
|
|||||||
case CODEC_ID_FLAC:
|
case CODEC_ID_FLAC:
|
||||||
description.family = B_WAV_FORMAT_FAMILY;
|
description.family = B_WAV_FORMAT_FAMILY;
|
||||||
codecTag = 'flac';
|
codecTag = 'flac';
|
||||||
break;
|
break;
|
||||||
|
case CODEC_ID_VP6F:
|
||||||
|
description.family = B_QUICKTIME_FORMAT_FAMILY;
|
||||||
|
codecTag = B_BENDIAN_TO_HOST_INT32('VP6F');
|
||||||
|
break;
|
||||||
|
case CODEC_ID_MP3:
|
||||||
|
description.family = B_QUICKTIME_FORMAT_FAMILY;
|
||||||
|
codecTag = B_BENDIAN_TO_HOST_INT32('.mp3');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "ffmpeg codecTag is null, codec_id "
|
fprintf(stderr, "ffmpeg codecTag is null, codec_id "
|
||||||
"unknown 0x%x\n", codecContext->codec_id);
|
"unknown 0x%x\n", codecContext->codec_id);
|
||||||
@@ -446,7 +454,7 @@ AVFormatReader::StreamCookie::Init(int32 virtualIndex)
|
|||||||
case B_MEDIA_RAW_AUDIO:
|
case B_MEDIA_RAW_AUDIO:
|
||||||
format->u.raw_audio.frame_rate = (float)codecContext->sample_rate;
|
format->u.raw_audio.frame_rate = (float)codecContext->sample_rate;
|
||||||
format->u.raw_audio.channel_count = codecContext->channels;
|
format->u.raw_audio.channel_count = codecContext->channels;
|
||||||
format->u.encoded_audio.output.format
|
format->u.encoded_audio.output.format
|
||||||
= avformat_to_beos_format(codecContext->sample_fmt);
|
= avformat_to_beos_format(codecContext->sample_fmt);
|
||||||
format->u.raw_audio.buffer_size = 0;
|
format->u.raw_audio.buffer_size = 0;
|
||||||
|
|
||||||
@@ -469,24 +477,24 @@ AVFormatReader::StreamCookie::Init(int32 virtualIndex)
|
|||||||
= (float)codecContext->sample_rate;
|
= (float)codecContext->sample_rate;
|
||||||
format->u.encoded_audio.output.channel_count
|
format->u.encoded_audio.output.channel_count
|
||||||
= codecContext->channels;
|
= codecContext->channels;
|
||||||
format->u.encoded_audio.output.format
|
format->u.encoded_audio.output.format
|
||||||
= avformat_to_beos_format(codecContext->sample_fmt);
|
= avformat_to_beos_format(codecContext->sample_fmt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_MEDIA_ENCODED_VIDEO:
|
case B_MEDIA_ENCODED_VIDEO:
|
||||||
// TODO: Specifying any of these seems to throw off the format matching
|
// TODO: Specifying any of these seems to throw off the format matching
|
||||||
// later on.
|
// later on.
|
||||||
// format->u.encoded_video.avg_bit_rate = codecContext->bit_rate;
|
// format->u.encoded_video.avg_bit_rate = codecContext->bit_rate;
|
||||||
// format->u.encoded_video.max_bit_rate = codecContext->bit_rate
|
// format->u.encoded_video.max_bit_rate = codecContext->bit_rate
|
||||||
// + codecContext->bit_rate_tolerance;
|
// + codecContext->bit_rate_tolerance;
|
||||||
|
|
||||||
// format->u.encoded_video.encoding
|
// format->u.encoded_video.encoding
|
||||||
// = media_encoded_video_format::B_ANY;
|
// = media_encoded_video_format::B_ANY;
|
||||||
|
|
||||||
// format->u.encoded_video.frame_size = 1;
|
// format->u.encoded_video.frame_size = 1;
|
||||||
// format->u.encoded_video.forward_history = 0;
|
// format->u.encoded_video.forward_history = 0;
|
||||||
// format->u.encoded_video.backward_history = 0;
|
// format->u.encoded_video.backward_history = 0;
|
||||||
|
|
||||||
format->u.encoded_video.output.field_rate
|
format->u.encoded_video.output.field_rate
|
||||||
= av_q2d(stream->r_frame_rate);
|
= av_q2d(stream->r_frame_rate);
|
||||||
format->u.encoded_video.output.interlace = 1;
|
format->u.encoded_video.output.interlace = 1;
|
||||||
@@ -720,7 +728,7 @@ AVFormatReader::StreamCookie::Seek(uint32 flags, int64* frame,
|
|||||||
av_free_packet(&fPacket);
|
av_free_packet(&fPacket);
|
||||||
fReusePacket = false;
|
fReusePacket = false;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -978,7 +986,7 @@ AVFormatReader::Copyright()
|
|||||||
return "Copyright 2009, Stephan Aßmus";
|
return "Copyright 2009, Stephan Aßmus";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AVFormatReader::Sniff(int32* _streamCount)
|
AVFormatReader::Sniff(int32* _streamCount)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ const struct codec_table gCodecTable[] = {
|
|||||||
{CODEC_ID_CINEPAK, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'cvid', "Cinepak Video"},
|
{CODEC_ID_CINEPAK, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'cvid', "Cinepak Video"},
|
||||||
|
|
||||||
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, FOURCC(' elr'), "MS RLE"}, // ???
|
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, FOURCC(' elr'), "MS RLE"}, // ???
|
||||||
|
|
||||||
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('RLE '), "MS RLE"}, // ???
|
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('RLE '), "MS RLE"}, // ???
|
||||||
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('mrle'), "MS RLE"}, // ???
|
{CODEC_ID_MSRLE, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('mrle'), "MS RLE"}, // ???
|
||||||
|
|
||||||
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('MSVC'), "MS Video 1 (MSVC)"},
|
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('MSVC'), "MS Video 1 (MSVC)"},
|
||||||
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('msvc'), "MS Video 1 (msvc)"},
|
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('msvc'), "MS Video 1 (msvc)"},
|
||||||
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('CRAM'), "MS Video 1 (CRAM)"},
|
{CODEC_ID_MSVIDEO1, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('CRAM'), "MS Video 1 (CRAM)"},
|
||||||
@@ -200,10 +200,11 @@ const struct codec_table gCodecTable[] = {
|
|||||||
{CODEC_ID_INDEO5, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('IV50'), "Indeo 5"},
|
{CODEC_ID_INDEO5, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('IV50'), "Indeo 5"},
|
||||||
|
|
||||||
{CODEC_ID_VP3, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'VP31', "On2 VP3"},
|
{CODEC_ID_VP3, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'VP31', "On2 VP3"},
|
||||||
|
{CODEC_ID_VP6F, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'VP6F', "On2 VP6"},
|
||||||
|
|
||||||
{CODEC_ID_CYUV, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'cyuv', "CYUV"},
|
{CODEC_ID_CYUV, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'cyuv', "CYUV"},
|
||||||
{CODEC_ID_CYUV, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'CYUV', "CYUV"},
|
{CODEC_ID_CYUV, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'CYUV', "CYUV"},
|
||||||
|
|
||||||
{CODEC_ID_NONE, B_MEDIA_UNKNOWN_TYPE, B_ANY_FORMAT_FAMILY, 0, "null codec !!!"}
|
{CODEC_ID_NONE, B_MEDIA_UNKNOWN_TYPE, B_ANY_FORMAT_FAMILY, 0, "null codec !!!"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,18 @@ static const DemuxerFormat gDemuxerTable[] = {
|
|||||||
// "avi", "AVI (Audio Video Interleaved)", "video/x-msvideo",
|
// "avi", "AVI (Audio Video Interleaved)", "video/x-msvideo",
|
||||||
// B_WAV_FORMAT_FAMILY, B_AVI_FORMAT_FAMILY
|
// B_WAV_FORMAT_FAMILY, B_AVI_FORMAT_FAMILY
|
||||||
// },
|
// },
|
||||||
|
{
|
||||||
|
"dv", "DV Movie", "video/dv",
|
||||||
|
B_WAV_FORMAT_FAMILY, B_QUICKTIME_FORMAT_FAMILY
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"flac", "FLAC", "audio/x-flac",
|
||||||
|
B_WAV_FORMAT_FAMILY, B_ANY_FORMAT_FAMILY
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"flv", "Flash Video", "video/x-flv",
|
||||||
|
B_QUICKTIME_FORMAT_FAMILY, B_QUICKTIME_FORMAT_FAMILY
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// TODO: untested!
|
// TODO: untested!
|
||||||
// "mov", "MOV (Quicktime Movie)", "video/x-mov",
|
// "mov", "MOV (Quicktime Movie)", "video/x-mov",
|
||||||
@@ -69,14 +81,6 @@ static const DemuxerFormat gDemuxerTable[] = {
|
|||||||
"vob", "VOB Movie", "video/x-vob",
|
"vob", "VOB Movie", "video/x-vob",
|
||||||
B_MPEG_FORMAT_FAMILY, B_MPEG_FORMAT_FAMILY
|
B_MPEG_FORMAT_FAMILY, B_MPEG_FORMAT_FAMILY
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"dv", "DV Movie", "video/dv",
|
|
||||||
B_WAV_FORMAT_FAMILY, B_QUICKTIME_FORMAT_FAMILY
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"flac", "FLAC", "audio/x-flac",
|
|
||||||
B_WAV_FORMAT_FAMILY, B_ANY_FORMAT_FAMILY
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user