libavformat/movenchint.c File Reference

#include "movenc.h"
#include "libavutil/intreadwrite.h"
#include "internal.h"
#include "rtpenc_chain.h"
#include "avio_internal.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, AVPacket *pkt, 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 *pts)
 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)
void ff_mov_close_hinting (MOVTrack *track)


Function Documentation

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

Definition at line 281 of file movenchint.c.

Referenced by write_hint_packets().

int ff_mov_add_hinted_packet ( AVFormatContext s,
AVPacket pkt,
int  track_index,
int  sample 
)

Definition at line 388 of file movenchint.c.

Referenced by ff_mov_write_packet().

void ff_mov_close_hinting ( MOVTrack track  ) 

Definition at line 442 of file movenchint.c.

Referenced by mov_write_trailer().

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

Definition at line 28 of file movenchint.c.

Referenced by mov_write_header().

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:
data data to find matches for in the sample queue
len length of the data buffer
queue samples used for looking for matching segments
pos the offset in data of the matched segment
match_sample the number of the sample that contained the match
match_offset the offset of the matched segment within the sample
match_len the length of the matched segment
Returns:
0 if a match was found, < 0 if no match was found

Definition at line 213 of file movenchint.c.

Referenced by describe_payload().

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:
haystack buffer that may contain parts of needle
h_len length of the haystack buffer
needle buffer containing source data that have been used to construct haystack
n_pos start position in needle used for looking for matches
n_len length of the needle buffer
match_h_offset_ptr offset of the first matching byte within haystack
match_n_offset_ptr offset of the first matching byte within needle
match_len_ptr length of the matched segment
Returns:
0 if a match was found, < 0 if no match was found

Definition at line 161 of file movenchint.c.

Referenced by find_sample_match().

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

Definition at line 248 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 268 of file movenchint.c.

Referenced by describe_payload().

static void sample_queue_free ( HintSampleQueue queue  )  [static]

Empty the sample queue, releasing all memory.

Definition at line 82 of file movenchint.c.

Referenced by ff_mov_close_hinting().

static void sample_queue_pop ( HintSampleQueue queue  )  [static]

Remove the first sample from the sample queue.

Definition at line 69 of file movenchint.c.

Referenced by find_sample_match().

static void sample_queue_push ( HintSampleQueue queue,
AVPacket pkt,
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 98 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 123 of file movenchint.c.

Referenced by ff_mov_add_hinted_packet().

static int write_hint_packets ( AVIOContext out,
const uint8_t *  data,
int  size,
MOVTrack trk,
int64_t *  pts 
) [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:
out buffer where the hints are written
data buffer containing RTP packets
size the size of the data buffer
trk the MOVTrack for the hint track
pts pointer where the timestamp for the written RTP hint is stored
Returns:
the number of RTP packets in the written hint

Definition at line 313 of file movenchint.c.

Referenced by ff_mov_add_hinted_packet().


Generated on Fri Oct 26 02:43:52 2012 for FFmpeg by  doxygen 1.5.8