X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fpva.c;h=3abfc18508bbf3d485ff46b7a8dd00c297cc4d35;hb=c4bfa098072ba338d83555d6e2199f7e1e64ffff;hp=f781026c1c1a4cabf633f9e6aededfcad10e8666;hpb=6b4aa5dac8f41aa452d0ce9a1bede9e59a303060;p=ffmpeg diff --git a/libavformat/pva.c b/libavformat/pva.c index f781026c1c1..3abfc18508b 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -2,24 +2,25 @@ * TechnoTrend PVA (.pva) demuxer * Copyright (c) 2007, 2008 Ivo van Poorten * - * 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 */ #include "avformat.h" +#include "internal.h" #include "mpeg.h" #define PVA_MAX_PAYLOAD_LENGTH 0x17f8 @@ -35,28 +36,28 @@ static int pva_probe(AVProbeData * pd) { unsigned char *buf = pd->buf; if (AV_RB16(buf) == PVA_MAGIC && buf[2] && buf[2] < 3 && buf[4] == 0x55) - return AVPROBE_SCORE_MAX / 2; + return AVPROBE_SCORE_EXTENSION; return 0; } -static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { +static int pva_read_header(AVFormatContext *s) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = CODEC_ID_MPEG2VIDEO; + st->codec->codec_id = AV_CODEC_ID_MPEG2VIDEO; st->need_parsing = AVSTREAM_PARSE_FULL; - av_set_pts_info(st, 32, 1, 90000); + avpriv_set_pts_info(st, 32, 1, 90000); av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME); - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_MP2; + st->codec->codec_id = AV_CODEC_ID_MP2; st->need_parsing = AVSTREAM_PARSE_FULL; - av_set_pts_info(st, 33, 1, 90000); + avpriv_set_pts_info(st, 33, 1, 90000); av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME); /* the parameters will be extracted from the compressed bitstream */ @@ -73,7 +74,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, int64_t pva_pts = AV_NOPTS_VALUE, startpos; recover: - startpos = url_ftell(pb); + startpos = avio_tell(pb); syncword = avio_rb16(pb); streamid = avio_r8(pb); @@ -122,7 +123,7 @@ recover: if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); - url_fskip(pb, length - 9); + avio_skip(pb, length - 9); if (!read_packet) return AVERROR(EIO); goto recover; @@ -190,7 +191,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, continue; } if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) { - *pos = url_ftell(pb) + length; + *pos = avio_tell(pb) + length; continue; } break; @@ -201,11 +202,11 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, } AVInputFormat ff_pva_demuxer = { - "pva", - NULL_IF_CONFIG_SMALL("TechnoTrend PVA file and stream format"), - sizeof(PVAContext), - pva_probe, - pva_read_header, - pva_read_packet, - .read_timestamp = pva_read_timestamp + .name = "pva", + .long_name = NULL_IF_CONFIG_SMALL("TechnoTrend PVA"), + .priv_data_size = sizeof(PVAContext), + .read_probe = pva_probe, + .read_header = pva_read_header, + .read_packet = pva_read_packet, + .read_timestamp = pva_read_timestamp, };