X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmpc8.c;h=890404faf4cda30d736477c1ec51d4e11f0ca9e6;hb=2c07c1804831fa0ae6d494a63fdd10facfd6074b;hp=c4810f6eafaafac7c9b0d43463e63e7c8558515d;hpb=2912e87a6c9264d556734e2bf94a99c64cf9b102;p=ffmpeg diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index c4810f6eafa..890404faf4c 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -22,6 +22,7 @@ #include "libavcodec/get_bits.h" #include "libavcodec/unary.h" #include "avformat.h" +#include "internal.h" #include "avio_internal.h" /// Two-byte MPC tag @@ -187,7 +188,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in } } -static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) +static int mpc8_read_header(AVFormatContext *s) { MPCContext *c = s->priv_data; AVIOContext *pb = s->pb; @@ -222,7 +223,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) c->samples = ffio_read_varlen(pb); ffio_read_varlen(pb); //silence samples at the beginning - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -235,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = (st->codec->extradata[1] >> 4) + 1; st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; - av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate); + avpriv_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate); st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2); size -= avio_tell(pb) - pos; @@ -264,7 +265,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); mpc8_handle_chunk(s, tag, pos, size); } - return 0; + return AVERROR_EOF; } static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) @@ -274,19 +275,19 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam int index = av_index_search_timestamp(st, timestamp, flags); if(index < 0) return -1; - avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); + if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0) + return -1; c->frame = st->index_entries[index].timestamp; return 0; } AVInputFormat ff_mpc8_demuxer = { - "mpc8", - NULL_IF_CONFIG_SMALL("Musepack SV8"), - sizeof(MPCContext), - mpc8_probe, - mpc8_read_header, - mpc8_read_packet, - NULL, - mpc8_read_seek, + .name = "mpc8", + .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"), + .priv_data_size = sizeof(MPCContext), + .read_probe = mpc8_probe, + .read_header = mpc8_read_header, + .read_packet = mpc8_read_packet, + .read_seek = mpc8_read_seek, };