X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fdxa.c;h=1e1d50581cb7894537f82421a334a3861989a0ca;hb=91c9aa0941869531ce8cadbea8cd333a9c4b1244;hp=695ca959e1f4dffd2e5e26fa754c6d78e76a1793;hpb=e356fc57a2e9887370caec58d8aafeafd1f336dc;p=ffmpeg diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 695ca959e1f..1e1d50581cb 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -2,20 +2,20 @@ * DXA demuxer * Copyright (c) 2007 Konstantin Shishkov * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav 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. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -60,6 +60,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) int w, h; int num, den; int flags; + int ret; tag = avio_rl32(pb); if (tag != MKTAG('D', 'E', 'X', 'A')) @@ -95,26 +96,28 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) uint32_t size, fsize; c->has_sound = 1; size = avio_rb32(pb); - c->vidpos = url_ftell(pb) + size; - avio_seek(pb, 16, SEEK_CUR); + c->vidpos = avio_tell(pb) + size; + avio_skip(pb, 16); fsize = avio_rl32(pb); ast = av_new_stream(s, 0); if (!ast) return -1; - ff_get_wav_header(pb, ast->codec, fsize); + ret = ff_get_wav_header(pb, ast->codec, fsize); + if (ret < 0) + return ret; // find 'data' chunk - while(url_ftell(pb) < c->vidpos && !url_feof(pb)){ + while(avio_tell(pb) < c->vidpos && !pb->eof_reached){ tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; - avio_seek(pb, fsize, SEEK_CUR); + avio_skip(pb, fsize); } c->bpc = (fsize + c->frames - 1) / c->frames; if(ast->codec->block_align) c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; c->bytes_left = fsize; - c->wavpos = url_ftell(pb); + c->wavpos = avio_tell(pb); avio_seek(pb, c->vidpos, SEEK_SET); } @@ -133,7 +136,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height >>= 1; } c->readvid = !c->has_sound; - c->vidpos = url_ftell(pb); + c->vidpos = avio_tell(pb); s->start_time = 0; s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den; av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames); @@ -158,11 +161,11 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(ret != size) return AVERROR(EIO); c->bytes_left -= size; - c->wavpos = url_ftell(s->pb); + c->wavpos = avio_tell(s->pb); return 0; } avio_seek(s->pb, c->vidpos, SEEK_SET); - while(!url_feof(s->pb) && c->frames){ + while(!s->pb->eof_reached && c->frames){ avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ case MKTAG('N', 'U', 'L', 'L'): @@ -172,7 +175,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(pal_size) memcpy(pkt->data, pal, pal_size); memcpy(pkt->data + pal_size, buf, 4); c->frames--; - c->vidpos = url_ftell(s->pb); + c->vidpos = avio_tell(s->pb); c->readvid = 0; return 0; case MKTAG('C', 'M', 'A', 'P'): @@ -198,7 +201,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(pal_size) memcpy(pkt->data, pal, pal_size); pkt->stream_index = 0; c->frames--; - c->vidpos = url_ftell(s->pb); + c->vidpos = avio_tell(s->pb); c->readvid = 0; return 0; default: