00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavutil/adler32.h"
00023 #include "avformat.h"
00024 #include "internal.h"
00025
00026 static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
00027 {
00028 uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
00029 char buf[256];
00030
00031 snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x\n",
00032 pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
00033 avio_write(s->pb, buf, strlen(buf));
00034 avio_flush(s->pb);
00035 return 0;
00036 }
00037
00038 AVOutputFormat ff_framecrc_muxer = {
00039 .name = "framecrc",
00040 .long_name = NULL_IF_CONFIG_SMALL("framecrc testing"),
00041 .audio_codec = AV_CODEC_ID_PCM_S16LE,
00042 .video_codec = AV_CODEC_ID_RAWVIDEO,
00043 .write_header = ff_framehash_write_header,
00044 .write_packet = framecrc_write_packet,
00045 .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
00046 };