/*
* id Quake II CIN File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
+ * Copyright (c) 2003 The FFmpeg project
*
* This file is part of Libav.
*
* types. However, a CIN file does start with 5 32-bit numbers that
* specify audio and video parameters. This demuxer gets around the lack
* of file signature by performing sanity checks on those parameters.
- * Probabalistically, this is a reasonable solution since the number of
+ * Probabilistically, this is a reasonable solution since the number of
* valid combinations of the 5 parameters is a very small subset of the
* total 160-bit number space.
*
* transmitting them to the video decoder
*/
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
if (number > 2)
return 0;
- /* return half certainly since this check is a bit sketchy */
- return AVPROBE_SCORE_MAX / 2;
+ /* return half certainty since this check is a bit sketchy */
+ return AVPROBE_SCORE_EXTENSION;
}
static int idcin_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
st->start_time = 0;
idcin->video_stream_index = st->index;
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = AV_CODEC_ID_IDCIN;
- st->codec->codec_tag = 0; /* no fourcc */
- st->codec->width = width;
- st->codec->height = height;
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->codec_id = AV_CODEC_ID_IDCIN;
+ st->codecpar->codec_tag = 0; /* no fourcc */
+ st->codecpar->width = width;
+ st->codecpar->height = height;
/* load up the Huffman tables into extradata */
- st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
- st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
- ret = avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE);
+ st->codecpar->extradata_size = HUFFMAN_TABLE_SIZE;
+ st->codecpar->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
+ ret = avio_read(pb, st->codecpar->extradata, HUFFMAN_TABLE_SIZE);
if (ret < 0) {
return ret;
} else if (ret != HUFFMAN_TABLE_SIZE) {
avpriv_set_pts_info(st, 63, 1, sample_rate);
st->start_time = 0;
idcin->audio_stream_index = st->index;
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_tag = 1;
- st->codec->channels = channels;
- st->codec->channel_layout = channels > 1 ? AV_CH_LAYOUT_STEREO :
- AV_CH_LAYOUT_MONO;
- st->codec->sample_rate = sample_rate;
- st->codec->bits_per_coded_sample = bytes_per_sample * 8;
- st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
- st->codec->block_align = idcin->block_align = bytes_per_sample * channels;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_tag = 1;
+ st->codecpar->channels = channels;
+ st->codecpar->channel_layout = channels > 1 ? AV_CH_LAYOUT_STEREO :
+ AV_CH_LAYOUT_MONO;
+ st->codecpar->sample_rate = sample_rate;
+ st->codecpar->bits_per_coded_sample = bytes_per_sample * 8;
+ st->codecpar->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
+ st->codecpar->block_align = idcin->block_align = bytes_per_sample * channels;
if (bytes_per_sample == 1)
- st->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
else
- st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
if (sample_rate % 14 != 0) {
idcin->audio_chunk_size1 = (sample_rate / 14) *
return ret;
else if (ret != chunk_size) {
av_log(s, AV_LOG_ERROR, "incomplete packet\n");
+ av_packet_unref(pkt);
return AVERROR(EIO);
}
if (command == 1) {
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE);
- if (ret < 0)
- return ret;
+ if (!pal) {
+ av_packet_unref(pkt);
+ return AVERROR(ENOMEM);
+ }
memcpy(pal, palette, AVPALETTE_SIZE);
pkt->flags |= AV_PKT_FLAG_KEY;
}