41 0x01, 0x4d, 0x40, 0x1e, 0xff, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
112 char timebuf[30], content[5] = { 0 };
120 default: str =
"unknown";
break;
123 snprintf(timebuf,
sizeof(timebuf),
"nopts");
125 snprintf(timebuf,
sizeof(timebuf),
"%"PRId64, time);
132 memcpy(content, &buf[4], 4);
134 snprintf(content,
sizeof(content),
"-");
135 printf(
"write_data len %d, time %s, type %s atom %s\n",
size, timebuf, str, content);
147 out = fopen(buf,
"wb");
178#define check(value, ...) check_func(value, __LINE__, __VA_ARGS__)
180static void init_fps(
int bf,
int audio_preroll,
int fps,
int id3)
257static void init(
int bf,
int audio_preroll)
264 int end_frames =
frames + n;
266 uint8_t pktdata[8] = { 0 };
271 pkt->stream_index = 1;
279 pkt->stream_index = 0;
320 pkt->pts += (1LL<<32);
321 pkt->dts += (1LL<<32);
333 uint8_t pktdata[8] = { 0 };
364 pkt->stream_index = 0;
369 pkt->stream_index = 1;
384 printf(
"movenc-test [-w]\n"
385 "-w write output into files\n");
492 init_out(
"empty-moov-no-elst-no-adjust");
539 init_out(
"delay-moov-empty-track-flush");
567 empty_moov_pos = prev_pos =
out_size;
584 check(
out_size == 0,
"Output written during init with delay_moov");
591 check(
out_size == empty_moov_pos,
"Manually flushed content differs from automatically flushed, %d vs %d",
out_size, empty_moov_pos);
595 check(!memcmp(
hash, content,
HASH_SIZE),
"delay_moov content differs from empty_moov");
615 av_dict_set(&
opts,
"movflags",
"+frag_custom+empty_moov+dash+frag_discont", 0);
621 init_out(
"empty-moov-second-frag-discont");
630 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
636 init_out(
"delay-moov-second-frag-discont");
654 init_out(
"delay-moov-elst-second-frag");
661 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
666 init_out(
"delay-moov-elst-init-discont");
670 init_out(
"delay-moov-elst-second-frag-discont");
682 init_out(
"delay-moov-elst-signal-init");
687 init_out(
"delay-moov-elst-signal-second-frag");
694 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
700 init_out(
"delay-moov-elst-signal-init-discont");
704 init_out(
"delay-moov-elst-signal-second-frag-discont");
712 av_dict_set(&
opts,
"movflags",
"+frag_custom+delay_moov+dash+frag_discont", 0);
718 init_out(
"delay-moov-elst-signal-init-discont-largets");
721 init_out(
"delay-moov-elst-signal-second-frag-discont-largets");
786 init_out(
"vfr-noduration-interleave");
809 init_out(
"delay-moov-elst-neg-cts");
810 av_dict_set(&
opts,
"movflags",
"+frag_keyframe+delay_moov+negative_cts_offsets", 0);
820 av_dict_set(&
opts,
"movflags",
"+frag_keyframe+empty_moov+negative_cts_offsets", 0);
static const char *const format[]
AVIODataMarkerType
Different data types that can be returned via the AVIO write_data_type callback.
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
@ AVIO_DATA_MARKER_TRAILER
Trailer data, which doesn't contain actual content, but only for finalizing the output file.
@ AVIO_DATA_MARKER_HEADER
Header data; this needs to be present for the stream to be decodeable.
@ AVIO_DATA_MARKER_UNKNOWN
This is any, unlabelled data.
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
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.
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
int(* init)(AVBSFContext *ctx)
static int getopt(int argc, char *argv[], const char *opts)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
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.
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
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...
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
#define AV_CHANNEL_LAYOUT_STEREO
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_LOG_WARNING
Something somehow does not look correct.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
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.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
Update hash value.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define AV_NOPTS_VALUE
Undefined timestamp value.
Public header for MD5 hash function implementation.
Memory handling functions.
static const uint8_t header[24]
An AVChannelLayout holds information about the channel layout of audio data.
int extradata_size
Size of the extradata content in bytes.
int frame_size
Audio frame size, if known.
int height
The height of the video frame in pixels.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
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.
static int io_write(void *opaque, const uint8_t *buf, int size)
static int64_t audio_duration
static void mux_gops(int n)
static int io_write_data_type(void *opaque, const uint8_t *buf, int size, enum AVIODataMarkerType type, int64_t time)
static void skip_gops(int n)
static void count_warnings(void *avcl, int level, const char *fmt, va_list vl)
static struct AVMD5 * md5
static void reset_count_warnings(void)
static int fake_pkt_duration
static int skip_write_audio
static const uint8_t h264_extradata[]
static AVStream * audio_st
static void mux_frames(int n, int c)
static void mux_id3(void)
static AVStream * video_st
static uint8_t iobuf[32768]
static uint8_t hash[HASH_SIZE]
static void init_out(const char *name)
static AVFormatContext * ctx
static int force_iobuf_size
static const char * cur_name
static enum AVPictureType last_picture
static void close_out(void)
static const uint8_t aac_extradata[]
static int clear_duration
static int64_t next_p_pts
static void init_count_warnings(void)
static void signal_init_ts(void)
static AVDictionary * opts
static void init_fps(int bf, int audio_preroll, int fps, int id3)