[Ffmpeg-cvslog] CVS: ffmpeg/libavformat crc.c,1.9,1.10

Michael Niedermayer CVS michael
Sat Nov 5 01:10:24 CET 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv21576

Modified Files:
	crc.c 
Log Message:
per frame crc support


Index: crc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/crc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- crc.c	29 May 2004 02:06:31 -0000	1.9
+++ crc.c	5 Nov 2005 00:10:22 -0000	1.10
@@ -83,7 +83,18 @@
     CRCState *crc = s->priv_data;
     char buf[64];
 
-    snprintf(buf, sizeof(buf), "CRC=%08x\n", crc->crcval);
+    snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
+    put_buffer(&s->pb, buf, strlen(buf));
+    put_flush_packet(&s->pb);
+    return 0;
+}
+
+static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
+{
+    uint32_t crc = update_adler32(0, pkt->data, pkt->size);
+    char buf[256];
+
+    snprintf(buf, sizeof(buf), "%d, %Ld, %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
     put_buffer(&s->pb, buf, strlen(buf));
     put_flush_packet(&s->pb);
     return 0;
@@ -102,8 +113,22 @@
     crc_write_trailer,
 };
 
+static AVOutputFormat framecrc_format = {
+    "framecrc",
+    "framecrc testing format",
+    NULL,
+    "",
+    0,
+    CODEC_ID_PCM_S16LE,
+    CODEC_ID_RAWVIDEO,
+    NULL,
+    framecrc_write_packet,
+    NULL,
+};
+
 int crc_init(void)
 {
     av_register_output_format(&crc_format);
+    av_register_output_format(&framecrc_format);
     return 0;
 }





More information about the ffmpeg-cvslog mailing list