/** 256 is arbitrary, but should be big enough for any reasonable file. */
#define RPL_LINE_LENGTH 256
-static int rpl_probe(AVProbeData *p)
+static int rpl_probe(const AVProbeData *p)
{
if (memcmp(p->buf, RPL_SIGNATURE, RPL_SIGNATURE_SIZE))
return 0;
AVStream *vst = NULL, *ast = NULL;
int total_audio_size;
int error = 0;
+ const char *endptr;
+ char audio_type[RPL_LINE_LENGTH];
uint32_t i;
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)
// 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(av_strcasecmp(audio_type, "unsigned") >= 0) {
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
+ break;
+ } else if(av_strcasecmp(audio_type, "linear") >= 0) {
+ 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.