* Id Quake II CIN File Demuxer
* Copyright (c) 2003 The ffmpeg Project
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg 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 this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
idcin->video_stream_index = st->index;
- st->codec.codec_type = CODEC_TYPE_VIDEO;
- st->codec.codec_id = CODEC_ID_IDCIN;
- st->codec.codec_tag = 0; /* no fourcc */
- st->codec.width = width;
- st->codec.height = height;
+ st->codec->codec_type = CODEC_TYPE_VIDEO;
+ st->codec->codec_id = CODEC_ID_IDCIN;
+ st->codec->codec_tag = 0; /* no fourcc */
+ st->codec->width = width;
+ st->codec->height = height;
/* load up the Huffman tables into extradata */
- st->codec.extradata_size = HUFFMAN_TABLE_SIZE;
- st->codec.extradata = av_malloc(HUFFMAN_TABLE_SIZE);
- if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) !=
+ st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
+ st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
+ if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
return AVERROR_IO;
/* save a reference in order to transport the palette */
- st->codec.palctrl = &idcin->palctrl;
+ st->codec->palctrl = &idcin->palctrl;
/* if sample rate is 0, assume no audio */
if (sample_rate) {
return AVERROR_NOMEM;
av_set_pts_info(st, 33, 1, 90000);
idcin->audio_stream_index = st->index;
- st->codec.codec_type = CODEC_TYPE_AUDIO;
- st->codec.codec_tag = 1;
- st->codec.channels = channels;
- st->codec.sample_rate = sample_rate;
- st->codec.bits_per_sample = bytes_per_sample * 8;
- st->codec.bit_rate = sample_rate * bytes_per_sample * 8 * channels;
- st->codec.block_align = bytes_per_sample * channels;
+ st->codec->codec_type = CODEC_TYPE_AUDIO;
+ st->codec->codec_tag = 1;
+ st->codec->channels = channels;
+ st->codec->sample_rate = sample_rate;
+ st->codec->bits_per_sample = bytes_per_sample * 8;
+ st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
+ st->codec->block_align = bytes_per_sample * channels;
if (bytes_per_sample == 1)
- st->codec.codec_id = CODEC_ID_PCM_U8;
+ st->codec->codec_id = CODEC_ID_PCM_U8;
else
- st->codec.codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = CODEC_ID_PCM_S16LE;
if (sample_rate % 14 != 0) {
idcin->audio_chunk_size1 = (sample_rate / 14) *
/* skip the number of decoded bytes (always equal to width * height) */
url_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
- if (av_new_packet(pkt, chunk_size))
- ret = AVERROR_IO;
+ ret= av_get_packet(pb, pkt, chunk_size);
+ if (ret != chunk_size)
+ return AVERROR_IO;
pkt->stream_index = idcin->video_stream_index;
pkt->pts = idcin->pts;
- ret = get_buffer(pb, pkt->data, chunk_size);
- if (ret != chunk_size)
- ret = AVERROR_IO;
} else {
/* send out the audio chunk */
if (idcin->current_audio_chunk)
chunk_size = idcin->audio_chunk_size2;
else
chunk_size = idcin->audio_chunk_size1;
- if (av_new_packet(pkt, chunk_size))
+ ret= av_get_packet(pb, pkt, chunk_size);
+ if (ret != chunk_size)
return AVERROR_IO;
pkt->stream_index = idcin->audio_stream_index;
pkt->pts = idcin->pts;
- ret = get_buffer(&s->pb, pkt->data, chunk_size);
- if (ret != chunk_size)
- ret = AVERROR_IO;
idcin->current_audio_chunk ^= 1;
idcin->pts += FRAME_PTS_INC;
return 0;
}
-static AVInputFormat idcin_iformat = {
+AVInputFormat idcin_demuxer = {
"idcin",
"Id CIN format",
sizeof(IdcinDemuxContext),
idcin_read_packet,
idcin_read_close,
};
-
-int idcin_init(void)
-{
- av_register_input_format(&idcin_iformat);
- return 0;
-}