Commit 624fb5f9 authored by Clément Bœsch's avatar Clément Bœsch

lavf/swfdec: support 8-bits PCM audio.

parent 9a0076f5
...@@ -140,7 +140,7 @@ static int swf_read_header(AVFormatContext *s) ...@@ -140,7 +140,7 @@ static int swf_read_header(AVFormatContext *s)
static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info) static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info)
{ {
int sample_rate_code; int sample_rate_code, sample_size_code;
AVStream *ast = avformat_new_stream(s, NULL); AVStream *ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return NULL; return NULL;
...@@ -156,6 +156,9 @@ static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info) ...@@ -156,6 +156,9 @@ static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info)
ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, info>>4 & 15); ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, info>>4 & 15);
ast->need_parsing = AVSTREAM_PARSE_FULL; ast->need_parsing = AVSTREAM_PARSE_FULL;
sample_rate_code = info>>2 & 3; sample_rate_code = info>>2 & 3;
sample_size_code = info>>1 & 1;
if (!sample_size_code && ast->codec->codec_id == AV_CODEC_ID_PCM_S16LE)
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->sample_rate = 44100 >> (3 - sample_rate_code); ast->codec->sample_rate = 44100 >> (3 - sample_rate_code);
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate); avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
return ast; return ast;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment