summaryrefslogtreecommitdiff
path: root/libavformat/rpl.c
diff options
context:
space:
mode:
authorCameron Cawley <ccawley2011@gmail.com>2018-10-13 00:06:40 +0100
committerPaul B Mahol <onemda@gmail.com>2018-10-26 13:39:25 +0200
commit0e9c01fd87ae6cc5ba3474810eaa3c58499615ce (patch)
tree4e24e678be11197ed39c35f835764e9119dbb0ea /libavformat/rpl.c
parent22238d0b9440cf55aafda42c60f4413514d4aeb8 (diff)
downloadffmpeg-0e9c01fd87ae6cc5ba3474810eaa3c58499615ce.tar.gz
avformat/rpl: Support files containing 8 bit PCM or VIDC audio
Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
Diffstat (limited to 'libavformat/rpl.c')
-rw-r--r--libavformat/rpl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index d373600478..6b45b35c30 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -119,6 +119,8 @@ static int rpl_read_header(AVFormatContext *s)
AVStream *vst = NULL, *ast = NULL;
int total_audio_size;
int error = 0;
+ const char *endptr;
+ char audio_type[RPL_LINE_LENGTH];
uint32_t i;
@@ -188,7 +190,9 @@ static int rpl_read_header(AVFormatContext *s)
ast->codecpar->codec_tag = audio_format;
ast->codecpar->sample_rate = read_line_and_int(pb, &error); // audio bitrate
ast->codecpar->channels = read_line_and_int(pb, &error); // number of audio channels
- ast->codecpar->bits_per_coded_sample = read_line_and_int(pb, &error); // audio bits per sample
+ error |= read_line(pb, line, sizeof(line));
+ ast->codecpar->bits_per_coded_sample = read_int(line, &endptr, &error); // audio bits per sample
+ strcpy(audio_type, endptr);
// At least one sample uses 0 for ADPCM, which is really 4 bits
// per sample.
if (ast->codecpar->bits_per_coded_sample == 0)
@@ -205,6 +209,17 @@ static int rpl_read_header(AVFormatContext *s)
// 16-bit audio is always signed
ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
break;
+ } else if (ast->codecpar->bits_per_coded_sample == 8) {
+ if(strstr(audio_type, "unsigned") != NULL) {
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
+ break;
+ } else if(strstr(audio_type, "linear") != NULL) {
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_S8;
+ break;
+ } else {
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_VIDC;
+ break;
+ }
}
// There are some other formats listed as legal per the spec;
// samples needed.