VLC  3.0.15
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  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   (10000)
 A few scale functions helpers. More...
 

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 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. More...
 
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. More...
 
static int IntegerCmp (int64_t i0, int64_t i1)
 This function compares two 64 bits integers. More...
 
static int SubpictureCmp (const void *s0, const void *s1)
 This function compares 2 subpictures using the following properties (ordered by priority) More...
 
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. More...
 
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. More...
 
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 int SubSourceInit (filter_t *filter, void *data)
 
static int SubSourceClean (filter_t *filter, void *data)
 
static int RestartSubFilterCallback (vlc_object_t *obj, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
 
static int SubFilterAddProxyCallbacks (filter_t *filter, void *opaque)
 
static int SubFilterDelProxyCallbacks (filter_t *filter, void *opaque)
 
static int RestartSubSourceCallback (vlc_object_t *obj, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
 
static int SubSourceAddProxyCallbacks (filter_t *filter, void *opaque)
 
static int SubSourceDelProxyCallbacks (filter_t *filter, void *opaque)
 
spu_tspu_Create (vlc_object_t *object, vout_thread_t *vout)
 Creates the subpicture unit. More...
 
void spu_Destroy (spu_t *spu)
 Destroy the subpicture unit. More...
 
void spu_Attach (spu_t *spu, vlc_object_t *input, bool attach)
 Attach/Detach the SPU from any input. More...
 
int spu_ProcessMouse (spu_t *spu, const vlc_mouse_t *mouse, const video_format_t *fmt)
 Inform the SPU filters of mouse event. More...
 
void spu_PutSubpicture (spu_t *spu, subpicture_t *subpic)
 Display a subpicture. More...
 
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. More...
 
void spu_OffsetSubtitleDate (spu_t *spu, mtime_t duration)
 This function will apply an offset on subtitle subpicture. More...
 
int spu_RegisterChannel (spu_t *spu)
 It registers a new SPU channel. More...
 
void spu_ClearChannel (spu_t *spu, int channel)
 It clears all subpictures associated to a SPU channel. More...
 
void spu_ChangeSources (spu_t *spu, const char *filters)
 It changes the sub sources list. More...
 
void spu_ChangeFilters (spu_t *spu, const char *filters)
 It changes the sub filters list. More...
 
void spu_ChangeMargin (spu_t *spu, int margin)
 

Macro Definition Documentation

◆ SCALE_UNIT

#define SCALE_UNIT   (10000)

A few scale functions helpers.

◆ VOUT_MAX_SUBPICTURES

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

Function Documentation

◆ CropCallback()

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

< No error

◆ FilterRelease()

static void FilterRelease ( filter_t filter)
static

◆ IntegerCmp()

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().

◆ RestartSubFilterCallback()

static int RestartSubFilterCallback ( vlc_object_t obj,
char const *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
)
static

< No error

◆ RestartSubSourceCallback()

static int RestartSubSourceCallback ( vlc_object_t obj,
char const *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
)
static

< No error

◆ spu_area_create()

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

Referenced by SpuRenderRegion().

◆ spu_area_overlap()

static bool spu_area_overlap ( spu_area_t  a,
spu_area_t  b 
)
static

Referenced by SpuAreaFixOverlap().

◆ spu_area_scaled()

static spu_area_t spu_area_scaled ( spu_area_t  a)
static

References spu_area_t::x.

Referenced by SpuAreaFixOverlap().

◆ spu_area_unscaled()

static spu_area_t spu_area_unscaled ( spu_area_t  a,
spu_scale_t  s 
)
static

◆ spu_Attach()

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

◆ spu_ChangeMargin()

void spu_ChangeMargin ( spu_t spu,
int  margin 
)

◆ spu_get_attachments()

static int spu_get_attachments ( filter_t filter,
input_attachment_t ***  attachment_ptr,
int *  attachment_count 
)
static

< Unspecified error

◆ spu_invscale_h()

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

References SCALE_UNIT, and spu_scale_t::w.

Referenced by SpuRenderRegion().

◆ spu_invscale_w()

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

References spu_scale_t::h, and SCALE_UNIT.

◆ spu_new_video_buffer()

static picture_t* spu_new_video_buffer ( filter_t filter)
static

◆ spu_OffsetSubtitleDate()

void spu_OffsetSubtitleDate ( spu_t spu,
mtime_t  duration 
)

This function will apply an offset on subtitle subpicture.

◆ spu_ProcessMouse()

int spu_ProcessMouse ( spu_t spu,
const vlc_mouse_t mouse,
const video_format_t fmt 
)

Inform the SPU filters of mouse event.

< No error

Referenced by vout_SendDisplayEventMouse().

◆ spu_scale_create()

static spu_scale_t spu_scale_create ( int  w,
int  h 
)
static

Referenced by spu_scale_createq(), and spu_scale_w().

◆ spu_scale_createq()

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().

◆ spu_scale_h()

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

References SCALE_UNIT, and spu_scale_t::w.

Referenced by SpuRenderRegion().

◆ spu_scale_unit()

static spu_scale_t spu_scale_unit ( void  )
static

Referenced by SpuRenderRegion().

◆ spu_scale_w()

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

References SCALE_UNIT, and spu_scale_create().

Referenced by SpuRenderRegion().

◆ SpuAreaFitInside()

static void SpuAreaFitInside ( spu_area_t area,
const spu_area_t boundary 
)
static

Referenced by SpuRenderRegion().

◆ SpuAreaFixOverlap()

static void SpuAreaFixOverlap ( spu_area_t dst,
const spu_area_t sub_array,
int  sub_count,
int  align 
)
static

◆ SpuHeapClean()

static void SpuHeapClean ( spu_heap_t heap)
static

◆ SpuHeapDeleteAt()

static void SpuHeapDeleteAt ( spu_heap_t heap,
int  index 
)
static

Referenced by SpuSelectSubpictures().

◆ SpuHeapDeleteSubpicture()

static int SpuHeapDeleteSubpicture ( spu_heap_t heap,
subpicture_t subpic 
)
static

< No error

< Unspecified error

Referenced by SpuSelectSubpictures().

◆ SpuHeapInit()

static void SpuHeapInit ( spu_heap_t heap)
static

◆ SpuHeapPush()

static int SpuHeapPush ( spu_heap_t heap,
subpicture_t subpic 
)
static

< No error

< Unspecified error

◆ SpuRegionPlace()

static void SpuRegionPlace ( int *  x,
int *  y,
const subpicture_t subpic,
const subpicture_region_t region 
)
static

◆ SpuRenderCreateAndLoadScale()

static filter_t* SpuRenderCreateAndLoadScale ( vlc_object_t object,
vlc_fourcc_t  src_chroma,
vlc_fourcc_t  dst_chroma,
bool  require_resize 
)
static

Referenced by spu_Create().

◆ SpuRenderCreateAndLoadText()

static filter_t* SpuRenderCreateAndLoadText ( spu_t spu)
static

Referenced by spu_Create().

◆ SpuRenderRegion()

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, COLOR_PRIMARIES_SRGB, COLOR_PRIMARIES_UNDEF, COLOR_SPACE_SRGB, COLOR_SPACE_UNDEF, 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_region_t::i_max_height, subpicture_region_t::i_max_width, 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, filter_t::pf_video_filter, picture_Hold(), picture_Release(), video_format_t::primaries, spu_private_t::scale, spu_area_t::scale, SCALE_UNIT, spu_private_t::scale_yuvp, video_format_t::space, 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(), video_format_t::transfer, TRANSFER_FUNC_SRGB, TRANSFER_FUNC_UNDEF, es_format_t::video, video_format_AdjustColorSpace(), 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.

◆ 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

This function renders all sub picture units in the list.

◆ SpuRenderText()

static void SpuRenderText ( spu_t spu,
bool *  rerender_text,
subpicture_region_t region,
const vlc_fourcc_t chroma_list,
mtime_t  elapsed_time 
)
static

Referenced by SpuRenderRegion().

◆ SpuSelectSubpictures()

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

◆ sub_new_buffer()

static subpicture_t* sub_new_buffer ( filter_t filter)
static

Referenced by SubSourceClean().

◆ SubFilterAddProxyCallbacks()

static int SubFilterAddProxyCallbacks ( filter_t filter,
void *  opaque 
)
static

< No error

References VLC_UNUSED, and vout_ControlChangeSubFilters().

◆ SubFilterDelProxyCallbacks()

static int SubFilterDelProxyCallbacks ( filter_t filter,
void *  opaque 
)
static

< No error

◆ SubpictureCmp()

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().

◆ SubSourceAddProxyCallbacks()

static int SubSourceAddProxyCallbacks ( filter_t filter,
void *  opaque 
)
static

< No error

◆ SubSourceClean()

static int SubSourceClean ( filter_t filter,
void *  data 
)
static

◆ SubSourceDelProxyCallbacks()

static int SubSourceDelProxyCallbacks ( filter_t filter,
void *  opaque 
)
static

< No error

◆ SubSourceInit()

static int SubSourceInit ( filter_t filter,
void *  data 
)
static

◆ UpdateSPU()

static void UpdateSPU ( spu_t spu,
vlc_object_t object 
)
static