mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/rpl: Support files containing Replay IMA ADPCM audio
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
This commit is contained in:
parent
5c7313c740
commit
bc86515c4f
|
@ -121,6 +121,7 @@ static int rpl_read_header(AVFormatContext *s)
|
||||||
int error = 0;
|
int error = 0;
|
||||||
const char *endptr;
|
const char *endptr;
|
||||||
char audio_type[RPL_LINE_LENGTH];
|
char audio_type[RPL_LINE_LENGTH];
|
||||||
|
char audio_codec[RPL_LINE_LENGTH];
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
@ -189,7 +190,9 @@ static int rpl_read_header(AVFormatContext *s)
|
||||||
|
|
||||||
// ARMovie supports multiple audio tracks; I don't have any
|
// ARMovie supports multiple audio tracks; I don't have any
|
||||||
// samples, though. This code will ignore additional tracks.
|
// samples, though. This code will ignore additional tracks.
|
||||||
audio_format = read_line_and_int(pb, &error); // audio format ID
|
error |= read_line(pb, line, sizeof(line));
|
||||||
|
audio_format = read_int(line, &endptr, &error); // audio format ID
|
||||||
|
av_strlcpy(audio_codec, endptr, RPL_LINE_LENGTH);
|
||||||
if (audio_format) {
|
if (audio_format) {
|
||||||
ast = avformat_new_stream(s, NULL);
|
ast = avformat_new_stream(s, NULL);
|
||||||
if (!ast)
|
if (!ast)
|
||||||
|
@ -227,6 +230,11 @@ static int rpl_read_header(AVFormatContext *s)
|
||||||
// There are some other formats listed as legal per the spec;
|
// There are some other formats listed as legal per the spec;
|
||||||
// samples needed.
|
// samples needed.
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
if (av_stristr(audio_codec, "adpcm") != NULL) {
|
||||||
|
ast->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_ACORN;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 101:
|
case 101:
|
||||||
if (ast->codecpar->bits_per_coded_sample == 8) {
|
if (ast->codecpar->bits_per_coded_sample == 8) {
|
||||||
// The samples with this kind of audio that I have
|
// The samples with this kind of audio that I have
|
||||||
|
@ -238,8 +246,8 @@ static int rpl_read_header(AVFormatContext *s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ast->codecpar->codec_id == AV_CODEC_ID_NONE)
|
if (ast->codecpar->codec_id == AV_CODEC_ID_NONE)
|
||||||
avpriv_request_sample(s, "Audio format %"PRId32,
|
avpriv_request_sample(s, "Audio format %"PRId32" (%s)",
|
||||||
audio_format);
|
audio_format, audio_codec);
|
||||||
avpriv_set_pts_info(ast, 32, 1, ast->codecpar->bit_rate);
|
avpriv_set_pts_info(ast, 32, 1, ast->codecpar->bit_rate);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
|
|
Loading…
Reference in New Issue