X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmvi.c;h=532c0c4f49dfa9e69c7a54e5b2b908b24285248c;hb=0c46e958d1fd3817b8e9fa048d0450d509c80378;hp=506976df432e5718114e1e7095528c9594d16879;hpb=72415b2adb2c25f95ceede49001bb97ed9247dbb;p=ffmpeg diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 506976df432..532c0c4f49d 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -2,20 +2,20 @@ * Motion Pixels MVI Demuxer * Copyright (c) 2008 Gregory Montoir (cyx@users.sourceforge.net) * - * 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 */ @@ -27,7 +27,7 @@ #define MVI_VIDEO_STREAM_INDEX 1 typedef struct MviDemuxContext { - unsigned int (*get_int)(ByteIOContext *); + unsigned int (*get_int)(AVIOContext *); uint32_t audio_data_size; uint64_t audio_size_counter; uint64_t audio_frame_size; @@ -38,7 +38,7 @@ typedef struct MviDemuxContext { static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *ast, *vst; unsigned int version, frames_count, msecs_per_frame, player_version; @@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->extradata_size = 2; vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); - version = get_byte(pb); - vst->codec->extradata[0] = get_byte(pb); - vst->codec->extradata[1] = get_byte(pb); - frames_count = get_le32(pb); - msecs_per_frame = get_le32(pb); - vst->codec->width = get_le16(pb); - vst->codec->height = get_le16(pb); - get_byte(pb); - ast->codec->sample_rate = get_le16(pb); - mvi->audio_data_size = get_le32(pb); - get_byte(pb); - player_version = get_le32(pb); - get_le16(pb); - get_byte(pb); + version = avio_r8(pb); + vst->codec->extradata[0] = avio_r8(pb); + vst->codec->extradata[1] = avio_r8(pb); + frames_count = avio_rl32(pb); + msecs_per_frame = avio_rl32(pb); + vst->codec->width = avio_rl16(pb); + vst->codec->height = avio_rl16(pb); + avio_r8(pb); + ast->codec->sample_rate = avio_rl16(pb); + mvi->audio_data_size = avio_rl32(pb); + avio_r8(pb); + player_version = avio_rl32(pb); + avio_rl16(pb); + avio_r8(pb); if (frames_count == 0 || mvi->audio_data_size == 0) return AVERROR_INVALIDDATA; @@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MOTIONPIXELS; - mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24; + mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24; mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count; mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size; @@ -100,7 +100,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, count; MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (mvi->video_frame_size == 0) { mvi->video_frame_size = (mvi->get_int)(pb); @@ -123,12 +123,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat mvi_demuxer = { - "mvi", - NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"), - sizeof(MviDemuxContext), - NULL, - read_header, - read_packet, +AVInputFormat ff_mvi_demuxer = { + .name = "mvi", + .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"), + .priv_data_size = sizeof(MviDemuxContext), + .read_header = read_header, + .read_packet = read_packet, .extensions = "mvi" };