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 "libavutil/avstring.h"
00024 #include "avformat.h"
00025 #include "internal.h"
00026
00027 static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
00028 {
00029 uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
00030 char buf[256];
00031
00032 snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x",
00033 pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
00034 if (pkt->flags != AV_PKT_FLAG_KEY)
00035 av_strlcatf(buf, sizeof(buf), ", F=0x%0X", pkt->flags);
00036 if (pkt->side_data_elems)
00037 av_strlcatf(buf, sizeof(buf), ", S=%d", pkt->side_data_elems);
00038 av_strlcatf(buf, sizeof(buf), "\n");
00039 avio_write(s->pb, buf, strlen(buf));
00040 avio_flush(s->pb);
00041 return 0;
00042 }
00043
00044 AVOutputFormat ff_framecrc_muxer = {
00045 .name = "framecrc",
00046 .long_name = NULL_IF_CONFIG_SMALL("framecrc testing"),
00047 .audio_codec = AV_CODEC_ID_PCM_S16LE,
00048 .video_codec = AV_CODEC_ID_RAWVIDEO,
00049 .write_header = ff_framehash_write_header,
00050 .write_packet = framecrc_write_packet,
00051 .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
00052 };