ffmpeg plugin: add support for MOD and other "tracked music"

* ffmpeg can handle these through ModPlug
* By default, ffmpoeg will not try these formats because the way to
detect them are a bit unsafe (4 bytes at a particular offset in the file
serve as an identifier). So, hint the sniffing by giving it a filename
of ".mod" to get modplug to be used. This does not affect sniffing in
the regular way for other formats.
* Add some common tracked music formats to the muxer table.
* Fix some tracing to use current (as of ffmpeg 0.10) function names and
because some variables were renamed.
This commit is contained in:
Adrien Destugues 2015-08-30 14:53:47 +02:00
parent cccf804d96
commit 0f7e19ce7e
2 changed files with 58 additions and 2 deletions

View File

@ -257,7 +257,7 @@ StreamBase::Open()
fContext->pb = fIOContext;
// Allocate our context and probe the input format
if (avformat_open_input(&fContext, "", NULL, NULL) < 0) {
if (avformat_open_input(&fContext, ".mod", NULL, NULL) < 0) {
TRACE("StreamBase::Open() - avformat_open_input() failed!\n");
// avformat_open_input() frees the context in case of failure
fContext = NULL;
@ -1505,7 +1505,7 @@ AVFormatReader::Sniff(int32* _streamCount)
streamDeleter.Detach();
#ifdef TRACE_AVFORMAT_READER
dump_format(const_cast<AVFormatContext*>(stream->Context()), 0, "", 0);
av_dump_format(const_cast<AVFormatContext*>(stream->Context()), 0, "", 0);
#endif
if (_streamCount != NULL)

View File

@ -318,6 +318,62 @@ const media_file_format gMuxerTable[] = {
"webm",
{ 0 }
},
{
media_file_format::B_READABLE
| media_file_format::B_KNOWS_RAW_AUDIO
| media_file_format::B_KNOWS_ENCODED_AUDIO,
{ 0 },
B_MISC_FORMAT_FAMILY,
100,
{ 0 },
"audio/xm",
"Fast Tracker eXtended Module",
"xm",
"xm",
{ 0 }
},
{
media_file_format::B_READABLE
| media_file_format::B_KNOWS_RAW_AUDIO
| media_file_format::B_KNOWS_ENCODED_AUDIO,
{ 0 },
B_MISC_FORMAT_FAMILY,
100,
{ 0 },
"audio/s3m",
"Scream Tracker 3",
"s3m",
"s3m",
{ 0 }
},
{
media_file_format::B_READABLE
| media_file_format::B_KNOWS_RAW_AUDIO
| media_file_format::B_KNOWS_ENCODED_AUDIO,
{ 0 },
B_MISC_FORMAT_FAMILY,
100,
{ 0 },
"audio/it",
"Impulse Tracker",
"it",
"it",
{ 0 }
},
{
media_file_format::B_READABLE
| media_file_format::B_KNOWS_RAW_AUDIO
| media_file_format::B_KNOWS_ENCODED_AUDIO,
{ 0 },
B_MISC_FORMAT_FAMILY,
100,
{ 0 },
"audio/x-mod",
"Protracker MOD",
"mod",
"mod",
{ 0 }
},
};
const size_t gMuxerCount = sizeof(gMuxerTable) / sizeof(media_file_format);