diff options
author | Zane van Iperen <zane@zanevaniperen.com> | 2021-05-04 21:59:37 +1000 |
---|---|---|
committer | Zane van Iperen <zane@zanevaniperen.com> | 2021-05-06 11:06:43 +1000 |
commit | 2329f7f21eb55281af439f70ded40a0c3ecec47b (patch) | |
tree | 5d7cb22d4b0b9ed60662030ebe44b5c4715b1ab1 | |
parent | 3575a495f6dcc395656343380e13c57d48b9f976 (diff) | |
download | ffmpeg-2329f7f21eb55281af439f70ded40a0c3ecec47b.tar.gz |
avformat/rpl: cosmetics
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
-rw-r--r-- | libavformat/rpl.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/libavformat/rpl.c b/libavformat/rpl.c index f5d2b8fe59..367e80b2c4 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -216,18 +216,13 @@ static int rpl_read_header(AVFormatContext *s) if (ast->codecpar->bits_per_coded_sample == 16) { // 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_stristr(audio_type, "unsigned") != NULL) { + if (av_stristr(audio_type, "unsigned") != NULL) ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; - break; - } else if(av_stristr(audio_type, "linear") != NULL) { + else if (av_stristr(audio_type, "linear") != NULL) ast->codecpar->codec_id = AV_CODEC_ID_PCM_S8; - break; - } else { + else ast->codecpar->codec_id = AV_CODEC_ID_PCM_VIDC; - break; - } } // There are some other formats listed as legal per the spec; // samples needed. @@ -237,10 +232,8 @@ static int rpl_read_header(AVFormatContext *s) // The samples with this kind of audio that I have // are all unsigned. ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; - break; } else if (ast->codecpar->bits_per_coded_sample == 4) { ast->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD; - break; } break; } @@ -297,7 +290,8 @@ static int rpl_read_header(AVFormatContext *s) total_audio_size += audio_size * 8; } - if (error) return AVERROR(EIO); + if (error) + return AVERROR(EIO); return 0; } @@ -322,9 +316,10 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) index_entry = &stream->internal->index_entries[rpl->chunk_number]; - if (rpl->frame_in_part == 0) + if (rpl->frame_in_part == 0) { if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0) return AVERROR(EIO); + } if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && stream->codecpar->codec_tag == 124) { @@ -340,9 +335,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, frame_size); if (ret < 0) return ret; - if (ret != frame_size) { + if (ret != frame_size) return AVERROR(EIO); - } + pkt->duration = 1; pkt->pts = index_entry->timestamp + rpl->frame_in_part; pkt->stream_index = rpl->chunk_part; @@ -356,9 +351,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, index_entry->size); if (ret < 0) return ret; - if (ret != index_entry->size) { + if (ret != index_entry->size) return AVERROR(EIO); - } if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { // frames_per_chunk should always be one here; the header |