60 "Unable to initialize hinting of stream %d\n", src_index);
86 for (i = 0; i < queue->
len; i++)
128 for (i = 0; i < queue->
len; ) {
139 memcpy(ptr, sample->
data, sample->
size);
164 const uint8_t *needle,
int n_pos,
int n_len,
165 int *match_h_offset_ptr,
int *match_n_offset_ptr,
169 for (h_pos = 0; h_pos < h_len; h_pos++) {
171 int match_h_pos, match_n_pos;
174 while (h_pos + match_len < h_len && n_pos + match_len < n_len &&
175 needle[n_pos + match_len] == haystack[h_pos + match_len])
184 while (match_n_pos > 0 && match_h_pos > 0 &&
185 needle[match_n_pos - 1] == haystack[match_h_pos - 1]) {
192 *match_h_offset_ptr = match_h_pos;
193 *match_n_offset_ptr = match_n_pos;
194 *match_len_ptr = match_len;
217 int *match_sample,
int *match_offset,
220 while (queue->
len > 0) {
228 sample->
size, pos, match_offset, match_len) == 0) {
232 sample->
offset = *match_offset + *match_len + 5;
238 if (sample->
offset < 10 && sample->
size > 20) {
263 for (; len < 14; len++)
271 int match_offset,
int match_len,
int *entries)
289 int match_sample, match_offset, match_len, pos;
291 &match_offset, &match_len) < 0)
296 output_match(out, match_sample, match_offset, match_len, entries);
319 int64_t count_pos, entries_pos;
320 int count = 0, entries;
328 uint32_t packet_len =
AV_RB32(data);
335 if (packet_len > size || packet_len <= 12)
402 int track_index,
int sample,
403 uint8_t *sample_data,
int sample_size)
447 hint_pkt.
pts = hint_pkt.
dts;
static void output_match(AVIOContext *out, int match_sample, int match_offset, int match_len, int *entries)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
ptrdiff_t const GLvoid * data
static int find_sample_match(const uint8_t *data, int len, HintSampleQueue *queue, int *pos, int *match_sample, int *match_offset, int *match_len)
Look for segments in samples in the sample queue matching the data in ptr.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void output_immediate(const uint8_t *data, int size, AVIOContext *out, int *entries)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define RTP_MAX_PACKET_SIZE
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size, int sample)
Add a reference to the sample data to the sample queue.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
HintSampleQueue sample_queue
Opaque data information usually continuous.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
AVStream ** streams
A list of all streams in the file.
static int write_hint_packets(AVIOContext *out, const uint8_t *data, int size, MOVTrack *trk, int64_t *dts)
Write an RTP hint (that may contain one or more RTP packets) for the packets in data.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int flags
A combination of AV_PKT_FLAG values.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
Open a write only packetized memory stream with a maximum packet size of 'max_packet_size'.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
static void describe_payload(const uint8_t *data, int size, AVIOContext *out, int *entries, HintSampleQueue *queue)
static void sample_queue_free(HintSampleQueue *queue)
Empty the sample queue, releasing all memory.
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
int hint_track
the track that hints this track, -1 if no hint track is set
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
static void sample_queue_pop(HintSampleQueue *queue)
Remove the first sample from the sample queue.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
#define RTP_PT_IS_RTCP(x)
void avio_wb16(AVIOContext *s, unsigned int val)
AVFormatContext * rtp_ctx
the format context for the hinting rtp muxer
int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size, int idx)
static void sample_queue_retain(HintSampleQueue *queue)
Make local copies of all referenced sample data in the queue.
int src_track
the track that this hint (or tmcd) track describes
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
void * priv_data
Format private data.
void ff_mov_close_hinting(MOVTrack *track)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
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.
void avio_wb32(AVIOContext *s, unsigned int val)
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define MKTAG(a, b, c, d)
static int match_segments(const uint8_t *haystack, int h_len, const uint8_t *needle, int n_pos, int n_len, int *match_h_offset_ptr, int *match_n_offset_ptr, int *match_len_ptr)
Find matches of needle[n_pos ->] within haystack.
This structure stores compressed data.
int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, int track_index, int sample, uint8_t *sample_data, int sample_size)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t cur_rtp_ts_unwrapped
#define AV_NOPTS_VALUE
Undefined timestamp value.