diff options
Diffstat (limited to 'libavformat/rpl.c')
-rw-r--r-- | libavformat/rpl.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 6f6119c..d373600 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -2,20 +2,20 @@ * ARMovie/RPL demuxer * Copyright (c) 2007 Christian Ohm, 2008 Eli Friedman * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -60,7 +60,7 @@ static int read_line(AVIOContext * pb, char* line, int bufsize) break; if (b == '\n') { line[i] = '\0'; - return 0; + return avio_feof(pb) ? -1 : 0; } line[i] = b; } @@ -170,9 +170,8 @@ static int rpl_read_header(AVFormatContext *s) vst->codecpar->codec_id = AV_CODEC_ID_ESCAPE130; break; default: - av_log(s, AV_LOG_WARNING, - "RPL video format %"PRIu32" not supported yet!\n", - vst->codecpar->codec_tag); + avpriv_report_missing_feature(s, "Video format %s", + av_fourcc2str(vst->codecpar->codec_tag)); vst->codecpar->codec_id = AV_CODEC_ID_NONE; } @@ -222,11 +221,9 @@ static int rpl_read_header(AVFormatContext *s) } break; } - if (ast->codecpar->codec_id == AV_CODEC_ID_NONE) { - av_log(s, AV_LOG_WARNING, - "RPL audio format %"PRId32" not supported yet!\n", - audio_format); - } + if (ast->codecpar->codec_id == AV_CODEC_ID_NONE) + avpriv_request_sample(s, "Audio format %"PRId32, + audio_format); avpriv_set_pts_info(ast, 32, 1, ast->codecpar->bit_rate); } else { for (i = 0; i < 3; i++) @@ -236,8 +233,8 @@ static int rpl_read_header(AVFormatContext *s) rpl->frames_per_chunk = read_line_and_int(pb, &error); // video frames per chunk if (rpl->frames_per_chunk > 1 && vst->codecpar->codec_tag != 124) av_log(s, AV_LOG_WARNING, - "Don't know how to split frames for video format %"PRIu32". " - "Video stream will be broken!\n", vst->codecpar->codec_tag); + "Don't know how to split frames for video format %s. " + "Video stream will be broken!\n", av_fourcc2str(vst->codecpar->codec_tag)); number_of_chunks = read_line_and_int(pb, &error); // number of chunks in the file // The number in the header is actually the index of the last chunk. @@ -254,12 +251,14 @@ static int rpl_read_header(AVFormatContext *s) // Read the index avio_seek(pb, chunk_catalog_offset, SEEK_SET); total_audio_size = 0; - for (i = 0; i < number_of_chunks; i++) { + for (i = 0; !error && i < number_of_chunks; i++) { int64_t offset, video_size, audio_size; error |= read_line(pb, line, sizeof(line)); - if (3 != sscanf(line, "%"PRId64" , %"PRId64" ; %"PRId64, - &offset, &video_size, &audio_size)) + if (3 != sscanf(line, "%"SCNd64" , %"SCNd64" ; %"SCNd64, + &offset, &video_size, &audio_size)) { error = -1; + continue; + } av_add_index_entry(vst, offset, i * rpl->frames_per_chunk, video_size, rpl->frames_per_chunk, 0); if (ast) @@ -279,7 +278,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) AVIOContext *pb = s->pb; AVStream* stream; AVIndexEntry* index_entry; - uint32_t ret; + int ret; if (rpl->chunk_part == s->nb_streams) { rpl->chunk_number++; @@ -289,7 +288,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) stream = s->streams[rpl->chunk_part]; if (rpl->chunk_number >= stream->nb_index_entries) - return -1; + return AVERROR_EOF; index_entry = &stream->index_entries[rpl->chunk_number]; @@ -309,6 +308,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); ret = av_get_packet(pb, pkt, frame_size); + if (ret < 0) + return ret; if (ret != frame_size) { av_packet_unref(pkt); return AVERROR(EIO); @@ -324,6 +325,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) } } else { ret = av_get_packet(pb, pkt, index_entry->size); + if (ret < 0) + return ret; if (ret != index_entry->size) { av_packet_unref(pkt); return AVERROR(EIO); |