xine-lib: xine-lib-1.2.12/src/xine-utils/mfrag.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Functions
mfrag.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <xine/mfrag.h>`

## Data Structures
struct | xine_mfrag_frag_t
struct | xine_mfrag_list_s

## Macros
#define | LOG_MODULE "mfrag"
#define | LOG_VERBOSE
#define | MFRAG_STEP 256

## Functions
static void | _xine_mfrag_fix (xine_mfrag_list_t *list, uint32_t last)
static void | _xine_mfrag_test (xine_mfrag_list_t *list, uint32_t last)
void | xine_mfrag_list_open (xine_mfrag_list_t **plist)
int | xine_mfrag_set_index_frag (xine_mfrag_list_t *list, xine_mfrag_index_t index, int64_t dur, off_t len)
int32_t | xine_mfrag_get_frag_count (xine_mfrag_list_t *list)
xine_mfrag_index_t | xine_mfrag_find_time (xine_mfrag_list_t *list, int64_t timepos)
xine_mfrag_index_t | xine_mfrag_find_pos (xine_mfrag_list_t *list, off_t offs)
int | xine_mfrag_get_index_frag (xine_mfrag_list_t *list, xine_mfrag_index_t index, int64_t *dur, off_t *len)
int | xine_mfrag_get_index_start (xine_mfrag_list_t *list, xine_mfrag_index_t index, int64_t *timepos, off_t *offs)
void | xine_mfrag_list_close (xine_mfrag_list_t **plist)

## Macro Definition Documentation

## ◆ LOG_MODULE

#define LOG_MODULE "mfrag"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MFRAG_STEP

#define MFRAG_STEP 256

## Function Documentation

## ◆ _xine_mfrag_fix()

static void _xine_mfrag_fix | ( | xine_mfrag_list_t * | list,
|  | uint32_t | last
| ) |  |
| static

rebuild on demand only, for speed, and forward only, to avoid mass confusion.

References xine_mfrag_list_s::avg_d, xine_mfrag_list_s::avg_l, xine_mfrag_frag_t::d, xine_mfrag_list_s::dirty_from, xine_mfrag_list_s::frags, xine_mfrag_list_s::known_d, xine_mfrag_list_s::known_l, xine_mfrag_list_s::known_nd, xine_mfrag_list_s::known_nl, xine_mfrag_frag_t::l, xine_mfrag_frag_t::p, and xine_mfrag_frag_t::t.

Referenced by _xine_mfrag_test().

## ◆ _xine_mfrag_test()

static void _xine_mfrag_test | ( | xine_mfrag_list_t * | list,
|  | uint32_t | last
| ) |  |
| static

References _xine_mfrag_fix(), and xine_mfrag_list_s::dirty_from.

Referenced by xine_mfrag_find_pos(), xine_mfrag_find_time(), and xine_mfrag_get_index_start().

## ◆ xine_mfrag_find_pos()

xine_mfrag_index_t xine_mfrag_find_pos | ( | xine_mfrag_list_t * | list,
|  | off_t | offs
| ) |  |

References _xine_mfrag_test(), xine_mfrag_list_s::frags, xine_mfrag_frag_t::l, xine_mfrag_frag_t::p, and xine_mfrag_list_s::used.

Referenced by hls_input_seek(), mpd_input_seek(), rip_plugin_get_current_time(), and rip_plugin_seek_time().

## ◆ xine_mfrag_find_time()

xine_mfrag_index_t xine_mfrag_find_time | ( | xine_mfrag_list_t * | list,
|  | int64_t | timepos
| ) |  |

find the media fragment that contains the specified timepos or offs.

References _xine_mfrag_test(), xine_mfrag_list_s::frags, xine_mfrag_frag_t::t, and xine_mfrag_list_s::used.

Referenced by hls_input_time_seek(), mpd_input_time_seek(), and rip_plugin_seek_time().

## ◆ xine_mfrag_get_frag_count()

int32_t xine_mfrag_get_frag_count | ( | xine_mfrag_list_t * | list | ) |

returns the "n" above.

References xine_mfrag_list_s::used.

Referenced by demux_qt_load_fragment_index(), mpd_input_get_length(), mpd_input_get_optional_data(), mpd_input_seek(), mpd_input_time_seek(), rip_plugin_get_current_time(), and rip_plugin_seek_time().

## ◆ xine_mfrag_get_index_frag()

int xine_mfrag_get_index_frag | ( | xine_mfrag_list_t * | list,
|  | xine_mfrag_index_t | index,
|  | int64_t * | dur,
|  | off_t * | len
| ) |  |

References xine_mfrag_frag_t::d, xine_mfrag_list_s::frags, xine_mfrag_list_s::have, and xine_mfrag_frag_t::l.

Referenced by hls_frag_start(), mpd_frag_seen(), rip_plugin_get_current_time(), and rip_plugin_seek_time().

## ◆ xine_mfrag_get_index_start()

int xine_mfrag_get_index_start | ( | xine_mfrag_list_t * | list,
|  | xine_mfrag_index_t | index,
|  | int64_t * | timepos,
|  | off_t * | offs
| ) |  |

index 0: timepos = 0. offs = 0. these values will be estimated if some previous fragment has an "unknown" setting: 1..n: timepos = fragment start time in timebase units. offs = fragment start offs in bytes. n + 1: timepos = total time in timebase units. offs = total size in bytes.

References _xine_mfrag_test(), xine_mfrag_list_s::frags, xine_mfrag_list_s::have, xine_mfrag_frag_t::p, and xine_mfrag_frag_t::t.

Referenced by demux_qt_load_fragment_index(), hls_get_duration(), hls_get_size(), hls_input_seek(), hls_input_time_seek(), mpd_input_get_length(), mpd_input_get_optional_data(), mpd_input_seek(), mpd_input_time_seek(), rip_plugin_get_current_time(), and rip_plugin_seek_time().

## ◆ xine_mfrag_list_close()

void xine_mfrag_list_close | ( | xine_mfrag_list_t ** | plist | ) |

References xine_mfrag_list_s::frags, NULL, and xine_mfrag_list_s::refs.

Referenced by hls_input_dispose(), hls_input_load_list(), and mpd_input_dispose().

## ◆ xine_mfrag_list_open()

void xine_mfrag_list_open | ( | xine_mfrag_list_t ** | plist | ) |

*plist may be NULL.

References xine_mfrag_list_s::avg_d, xine_mfrag_list_s::avg_l, xine_mfrag_frag_t::d, xine_mfrag_list_s::dirty_from, xine_mfrag_list_s::frags, xine_mfrag_list_s::have, xine_mfrag_list_s::known_d, xine_mfrag_list_s::known_l, xine_mfrag_list_s::known_nd, xine_mfrag_list_s::known_nl, xine_mfrag_frag_t::l, MFRAG_STEP, xine_mfrag_frag_t::p, xine_mfrag_list_s::refs, xine_mfrag_frag_t::t, and xine_mfrag_list_s::used.

Referenced by hls_input_load_list(), and mpd_input_open().

## ◆ xine_mfrag_set_index_frag()

int xine_mfrag_set_index_frag | ( | xine_mfrag_list_t * | list,
|  | xine_mfrag_index_t | index,
|  | int64_t | dur,
|  | off_t | len
| ) |  |

index 0: dur = timebase or -1 (no change). len = head size in bytes or -1 (no change). 1..n: dur = fragment duration in timebase units or 0 (unknown), -1 (no change). len = fragment size or 0 (unknown), -1 (no change). n + 1: dur = set: new fragment duration in timebase units or 0/-1 (unknown). get: 0. len = set: new fragment size or 0/-1 (unknown). get: 0.

References xine_mfrag_frag_t::d, xine_mfrag_list_s::dirty_from, xine_mfrag_list_s::frags, xine_mfrag_list_s::have, xine_mfrag_list_s::known_d, xine_mfrag_list_s::known_l, xine_mfrag_list_s::known_nd, xine_mfrag_list_s::known_nl, xine_mfrag_frag_t::l, MFRAG_STEP, and xine_mfrag_list_s::used.

Referenced by demux_qt_load_fragment_index(), hls_frag_end(), hls_frag_start(), hls_input_load_list(), mpd_frag_end(), mpd_frag_seen(), and mpd_input_open().