[FFmpeg-devel] [PATCH] avformat/rpl: cosmetics

Zane van Iperen zane at zanevaniperen.com
Tue May 4 15:05:26 EEST 2021


Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
---
 libavformat/rpl.c | 26 ++++++++++----------------
 1 file 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
-- 
2.29.3



More information about the ffmpeg-devel mailing list