Go to the documentation of this file.
40 0x01, 0x4d, 0x40, 0x1e, 0xff, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
111 char timebuf[30], content[5] = { 0 };
119 default: str =
"unknown";
break;
122 snprintf(timebuf,
sizeof(timebuf),
"nopts");
124 snprintf(timebuf,
sizeof(timebuf),
"%"PRId64, time);
131 memcpy(content, &buf[4], 4);
133 snprintf(content,
sizeof(content),
"-");
134 printf(
"write_data len %d, time %s, type %s atom %s\n",
size, timebuf, str, content);
146 out = fopen(buf,
"wb");
177 #define check(value, ...) check_func(value, __LINE__, __VA_ARGS__)
179 static void init_fps(
int bf,
int audio_preroll,
int fps)
243 static void init(
int bf,
int audio_preroll)
250 int end_frames =
frames + n;
252 uint8_t pktdata[8] = { 0 };
352 printf(
"movenc-test [-w]\n"
353 "-w write output into files\n");
356 int main(
int argc,
char **argv)
456 init_out(
"empty-moov-no-elst-no-adjust");
503 init_out(
"delay-moov-empty-track-flush");
531 empty_moov_pos = prev_pos =
out_size;
548 check(
out_size == 0,
"Output written during init with delay_moov");
555 check(
out_size == empty_moov_pos,
"Manually flushed content differs from automatically flushed, %d vs %d",
out_size, empty_moov_pos);
559 check(!memcmp(
hash, content,
HASH_SIZE),
"delay_moov content differs from empty_moov");
579 av_dict_set(&
opts,
"movflags",
"+frag_custom+empty_moov+dash+frag_discont", 0);
585 init_out(
"empty-moov-second-frag-discont");
594 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
600 init_out(
"delay-moov-second-frag-discont");
618 init_out(
"delay-moov-elst-second-frag");
625 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
630 init_out(
"delay-moov-elst-init-discont");
634 init_out(
"delay-moov-elst-second-frag-discont");
646 init_out(
"delay-moov-elst-signal-init");
651 init_out(
"delay-moov-elst-signal-second-frag");
658 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
664 init_out(
"delay-moov-elst-signal-init-discont");
668 init_out(
"delay-moov-elst-signal-second-frag-discont");
676 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
682 init_out(
"delay-moov-elst-signal-init-discont-largets");
685 init_out(
"delay-moov-elst-signal-second-frag-discont-largets");
750 init_out(
"vfr-noduration-interleave");
773 init_out(
"delay-moov-elst-neg-cts");
774 av_dict_set(&
opts,
"movflags",
"+frag_keyframe+delay_moov+negative_cts_offsets", 0);
784 av_dict_set(&
opts,
"movflags",
"+frag_keyframe+empty_moov+negative_cts_offsets", 0);
static const uint8_t aac_extradata[]
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
enum AVMediaType codec_type
General type of the encoded data.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
#define AV_CHANNEL_LAYOUT_STEREO
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static const uint8_t h264_extradata[]
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
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, const 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.
enum AVPictureType last_picture
static void check_func(int value, int line, const char *msg,...)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
AVIODataMarkerType
Different data types that can be returned via the AVIO write_data_type callback.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
int(* write_data_type)(void *opaque, const uint8_t *buf, int buf_size, enum AVIODataMarkerType type, int64_t time)
A callback that is used instead of write_packet.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static void mux_frames(int n, int c)
static int getopt(int argc, char *argv[], char *opts)
int flags
Flags modifying the (de)muxer behaviour.
static void reset_count_warnings(void)
static void mux_gops(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.
static int io_write_data_type(void *opaque, const uint8_t *buf, int size, enum AVIODataMarkerType type, int64_t time)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
@ AVIO_DATA_MARKER_TRAILER
Trailer data, which doesn't contain actual content, but only for finalizing the output file.
@ AV_PICTURE_TYPE_I
Intra.
AVIOContext * pb
I/O context.
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
AVChannelLayout ch_layout
Audio only.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
int extradata_size
Size of the extradata content in bytes.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
An AVChannelLayout holds information about the channel layout of audio data.
#define AV_NOPTS_VALUE
Undefined timestamp value.
printf("static const uint8_t my_array[100] = {\n")
static void init_out(const char *name)
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
static const uint8_t header[24]
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
static void init_fps(int bf, int audio_preroll, int fps)
static void init(int bf, int audio_preroll)
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
static void skip_gops(int n)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
static const char * format
@ AVIO_DATA_MARKER_UNKNOWN
This is any, unlabelled data.
const struct AVOutputFormat * oformat
The output container format.
int main(int argc, char **argv)
#define AV_INPUT_BUFFER_PADDING_SIZE
static void close_out(void)
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
@ AVIO_DATA_MARKER_HEADER
Header data; this needs to be present for the stream to be decodeable.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
static void init_count_warnings(void)
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
Update hash value.
@ AV_PICTURE_TYPE_P
Predicted.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
const 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...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
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 signal_init_ts(void)
static int io_write(void *opaque, const uint8_t *buf, int size)
static void count_warnings(void *avcl, int level, const char *fmt, va_list vl)