VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
vout_subpictures.c File Reference
Include dependency graph for vout_subpictures.c:

Data Structures

struct  spu_heap_entry_t
struct  spu_heap_t
struct  spu_private_t
struct  filter_owner_sys_t
struct  spu_scale_t
struct  spu_area_t
 A few area functions helpers. More...

Macros

#define VOUT_MAX_SUBPICTURES   (__MAX(VOUT_MAX_PICTURES, SPU_MAX_PREPARE_TIME/5000))
#define SCALE_UNIT   (1000)
 A few scale functions helpers.

Functions

static void SpuHeapInit (spu_heap_t *heap)
static int SpuHeapPush (spu_heap_t *heap, subpicture_t *subpic)
static void SpuHeapDeleteAt (spu_heap_t *heap, int index)
static int SpuHeapDeleteSubpicture (spu_heap_t *heap, subpicture_t *subpic)
static void SpuHeapClean (spu_heap_t *heap)
static void FilterRelease (filter_t *filter)
static picture_tspu_new_video_buffer (filter_t *filter)
static void spu_del_video_buffer (filter_t *filter, picture_t *picture)
static int spu_get_attachments (filter_t *filter, input_attachment_t ***attachment_ptr, int *attachment_count)
static filter_tSpuRenderCreateAndLoadText (spu_t *spu)
static filter_tSpuRenderCreateAndLoadScale (vlc_object_t *object, vlc_fourcc_t src_chroma, vlc_fourcc_t dst_chroma, bool require_resize)
static void SpuRenderText (spu_t *spu, bool *rerender_text, subpicture_region_t *region, const vlc_fourcc_t *chroma_list, mtime_t elapsed_time)
static spu_scale_t spu_scale_create (int w, int h)
static spu_scale_t spu_scale_unit (void)
static spu_scale_t spu_scale_createq (int64_t wn, int64_t wd, int64_t hn, int64_t hd)
static int spu_scale_w (int v, const spu_scale_t s)
static int spu_scale_h (int v, const spu_scale_t s)
static int spu_invscale_w (int v, const spu_scale_t s)
static int spu_invscale_h (int v, const spu_scale_t s)
static spu_area_t spu_area_create (int x, int y, int w, int h, spu_scale_t s)
static spu_area_t spu_area_scaled (spu_area_t a)
static spu_area_t spu_area_unscaled (spu_area_t a, spu_scale_t s)
static bool spu_area_overlap (spu_area_t a, spu_area_t b)
static void SpuAreaFixOverlap (spu_area_t *dst, const spu_area_t *sub_array, int sub_count, int align)
 Avoid area overlapping.
static void SpuAreaFitInside (spu_area_t *area, const spu_area_t *boundary)
static void SpuRegionPlace (int *x, int *y, const subpicture_t *subpic, const subpicture_region_t *region)
 Place a region.
static int IntegerCmp (int64_t i0, int64_t i1)
 This function compares two 64 bits integers.
static int SubpictureCmp (const void *s0, const void *s1)
 This function compares 2 subpictures using the following properties (ordered by priority)
static void SpuSelectSubpictures (spu_t *spu, unsigned int *subpicture_count, subpicture_t **subpicture_array, mtime_t render_subtitle_date, mtime_t render_osd_date, bool ignore_osd)
static void SpuRenderRegion (spu_t *spu, subpicture_region_t **dst_ptr, spu_area_t *dst_area, subpicture_t *subpic, subpicture_region_t *region, const spu_scale_t scale_size, const vlc_fourcc_t *chroma_list, const video_format_t *fmt, const spu_area_t *subtitle_area, int subtitle_area_count, mtime_t render_date)
 It will transform the provided region into another region suitable for rendering.
static subpicture_tSpuRenderSubpictures (spu_t *spu, unsigned int i_subpicture, subpicture_t **pp_subpicture, const vlc_fourcc_t *chroma_list, const video_format_t *fmt_dst, const video_format_t *fmt_src, mtime_t render_subtitle_date, mtime_t render_osd_date)
 This function renders all sub picture units in the list.
static void UpdateSPU (spu_t *spu, vlc_object_t *object)
static int CropCallback (vlc_object_t *object, char const *var, vlc_value_t oldval, vlc_value_t newval, void *data)
static subpicture_tsub_new_buffer (filter_t *filter)
static void sub_del_buffer (filter_t *filter, subpicture_t *subpic)
static int SubSourceAllocationInit (filter_t *filter, void *data)
static void SubSourceAllocationClean (filter_t *filter)
spu_tspu_Create (((vlc_object_t *)(vlc_object_t *object)))
 Creates the subpicture unit.
void spu_Destroy (spu_t *spu)
 Destroy the subpicture unit.
void spu_Attach (spu_t *spu, vlc_object_t *input, bool attach)
 Attach/Detach the SPU from any input.
int spu_ProcessMouse (spu_t *spu, const vlc_mouse_t *mouse, const video_format_t *fmt)
 Inform the SPU filters of mouse event.
void spu_PutSubpicture (spu_t *spu, subpicture_t *subpic)
 Display a subpicture.
subpicture_tspu_Render (spu_t *spu, const vlc_fourcc_t *chroma_list, const video_format_t *fmt_dst, const video_format_t *fmt_src, mtime_t render_subtitle_date, mtime_t render_osd_date, bool ignore_osd)
 This function will return an unique subpicture containing the OSD and subtitles visibles at the requested date.
void spu_OffsetSubtitleDate (spu_t *spu, mtime_t duration)
 This function will apply an offset on subtitle subpicture.
int spu_RegisterChannel (spu_t *spu)
 It registers a new SPU channel.
void spu_ClearChannel (spu_t *spu, int channel)
 It clears all subpictures associated to a SPU channel.
void spu_ChangeSources (spu_t *spu, const char *filters)
 It changes the sub sources list.
void spu_ChangeFilters (spu_t *spu, const char *filters)
 It changes the sub filters list.
void spu_ChangeMargin (spu_t *spu, int margin)

Macro Definition Documentation

#define SCALE_UNIT   (1000)
#define VOUT_MAX_SUBPICTURES   (__MAX(VOUT_MAX_PICTURES, SPU_MAX_PREPARE_TIME/5000))

Function Documentation

static int CropCallback ( vlc_object_t object,
char const *  var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  data 
)
static

< No error

References UpdateSPU(), VLC_SUCCESS, and VLC_UNUSED.

Referenced by spu_Attach().

static void FilterRelease ( filter_t filter)
static
static int IntegerCmp ( int64_t  i0,
int64_t  i1 
)
static

This function compares two 64 bits integers.

It can be used by qsort.

Referenced by SubpictureCmp().

static spu_area_t spu_area_create ( int  x,
int  y,
int  w,
int  h,
spu_scale_t  s 
)
static

References spu_area_t::x.

Referenced by SpuRenderRegion().

static bool spu_area_overlap ( spu_area_t  a,
spu_area_t  b 
)
static
static spu_area_t spu_area_scaled ( spu_area_t  a)
static
static spu_area_t spu_area_unscaled ( spu_area_t  a,
spu_scale_t  s 
)
static
void spu_Attach ( spu_t spu,
vlc_object_t input,
bool  attach 
)

Attach/Detach the SPU from any input.

Parameters
p_thisthe object in which to destroy the subpicture unit
b_attachto select attach or detach

References CropCallback(), FilterRelease(), spu_private_t::input, spu_private_t::lock, spu_t::p, SpuRenderCreateAndLoadText(), spu_private_t::text, UpdateSPU(), var_AddCallback, var_Create, var_DelCallback, var_Destroy, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_VAR_BOOL.

Referenced by vout_Close(), vout_Request(), and VoutCreate().

void spu_ChangeMargin ( spu_t spu,
int  margin 
)
spu_t* spu_Create ( ((vlc_object_t *)(vlc_object_t *object))  )
static void spu_del_video_buffer ( filter_t filter,
picture_t picture 
)
static
static int spu_get_attachments ( filter_t filter,
input_attachment_t ***  attachment_ptr,
int *  attachment_count 
)
static
static int spu_invscale_h ( int  v,
const spu_scale_t  s 
)
static

References spu_scale_t::h, and SCALE_UNIT.

Referenced by spu_area_unscaled(), and SpuRenderRegion().

static int spu_invscale_w ( int  v,
const spu_scale_t  s 
)
static

References SCALE_UNIT, and spu_scale_t::w.

Referenced by spu_area_unscaled().

static picture_t* spu_new_video_buffer ( filter_t filter)
static
void spu_OffsetSubtitleDate ( spu_t spu,
mtime_t  duration 
)
int spu_ProcessMouse ( spu_t spu,
const vlc_mouse_t mouse,
const video_format_t fmt 
)
static spu_scale_t spu_scale_create ( int  w,
int  h 
)
static
static spu_scale_t spu_scale_createq ( int64_t  wn,
int64_t  wd,
int64_t  hn,
int64_t  hd 
)
static

References SCALE_UNIT, and spu_scale_create().

Referenced by SpuRenderSubpictures().

static int spu_scale_h ( int  v,
const spu_scale_t  s 
)
static

References spu_scale_t::h, and SCALE_UNIT.

Referenced by spu_area_scaled(), and SpuRenderRegion().

static spu_scale_t spu_scale_unit ( void  )
static

References SCALE_UNIT, and spu_scale_create().

Referenced by spu_area_scaled(), and SpuRenderRegion().

static int spu_scale_w ( int  v,
const spu_scale_t  s 
)
static

References SCALE_UNIT, and spu_scale_t::w.

Referenced by spu_area_scaled(), and SpuRenderRegion().

static void SpuAreaFitInside ( spu_area_t area,
const spu_area_t boundary 
)
static
static void SpuAreaFixOverlap ( spu_area_t dst,
const spu_area_t sub_array,
int  sub_count,
int  align 
)
static
static void SpuHeapClean ( spu_heap_t heap)
static
static void SpuHeapDeleteAt ( spu_heap_t heap,
int  index 
)
static
static int SpuHeapDeleteSubpicture ( spu_heap_t heap,
subpicture_t subpic 
)
static
static void SpuHeapInit ( spu_heap_t heap)
static
static int SpuHeapPush ( spu_heap_t heap,
subpicture_t subpic 
)
static
static void SpuRegionPlace ( int *  x,
int *  y,
const subpicture_t subpic,
const subpicture_region_t region 
)
static
static filter_t* SpuRenderCreateAndLoadScale ( vlc_object_t object,
vlc_fourcc_t  src_chroma,
vlc_fourcc_t  dst_chroma,
bool  require_resize 
)
static
static filter_t* SpuRenderCreateAndLoadText ( spu_t spu)
static
static void SpuRenderRegion ( spu_t spu,
subpicture_region_t **  dst_ptr,
spu_area_t dst_area,
subpicture_t subpic,
subpicture_region_t region,
const spu_scale_t  scale_size,
const vlc_fourcc_t chroma_list,
const video_format_t fmt,
const spu_area_t subtitle_area,
int  subtitle_area_count,
mtime_t  render_date 
)
static

It will transform the provided region into another region suitable for rendering.

References subpicture_t::b_absolute, subpicture_t::b_fade, subpicture_t::b_subtitle, spu_private_t::crop, subpicture_region_private_t::fmt, subpicture_region_t::fmt, filter_t::fmt_in, filter_t::fmt_out, spu_private_t::force_crop, spu_private_t::force_palette, picture_t::format, spu_scale_t::h, spu_private_t::height, subpicture_region_t::i_align, subpicture_region_t::i_alpha, subpicture_t::i_alpha, video_format_t::i_chroma, es_format_t::i_codec, video_palette_t::i_entries, video_format_t::i_height, subpicture_t::i_start, subpicture_t::i_stop, video_format_t::i_visible_height, video_format_t::i_visible_width, video_format_t::i_width, subpicture_region_t::i_x, video_format_t::i_x_offset, subpicture_region_t::i_y, video_format_t::i_y_offset, spu_private_t::margin, msg_Err, msg_Warn, spu_t::p, filter_t::p_module, video_format_t::p_palette, subpicture_region_private_t::p_picture, subpicture_region_t::p_picture, subpicture_region_t::p_private, video_palette_t::palette, spu_private_t::palette, picture_Hold(), picture_Release(), spu_private_t::scale, spu_area_t::scale, SCALE_UNIT, spu_private_t::scale_yuvp, spu_area_create(), spu_invscale_h(), spu_scale_h(), spu_scale_unit(), spu_scale_w(), SpuAreaFitInside(), SpuAreaFixOverlap(), SpuRegionPlace(), SpuRenderText(), subpicture_region_New(), subpicture_region_private_Delete(), subpicture_region_private_New(), es_format_t::video, VLC_CODEC_TEXT, VLC_CODEC_YUVP, spu_scale_t::w, spu_private_t::width, spu_private_t::x, spu_area_t::x, spu_private_t::y, and spu_area_t::y.

Referenced by SpuRenderSubpictures().

static subpicture_t* SpuRenderSubpictures ( spu_t spu,
unsigned int  i_subpicture,
subpicture_t **  pp_subpicture,
const vlc_fourcc_t chroma_list,
const video_format_t fmt_dst,
const video_format_t fmt_src,
mtime_t  render_subtitle_date,
mtime_t  render_osd_date 
)
static
static void SpuRenderText ( spu_t spu,
bool *  rerender_text,
subpicture_region_t region,
const vlc_fourcc_t chroma_list,
mtime_t  elapsed_time 
)
static
static void SpuSelectSubpictures ( spu_t spu,
unsigned int *  subpicture_count,
subpicture_t **  subpicture_array,
mtime_t  render_subtitle_date,
mtime_t  render_osd_date,
bool  ignore_osd 
)
static
static void sub_del_buffer ( filter_t filter,
subpicture_t subpic 
)
static

References subpicture_Delete(), and VLC_UNUSED.

Referenced by SubSourceAllocationInit().

static subpicture_t* sub_new_buffer ( filter_t filter)
static
static int SubpictureCmp ( const void *  s0,
const void *  s1 
)
static

This function compares 2 subpictures using the following properties (ordered by priority)

  1. absolute positionning
  2. start time
  3. creation order (per channel)

It can be used by qsort.

XXX spu_RenderSubpictures depends heavily on this order.

References subpicture_t::b_absolute, subpicture_t::i_channel, subpicture_t::i_order, subpicture_t::i_start, and IntegerCmp().

Referenced by spu_Render().

static void SubSourceAllocationClean ( filter_t filter)
static
static int SubSourceAllocationInit ( filter_t filter,
void *  data 
)
static
static void UpdateSPU ( spu_t spu,
vlc_object_t object 
)
static