FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
movenchint.c File Reference
#include "movenc.h"
#include "libavutil/intreadwrite.h"
#include "internal.h"
#include "rtpenc_chain.h"
#include "avio_internal.h"
#include "rtp.h"

Go to the source code of this file.

Functions

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.
 
static void sample_queue_free (HintSampleQueue *queue)
 Empty the sample queue, releasing all memory.
 
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.
 
static void sample_queue_retain (HintSampleQueue *queue)
 Make local copies of all referenced sample data in the queue.
 
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.
 
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.
 
static void output_immediate (const uint8_t *data, int size, AVIOContext *out, int *entries)
 
static void output_match (AVIOContext *out, int match_sample, int match_offset, int match_len, int *entries)
 
static void describe_payload (const uint8_t *data, int size, AVIOContext *out, int *entries, HintSampleQueue *queue)
 
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.
 
int ff_mov_add_hinted_packet (AVFormatContext *s, AVPacket *pkt, int track_index, int sample, uint8_t *sample_data, int sample_size)
 
void ff_mov_close_hinting (MOVTrack *track)
 

Function Documentation

int ff_mov_init_hinting ( AVFormatContext s,
int  index,
int  src_index 
)

Definition at line 29 of file movenchint.c.

Referenced by mov_write_header().

static void sample_queue_pop ( HintSampleQueue queue)
static

Remove the first sample from the sample queue.

Definition at line 70 of file movenchint.c.

Referenced by find_sample_match().

static void sample_queue_free ( HintSampleQueue queue)
static

Empty the sample queue, releasing all memory.

Definition at line 83 of file movenchint.c.

Referenced by ff_mov_close_hinting().

static void sample_queue_push ( HintSampleQueue queue,
uint8_t data,
int  size,
int  sample 
)
static

Add a reference to the sample data to the sample queue.

The data is not copied. sample_queue_retain should be called before pkt->data is reused/freed.

Definition at line 99 of file movenchint.c.

Referenced by ff_mov_add_hinted_packet().

static void sample_queue_retain ( HintSampleQueue queue)
static

Make local copies of all referenced sample data in the queue.

Definition at line 125 of file movenchint.c.

Referenced by ff_mov_add_hinted_packet().

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 
)
static

Find matches of needle[n_pos ->] within haystack.

If a sufficiently large match is found, matching bytes before n_pos are included in the match, too (within the limits of the arrays).

Parameters
haystackbuffer that may contain parts of needle
h_lenlength of the haystack buffer
needlebuffer containing source data that have been used to construct haystack
n_posstart position in needle used for looking for matches
n_lenlength of the needle buffer
match_h_offset_ptroffset of the first matching byte within haystack
match_n_offset_ptroffset of the first matching byte within needle
match_len_ptrlength of the matched segment
Returns
0 if a match was found, < 0 if no match was found

Definition at line 163 of file movenchint.c.

Referenced by find_sample_match().

static int find_sample_match ( const uint8_t data,
int  len,
HintSampleQueue queue,
int *  pos,
int *  match_sample,
int *  match_offset,
int *  match_len 
)
static

Look for segments in samples in the sample queue matching the data in ptr.

Samples not matching are removed from the queue. If a match is found, the next time it will look for matches starting from the end of the previous matched segment.

Parameters
datadata to find matches for in the sample queue
lenlength of the data buffer
queuesamples used for looking for matching segments
posthe offset in data of the matched segment
match_samplethe number of the sample that contained the match
match_offsetthe offset of the matched segment within the sample
match_lenthe length of the matched segment
Returns
0 if a match was found, < 0 if no match was found

Definition at line 215 of file movenchint.c.

Referenced by describe_payload().

static void output_immediate ( const uint8_t data,
int  size,
AVIOContext out,
int *  entries 
)
static

Definition at line 250 of file movenchint.c.

Referenced by describe_payload().

static void output_match ( AVIOContext out,
int  match_sample,
int  match_offset,
int  match_len,
int *  entries 
)
static

Definition at line 270 of file movenchint.c.

Referenced by describe_payload().

static void describe_payload ( const uint8_t data,
int  size,
AVIOContext out,
int *  entries,
HintSampleQueue queue 
)
static

Definition at line 283 of file movenchint.c.

Referenced by write_hint_packets().

static int write_hint_packets ( AVIOContext out,
const uint8_t data,
int  size,
MOVTrack trk,
int64_t *  dts 
)
static

Write an RTP hint (that may contain one or more RTP packets) for the packets in data.

data contains one or more packets with a BE32 size header.

Parameters
outbuffer where the hints are written
databuffer containing RTP packets
sizethe size of the data buffer
trkthe MOVTrack for the hint track
dtspointer where the timestamp for the written RTP hint is stored
Returns
the number of RTP packets in the written hint

Definition at line 315 of file movenchint.c.

Referenced by ff_mov_add_hinted_packet().

int ff_mov_add_hinted_packet ( AVFormatContext s,
AVPacket pkt,
int  track_index,
int  sample,
uint8_t sample_data,
int  sample_size 
)

Definition at line 401 of file movenchint.c.

Referenced by ff_mov_write_packet().

void ff_mov_close_hinting ( MOVTrack track)

Definition at line 459 of file movenchint.c.

Referenced by mov_write_trailer().