40 0x01, 0x4d, 0x40, 0x1e, 0xff, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
100 fwrite(buf, 1, size,
out);
112 out = fopen(buf,
"wb");
124 printf(
"%02x",
hash[i]);
136 printf(
"%d: ", line);
143 #define check(value, ...) check_func(value, __LINE__, __VA_ARGS__)
145 static void init_fps(
int bf,
int audio_preroll,
int fps)
207 static void init(
int bf,
int audio_preroll)
243 if (((
frames + 1) % gop_size) == 0) {
309 printf(
"movenc-test [-w]\n"
310 "-w write output into files\n");
313 int main(
int argc,
char **argv)
322 c =
getopt(argc, argv,
"wh");
346 av_dict_set(&opts,
"movflags",
"frag_keyframe", 0);
355 av_dict_set(&opts,
"movflags",
"frag_keyframe", 0);
367 av_dict_set(&opts,
"movflags",
"frag_keyframe", 0);
377 av_dict_set(&opts,
"movflags",
"frag_keyframe", 0);
387 av_dict_set(&opts,
"movflags",
"frag_keyframe+empty_moov", 0);
399 av_dict_set(&opts,
"movflags",
"frag_keyframe+empty_moov", 0);
410 init_out(
"empty-moov-no-elst-no-adjust");
411 av_dict_set(&opts,
"movflags",
"frag_keyframe+empty_moov", 0);
424 av_dict_set(&opts,
"movflags",
"frag_keyframe+delay_moov", 0);
434 av_dict_set(&opts,
"movflags",
"frag_keyframe+delay_moov", 0);
443 av_dict_set(&opts,
"movflags",
"frag_keyframe+delay_moov", 0);
457 init_out(
"delay-moov-empty-track-flush");
458 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov", 0);
476 av_dict_set(&opts,
"movflags",
"frag_keyframe+empty_moov", 0);
485 empty_moov_pos = prev_pos =
out_size;
499 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov", 0);
502 check(
out_size == 0,
"Output written during init with delay_moov");
509 check(
out_size == empty_moov_pos,
"Manually flushed content differs from automatically flushed, %d vs %d",
out_size, empty_moov_pos);
513 check(!memcmp(
hash, content,
HASH_SIZE),
"delay_moov content differs from empty_moov");
520 av_dict_set(&opts,
"movflags",
"frag_custom+empty_moov+dash", 0);
533 av_dict_set(&opts,
"movflags",
"frag_custom+empty_moov+dash+frag_discont", 0);
539 init_out(
"empty-moov-second-frag-discont");
548 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov+dash+frag_discont", 0);
554 init_out(
"delay-moov-second-frag-discont");
564 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov+dash", 0);
572 init_out(
"delay-moov-elst-second-frag");
579 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov+dash+frag_discont", 0);
584 init_out(
"delay-moov-elst-init-discont");
588 init_out(
"delay-moov-elst-second-frag-discont");
597 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov+dash", 0);
600 init_out(
"delay-moov-elst-signal-init");
605 init_out(
"delay-moov-elst-signal-second-frag");
612 av_dict_set(&opts,
"movflags",
"frag_custom+delay_moov+dash+frag_discont", 0);
618 init_out(
"delay-moov-elst-signal-init-discont");
622 init_out(
"delay-moov-elst-signal-second-frag-discont");
642 av_dict_set(&opts,
"movflags",
"frag_keyframe+delay_moov+dash", 0);
661 av_dict_set(&opts,
"movflags",
"frag_keyframe+delay_moov+dash", 0);
int main(int argc, char **argv)
static void reset_count_warnings(void)
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
#define AVIO_FLAG_WRITE
write-only
static void skip_gops(int n)
static void init_out(const char *name)
void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
Update hash value.
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static void signal_init_ts(void)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int flags
Flags modifying the (de)muxer behaviour.
static const uint8_t header[24]
static void check_func(int value, int line, const char *msg,...)
static void count_warnings(void *avcl, int level, const char *fmt, va_list vl)
struct AVOutputFormat * oformat
The output container format.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVMediaType codec_type
General type of the encoded data.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
int flags
A combination of AV_PKT_FLAG values.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare 2 timestamps each in its own timebases.
int extradata_size
Size of the extradata content in bytes.
static void mux_frames(int n)
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
GLsizei GLboolean const GLfloat * value
enum AVPictureType last_picture
AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
static void init_count_warnings(void)
AVIOContext * pb
I/O context.
static const char * format
static int getopt(int argc, char *argv[], char *opts)
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static void init(int bf, int audio_preroll)
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
static void mux_gops(int n)
int sample_rate
Audio only.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
static int io_write(void *opaque, uint8_t *buf, int size)
static void init_fps(int bf, int audio_preroll, int fps)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static void close_out(void)
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
static const uint8_t aac_extradata[]
static const uint8_t h264_extradata[]
AVCodecParameters * codecpar
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...