aboutsummaryrefslogtreecommitdiffstats
path: root/libav/crc.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/crc.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/crc.c')
-rw-r--r--libav/crc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libav/crc.c b/libav/crc.c
index b1e6d0bea2..159fb25ff8 100644
--- a/libav/crc.c
+++ b/libav/crc.c
@@ -61,15 +61,10 @@ typedef struct CRCState {
UINT32 crcval;
} CRCState;
-/* simple formats */
static int crc_write_header(struct AVFormatContext *s)
{
- CRCState *crc;
- crc = av_malloc(sizeof(CRCState));
- if (!crc)
- return -1;
- s->priv_data = crc;
-
+ CRCState *crc = s->priv_data;
+
/* init CRC */
crc->crcval = adler32(0, NULL, 0);
@@ -93,18 +88,24 @@ static int crc_write_trailer(struct AVFormatContext *s)
snprintf(buf, sizeof(buf), "CRC=%08x\n", crc->crcval);
put_buffer(&s->pb, buf, strlen(buf));
put_flush_packet(&s->pb);
- av_free(crc);
return 0;
}
-AVFormat crc_format = {
+AVOutputFormat crc_format = {
"crc",
"crc testing format",
NULL,
"",
+ sizeof(CRCState),
CODEC_ID_PCM_S16LE,
CODEC_ID_RAWVIDEO,
crc_write_header,
crc_write_packet,
crc_write_trailer,
};
+
+int crc_init(void)
+{
+ av_register_output_format(&crc_format);
+ return 0;
+}