X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fpva.c;h=458d21995f08538da3983fc2d60699293b7d0c73;hb=7abdd026df6a9a52d07d8174505b33cc89db7bf6;hp=79b959cef6a420a2060a76bcdf6d45dcb4740f11;hpb=2912e87a6c9264d556734e2bf94a99c64cf9b102;p=ffmpeg diff --git a/libavformat/pva.c b/libavformat/pva.c index 79b959cef6a..458d21995f0 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "internal.h" #include "mpeg.h" #define PVA_MAX_PAYLOAD_LENGTH 0x17f8 @@ -27,7 +28,7 @@ #define PVA_AUDIO_PAYLOAD 0x02 #define PVA_MAGIC (('A' << 8) + 'V') -typedef struct { +typedef struct PVAContext { int continue_pes; } PVAContext; @@ -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->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->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->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; + st->codecpar->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 */ @@ -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, };