32#define DEFINE_CKSUM_LINE(name, type, conv) \
33static void cksum_line_ ## name(unsigned *cksum, void *data, unsigned size) \
36 unsigned a = *cksum & 0xFFFF, b = *cksum >> 16; \
37 for (; size > 0; size--, p++) { \
38 a = (a + (unsigned)(conv)) % 65521; \
39 b = (b + a) % 65521; \
41 *cksum = a | (b << 16); \
55 int linesize[5] = { 0 };
65 for (
i = 0; linesize[
i];
i++) {
68 if ((
i == 1 ||
i == 2) &&
desc->nb_components >= 3)
71 for (y = 0; y <
h; y++) {
81 int nb_planes, nb_samples, p;
84 nb_planes =
frame->ch_layout.nb_channels;
85 nb_samples =
frame->nb_samples;
87 nb_samples *= nb_planes;
93 for (p = 0; p < nb_planes; p++) {
95 void *d =
frame->extended_data[p];
96 switch (
frame->format) {
99 cksum_line_u8(&cksum, d, nb_samples);
103 cksum_line_s16(&cksum, d, nb_samples);
107 cksum_line_s32(&cksum, d, nb_samples);
111 cksum_line_flt(&cksum, d, nb_samples);
115 cksum_line_dbl(&cksum, d, nb_samples);
135 const char *type_name;
142 stream_index, (*frame)->pts);
143 type =
s->streams[stream_index]->codecpar->codec_type;
145 av_bprintf(&bp,
", %s", type_name ? type_name :
"unknown");
170 .p.name =
"uncodedframecrc",
Public header for Adler-32 hash function implementation.
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c, AVStream *st, AVFrame *frame, AVPacket *pkt)
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
static void write_header(FFV1Context *f)
reference-counted frame API
int ff_framehash_write_header(AVFormatContext *s)
Set the timebase for each stream from the corresponding codec timebase and print it.
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
#define AV_BPRINT_SIZE_UNLIMITED
Buffer will be reallocated as necessary, with an amortized linear cost.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Init a print buffer.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S16
signed 16 bits
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_WRITE_UNCODED_FRAME_QUERY
Query whether the feature is possible on this stream.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Buffer to print data progressively.
unsigned len
length so far
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int write_frame(struct AVFormatContext *s, int stream_index, AVFrame **frame, unsigned flags)
#define DEFINE_CKSUM_LINE(name, type, conv)
static int write_packet(struct AVFormatContext *s, AVPacket *pkt)
static void video_frame_cksum(AVBPrint *bp, AVFrame *frame)
static void audio_frame_cksum(AVBPrint *bp, AVFrame *frame)
static int write_header(struct AVFormatContext *s)