static int cin_probe(AVProbeData *p)
{
- if (p->buf_size < 18)
- return 0;
-
/* header starts with this special marker */
if (AV_RL32(&p->buf[0]) != 0x55AA0000)
return 0;
static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
int rc;
- CinDemuxContext *cin = (CinDemuxContext *)s->priv_data;
+ CinDemuxContext *cin = s->priv_data;
CinFileHeader *hdr = &cin->file_header;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
rc = cin_read_file_header(cin, pb);
/* initialize the video decoder stream */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, 12);
cin->video_stream_index = st->index;
/* initialize the audio decoder stream */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, 22050);
cin->audio_stream_index = st->index;
hdr->audio_frame_size = get_le32(pb);
if (url_feof(pb) || url_ferror(pb))
- return AVERROR_IO;
+ return AVERROR(EIO);
if (get_le32(pb) != 0xAA55AA55)
return AVERROR_INVALIDDATA;
static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- CinDemuxContext *cin = (CinDemuxContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ CinDemuxContext *cin = s->priv_data;
+ ByteIOContext *pb = s->pb;
CinFrameHeader *hdr = &cin->frame_header;
int rc, palette_type, pkt_size;
pkt_size = (palette_type + 3) * hdr->pal_colors_count + hdr->video_frame_size;
if (av_new_packet(pkt, 4 + pkt_size))
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
pkt->stream_index = cin->video_stream_index;
pkt->pts = cin->video_stream_pts++;
pkt->data[3] = hdr->video_frame_type;
if (get_buffer(pb, &pkt->data[4], pkt_size) != pkt_size)
- return AVERROR_IO;
+ return AVERROR(EIO);
/* sound buffer will be processed on next read_packet() call */
cin->audio_buffer_size = hdr->audio_frame_size;
/* audio packet */
if (av_new_packet(pkt, cin->audio_buffer_size))
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
pkt->stream_index = cin->audio_stream_index;
pkt->pts = cin->audio_stream_pts;
cin->audio_stream_pts += cin->audio_buffer_size * 2 / cin->file_header.audio_frame_size;
if (get_buffer(pb, pkt->data, cin->audio_buffer_size) != cin->audio_buffer_size)
- return AVERROR_IO;
+ return AVERROR(EIO);
cin->audio_buffer_size = 0;
return 0;
AVInputFormat dsicin_demuxer = {
"dsicin",
- "Delphine Software International CIN format",
+ NULL_IF_CONFIG_SMALL("Delphine Software International CIN format"),
sizeof(CinDemuxContext),
cin_probe,
cin_read_header,