summaryrefslogtreecommitdiff
path: root/libavformat/crc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-11-05 00:10:22 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-11-05 00:10:22 +0000
commit840fb7a76db9238554f0dbe1a84e660a6f16cdb1 (patch)
treec5c871562f4dea56e670bae558bc444c2dd3bad5 /libavformat/crc.c
parentc555392a5bb2fee136df52508a217f4e40b18228 (diff)
per frame crc support
Originally committed as revision 4677 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/crc.c')
-rw-r--r--libavformat/crc.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/libavformat/crc.c b/libavformat/crc.c
index ee915debc5..809102564a 100644
--- a/libavformat/crc.c
+++ b/libavformat/crc.c
@@ -83,7 +83,18 @@ static int crc_write_trailer(struct AVFormatContext *s)
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 @@ static AVOutputFormat crc_format = {
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;
}