aboutsummaryrefslogtreecommitdiffstats
path: root/libav/avidec.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-05-20 16:31:13 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-05-20 16:31:13 +0000
commitc9a65ca8c306071b3c359b56a384a1594cd505df (patch)
treea33c4b156673f2c1404042501c1cebaae6a35457 /libav/avidec.c
parentdb7f1f95acc050bb5ddf62b0008eab8c8305d369 (diff)
downloadffmpeg-c9a65ca8c306071b3c359b56a384a1594cd505df.tar.gz
converted to new API
Originally committed as revision 547 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/avidec.c')
-rw-r--r--libav/avidec.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/libav/avidec.c b/libav/avidec.c
index 4af2d661b9..1ede7b8f3a 100644
--- a/libav/avidec.c
+++ b/libav/avidec.c
@@ -47,19 +47,13 @@ void print_tag(const char *str, unsigned int tag, int size)
int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- AVIContext *avi;
+ AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb;
UINT32 tag, tag1;
int codec_type, stream_index, size, frame_period, bit_rate;
int i, bps;
AVStream *st;
- avi = av_malloc(sizeof(AVIContext));
- if (!avi)
- return -1;
- memset(avi, 0, sizeof(AVIContext));
- s->priv_data = avi;
-
/* check RIFF header */
tag = get_le32(pb);
@@ -246,7 +240,35 @@ int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
int avi_read_close(AVFormatContext *s)
{
- AVIContext *avi = s->priv_data;
- av_free(avi);
+ return 0;
+}
+
+static int avi_probe(AVProbeData *p)
+{
+ /* check file header */
+ if (p->buf_size <= 32)
+ return 0;
+ if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
+ p->buf[2] == 'F' && p->buf[3] == 'F' &&
+ p->buf[8] == 'A' && p->buf[9] == 'V' &&
+ p->buf[10] == 'I' && p->buf[11] == ' ')
+ return AVPROBE_SCORE_MAX;
+ else
+ return 0;
+}
+
+static AVInputFormat avi_iformat = {
+ "avi",
+ "avi format",
+ sizeof(AVIContext),
+ avi_probe,
+ avi_read_header,
+ avi_read_packet,
+ avi_read_close,
+};
+
+int avidec_init(void)
+{
+ av_register_input_format(&avi_iformat);
return 0;
}