#include "avformat.h"
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
-
#define HUFFMAN_TABLE_SIZE (64 * 1024)
#define FRAME_PTS_INC (90000 / 14)
st = av_new_stream(s, 0);
if (!st)
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.extradata = av_malloc(HUFFMAN_TABLE_SIZE);
if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
- return -EIO;
+ return AVERROR_IO;
/* save a reference in order to transport the palette */
st->codec.palctrl = &idcin->palctrl;
st = av_new_stream(s, 0);
if (!st)
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;
idcin->next_chunk_is_video = 1;
idcin->pts = 0;
- /* set the pts reference (1 pts = 1/90000) */
- s->pts_num = 1;
- s->pts_den = 90000;
-
return 0;
}
unsigned char palette_buffer[768];
if (url_feof(&s->pb))
- return -EIO;
+ return AVERROR_IO;
if (idcin->next_chunk_is_video) {
command = get_le32(pb);
if (command == 2) {
- return -EIO;
+ return AVERROR_IO;
} else if (command == 1) {
/* trigger a palette change */
idcin->palctrl.palette_changed = 1;
if (get_buffer(pb, palette_buffer, 768) != 768)
- return -EIO;
+ return AVERROR_IO;
/* scale the palette as necessary */
palette_scale = 2;
for (i = 0; i < 768; i++)
url_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
if (av_new_packet(pkt, chunk_size))
- ret = -EIO;
+ ret = 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 = -EIO;
+ ret = AVERROR_IO;
} else {
/* send out the audio chunk */
if (idcin->current_audio_chunk)
else
chunk_size = idcin->audio_chunk_size1;
if (av_new_packet(pkt, chunk_size))
- return -EIO;
+ 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 = -EIO;
+ ret = AVERROR_IO;
idcin->current_audio_chunk ^= 1;
idcin->pts += FRAME_PTS_INC;