X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fqcp.c;h=191e9dd85b8461ab2e4c59f035ac57105c842a71;hb=4bf3c8f226252e18de8051fd0d417c1d39857b67;hp=fefc929279f59a9603c8145de2babd996c091f28;hpb=a2704c9712ad35cc22e7e0d8a79b581c07fa383b;p=ffmpeg diff --git a/libavformat/qcp.c b/libavformat/qcp.c index fefc929279f..191e9dd85b8 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -2,20 +2,20 @@ * QCP format (.qcp) demuxer * Copyright (c) 2009 Kenan Gillet * - * 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 */ @@ -23,7 +23,7 @@ * @file * QCP format (.qcp) demuxer * @author Kenan Gillet - * @sa RFC 3625: "The QCP File Format and Media Types for Speech Data" + * @see RFC 3625: "The QCP File Format and Media Types for Speech Data" * http://tools.ietf.org/html/rfc3625 */ @@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); uint8_t buf[16]; int i, nb_rates; @@ -92,8 +92,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); avio_rb32(pb); // "RIFF" - s->file_size = avio_rl32(pb) + 8; - avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version + avio_skip(pb, 4 + 8 + 4 + 1 + 1); // filesize + "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; @@ -110,13 +109,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); return AVERROR_INVALIDDATA; } - avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name + avio_skip(pb, 2 + 80); // codec-version + codec-name st->codec->bit_rate = avio_rl16(pb); s->packet_size = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // block-size + avio_skip(pb, 2); // block-size st->codec->sample_rate = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // sample-size + avio_skip(pb, 2); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); nb_rates = avio_rl32(pb); @@ -129,7 +128,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) } else c->rates_per_mode[mode] = size; } - avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved + avio_skip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved return 0; } @@ -140,7 +139,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) QCPContext *c = s->priv_data; unsigned int chunk_size, tag; - while(!url_feof(pb)) { + while(!pb->eof_reached) { if (c->data_size) { int pkt_size, ret, mode = avio_r8(pb); @@ -174,14 +173,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('v', 'r', 'a', 't'): if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; - avio_seek(pb, 4, SEEK_CUR); // size-in-packets + avio_skip(pb, 4); // size-in-packets break; case MKTAG('d', 'a', 't', 'a'): c->data_size = chunk_size; break; default: - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); } } return AVERROR_EOF;