*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
AVStream *audio;
} C93DemuxContext;
-static int c93_probe(AVProbeData *p)
+static int probe(AVProbeData *p)
{
- if (p->buf_size < 13)
- return 0;
-
if (p->buf[0] == 0x01 && p->buf[1] == 0x00 &&
p->buf[4] == 0x01 + p->buf[2] &&
p->buf[8] == p->buf[4] + p->buf[6] &&
return 0;
}
-static int c93_read_header(AVFormatContext *s,
+static int read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
AVStream *video;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data;
int i;
int framecount = 0;
video = av_new_stream(s, 0);
if (!video)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
video->codec->codec_type = CODEC_TYPE_VIDEO;
video->codec->codec_id = CODEC_ID_C93;
#define C93_HAS_PALETTE 0x01
#define C93_FIRST_FRAME 0x02
-static int c93_read_packet(AVFormatContext *s, AVPacket *pkt)
+static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data;
C93BlockRecord *br = &c93->block_records[c93->current_block];
int datasize;
if (!c93->audio) {
c93->audio = av_new_stream(s, 1);
if (!c93->audio)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
c93->audio->codec->codec_type = CODEC_TYPE_AUDIO;
}
url_fskip(pb, 26); /* VOC header */
}
if (c93->current_frame >= br->frames) {
if (c93->current_block >= 511 || !br[1].length)
- return AVERROR_IO;
+ return AVERROR(EIO);
br++;
c93->current_block++;
c93->current_frame = 0;
ret = get_buffer(pb, pkt->data + 1, datasize);
if (ret < datasize) {
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
goto fail;
}
pkt->data[0] |= C93_HAS_PALETTE;
ret = get_buffer(pb, pkt->data + pkt->size, datasize);
if (ret < datasize) {
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
goto fail;
}
pkt->size += 768;
"c93",
"Interplay C93",
sizeof(C93DemuxContext),
- c93_probe,
- c93_read_header,
- c93_read_packet,
+ probe,
+ read_header,
+ read_packet,
};