<listitem> <para> <type> subpicture_t * </type> <function>
vout_CreateSubPicture </function> <parameter> ( vout_thread_t *p_vout,
- int i_type, int i_size ) </parameter> :
- Returns an allocated subpicture buffer. <parameter> i_type
+ int i_channel, int i_type ) </parameter> :
+ Returns an allocated subpicture buffer. <parameter> i_channel
+ </parameter> is the ID of the subpicture channel, <parameter> i_type
</parameter> is <constant> DVD_SUBPICTURE </constant> or
<constant> TEXT_SUBPICTURE</constant>, <parameter> i_size
</parameter> is the length in bytes of the packet.
# define vout_OSDMessage __vout_OSDMessage
#endif
VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
-VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, short ) );
+VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) );
/* Picture and subpicture heaps */
picture_t p_picture[2*VOUT_MAX_PICTURES]; /**< pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /**< subpictures */
+ subpicture_t *p_default_channel; /**< subpicture in the default
+ channel */
+ int i_channel_count; /**< index of last subpicture
+ channel registered */
/* Statistics */
count_t c_loops;
* \addtogroup subpicture
* @{
*/
-VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int, int, int ) );
+VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int, int ) );
VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) );
VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) );
+VLC_EXPORT( int, vout_RegisterOSDChannel, ( vout_thread_t * ) );
+VLC_EXPORT( void, vout_ClearOSDChannel, ( vout_thread_t *, int ) );
subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t );
void vout_RenderSubPictures ( vout_thread_t *, picture_t *,
*/
struct subpicture_t
{
- /** \name Channel and content type */
+ /** \name Channel ID */
/**@{*/
- int i_channel; /**< subpicture channel */
- int i_content; /**< content type */
+ int i_channel; /**< subpicture channel ID */
/**@}*/
/** \name Type and flags
#define EMPTY_SUBPICTURE 0 /* subtitle slot is empty and available */
#define MEMORY_SUBPICTURE 100 /* subpicture stored in memory */
+/* Default subpicture channel ID */
+#define DEFAULT_CHAN 1
+
/* Subpicture status */
#define FREE_SUBPICTURE 0 /* free and not allocated */
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */
-/* Subpicture channel */
-#define SUBT1_CHAN 1
-#define SUBT2_CHAN 2
-#define BEGIN_EXCLUSIVE_CHAN 3 /* exclusive subpic-channels list */
-#define POSITION_CHAN 3
-#define VOLUME_CHAN 4
-#define SOLO_CHAN 5
-#define END_EXCLUSIVE_CHAN 5 /*end of list */
-
-/* Subpicture content type */
-#define TEXT_CONTENT 0
-#define GRAPH_CONTENT 1 /* used for OSD icon, slider... */
-
/*****************************************************************************
* Prototypes
*****************************************************************************/
/* TODO: p_subpicture doesn't have the proper i_x and i_y
* coordinates. Need to look at the subpicture display system to
* work out why. */
- if ( vout_ShowTextAbsolute( p_vout, SOLO_CHAN,
+ if ( vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
psz_anchor_description, p_style, OSD_ALIGN_BOTTOM,
i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS )
{
dvbsub_page_t* p_page;
dvbsub_object_t* p_objects;
subpicture_t* p_spu[16];
+ int i_subpic_channel;
} dvbsub_all_t;
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block;
+ vout_thread_t *p_last_vout;
if( pp_block == NULL || *pp_block == NULL )
{
return;
}
+ p_last_vout = p_sys->p_vout;
if( ( p_sys->p_vout = FindVout( p_dec ) ) )
{
int i_data_identifier;
}
i_end_data_marker = bs_read( &p_sys->bs, 8 );
+ if( p_last_vout != p_sys->p_vout )
+ {
+ p_sys->dvbsub.i_subpic_channel =
+ vout_RegisterOSDChannel( p_sys->p_vout );
+ }
+
/* Check if the page is to be displayed */
if( p_sys->dvbsub.p_page && p_sys->dvbsub.p_objects )
{
/* Allocate the subpicture internal data. */
dvbsub->p_spu[j] =
- vout_CreateSubPicture( p_vout, SUBT1_CHAN, TEXT_CONTENT,
+ vout_CreateSubPicture( p_vout, dvbsub->i_subpic_channel,
MEMORY_SUBPICTURE );
if( dvbsub->p_spu[j] == NULL )
{
set_callbacks( VCDSubOpen, VCDSubClose );
add_integer ( MODULE_STRING "-debug", 0, NULL,
- DEBUG_TEXT, DEBUG_LONGTEXT, VLC_TRUE );
+ DEBUG_TEXT, DEBUG_LONGTEXT, VLC_TRUE );
add_integer ( MODULE_STRING "-horizontal-correct", 0, NULL,
HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE );
VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE );
add_string( MODULE_STRING "-aspect-ratio", "", NULL,
- SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT,
- VLC_TRUE );
+ SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT,
+ VLC_TRUE );
add_integer( MODULE_STRING "-duration-scaling", 3, NULL,
- DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT,
- VLC_TRUE );
+ DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT,
+ VLC_TRUE );
add_submodule();
set_description( _("Chaoji VCD subtitle packetizer") );
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block );
+ vout_thread_t *p_last_vout = p_dec->p_sys->p_vout;
dbg_print( (DECODE_DBG_CALL) , "");
if( ( p_sys->p_vout = VCDSubFindVout( p_dec ) ) )
{
+ if( p_last_vout != p_sys->p_vout )
+ {
+ p_sys->i_subpic_channel =
+ vout_RegisterOSDChannel( p_sys->p_vout );
+ }
+
/* Parse and decode */
E_(ParsePacket)( p_dec );
p_buffer = p_block->p_buffer;
- dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
- "header: 0x%02x 0x%02x 0x%02x 0x%02x, 0x%02x, 0x%02x, size: %i",
- p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4],
- p_buffer[5], p_buffer[6],
- p_block->i_buffer);
+ dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
+ "header: 0x%02x 0x%02x 0x%02x 0x%02x, 0x%02x, 0x%02x, size: %i",
+ p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4],
+ p_buffer[5], p_buffer[6],
+ p_block->i_buffer);
/* Attach to our input thread and see if subtitle is selected. */
{
vlc_object_t * p_input;
vlc_value_t val;
-
- p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
- if( !p_input ) return NULL;
+ p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
+
+ if( !p_input ) return NULL;
+
+ if( var_Get( p_input, "spu-channel", &val ) )
+ {
+ vlc_object_release( p_input );
+ return NULL;
+ }
- if( var_Get( p_input, "spu-channel", &val ) ) {
- vlc_object_release( p_input );
- return NULL;
- }
-
vlc_object_release( p_input );
- /* Number could be 0bd, 1bd, 2bd, 3bd for 0..3. If so
- reduce it to 0..3.
- */
- if ( (val.i_int & 0xff) == 0xbd ) val.i_int >>= 8;
-
- if( val.i_int == -1 || val.i_int != p_buffer[0] )
- return NULL;
+ /* Number could be 0bd, 1bd, 2bd, 3bd for 0..3. If so
+ reduce it to 0..3.
+ */
+ if ( (val.i_int & 0xff) == 0xbd ) val.i_int >>= 8;
+
+ if( val.i_int == -1 || val.i_int != p_buffer[0] )
+ return NULL;
}
image don't. */
if ( p_sys->state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts == 0 ) {
- msg_Warn( p_dec,
- "first packet expected but no PTS present -- skipped\n");
+ msg_Warn( p_dec,
+ "first packet expected but no PTS present -- skipped\n");
return NULL;
}
}
/* FIXME - remove append_data and use chainappend */
- VCDSubAppendData( p_dec, p_buffer + SPU_HEADER_LEN,
- p_block->i_buffer - SPU_HEADER_LEN );
+ VCDSubAppendData( p_dec, p_buffer + SPU_HEADER_LEN,
+ p_block->i_buffer - SPU_HEADER_LEN );
block_ChainAppend( &p_sys->p_block, p_block );
p_sys->state = SUBTITLE_BLOCK_PARTIAL;
}
-
return NULL;
}
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */
- p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+ p_spu = vout_CreateSubPicture( p_sys->p_vout, p_sys->i_subpic_channel,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
set_callbacks( VCDSubOpen, VCDSubClose );
add_integer ( MODULE_STRING "-debug", 0, NULL,
- DEBUG_TEXT, DEBUG_LONGTEXT, VLC_TRUE );
+ DEBUG_TEXT, DEBUG_LONGTEXT, VLC_TRUE );
add_integer ( MODULE_STRING "-horizontal-correct", 0, NULL,
HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE );
VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE );
add_string( MODULE_STRING "-aspect-ratio", "", NULL,
- SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT,
- VLC_TRUE );
+ SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT, VLC_TRUE );
add_integer( MODULE_STRING "-duration-scaling", 9, NULL,
- DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT,
- VLC_TRUE );
+ DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT, VLC_TRUE );
add_submodule();
set_description( _("Philips OGT (SVCD subtitle) packetizer") );
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block );
+ vout_thread_t *p_last_vout = p_dec->p_sys->p_vout;
dbg_print( (DECODE_DBG_CALL) , "");
if( ( p_sys->p_vout = VCDSubFindVout( p_dec ) ) )
{
+ if( p_last_vout != p_sys->p_vout )
+ {
+ p_sys->i_subpic_channel =
+ vout_RegisterOSDChannel( p_sys->p_vout );
+ }
+
/* Parse and decode */
E_(ParsePacket)( p_dec );
p_buffer = p_block->p_buffer;
- dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
- "header: 0x%02x 0x%02x 0x%02x 0x%02x, size: %i",
- p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4],
- p_block->i_buffer);
+ dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
+ "header: 0x%02x 0x%02x 0x%02x 0x%02x, size: %i",
+ p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4],
+ p_block->i_buffer);
/* Attach to our input thread and see if subtitle is selected. */
{
vlc_object_t * p_input;
vlc_value_t val;
-
- p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
- if( !p_input ) return NULL;
+ p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
+
+ if( !p_input ) return NULL;
- if( var_Get( p_input, "spu-channel", &val ) ) {
- vlc_object_release( p_input );
+ if( var_Get( p_input, "spu-channel", &val ) )
+ {
+ vlc_object_release( p_input );
return NULL;
}
-
+
vlc_object_release( p_input );
- dbg_print( (DECODE_DBG_PACKET),
+ dbg_print( (DECODE_DBG_PACKET),
"val.i_int %x p_buffer[i] %x", val.i_int, p_buffer[1]);
/* The dummy ES that the menu selection uses has an 0x70 at
the head which we need to strip off. */
- if( val.i_int == -1 || (val.i_int & 0x03) != p_buffer[1] ) {
- dbg_print( DECODE_DBG_PACKET, "subtitle not for us.\n");
- return NULL;
+ if( val.i_int == -1 || (val.i_int & 0x03) != p_buffer[1] )
+ {
+ dbg_print( DECODE_DBG_PACKET, "subtitle not for us.\n");
+ return NULL;
}
}
}
\f
-/*
+/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */
- p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+ p_spu = vout_CreateSubPicture( p_sys->p_vout, p_sys->i_subpic_channel,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
#define DECODE_DBG_PNG 64 /* Extract subtitles to PNG files. */
#define DECODE_DBG_INFO 128
-#define DEBUG_TEXT N_( \
+#define DEBUG_TEXT N_( \
"If nonzero, this gives additional debug information." \
)
"misc info 128\n" )
#define SUB_ASPECT_RATIO_TEXT N_("Subtitle aspect-ratio correction")
-#define SUB_ASPECT_RATIO_LONGTEXT N_( \
+#define SUB_ASPECT_RATIO_LONGTEXT N_( \
"Use this to force the subtitle aspect ratio. If you give a null string " \
"the right value will be determined automatically. Usually this is what " \
"you want. For OGT and CVD subtitles this undoes the effect " \
)
#define DURATION_SCALE_TEXT N_("Factor to increase subtitle display interval")
-#define DURATION_SCALE_LONGTEXT N_( \
+#define DURATION_SCALE_LONGTEXT N_( \
"If you find you need extra time for reading subtitles, " \
- "you can set this higher and it will multiply the display " \
- "time by that amount. Use 0 to mean until the next " \
+ "you can set this higher and it will multiply the display " \
+ "time by that amount. Use 0 to mean until the next " \
"subtitle.")
#define HORIZONTAL_CORRECT \
N_("Add this to starting horizontal position of subtitle.")
-#define HORIZONTAL_CORRECT_LONGTEXT N_( \
+#define HORIZONTAL_CORRECT_LONGTEXT N_( \
"If you need to adjust the subtitle starting position horizontally, " \
"set this. Negative values shift left and positive values right. 0 would " \
- "be no deviation from where the position specified in the subtitle." \
+ "be no deviation from where the position specified in the subtitle." \
)
#define VERTICAL_CORRECT \
N_("Add this to starting vertical position of subtitle.")
-#define VERTICAL_CORRECT_LONGTEXT N_( \
+#define VERTICAL_CORRECT_LONGTEXT N_( \
"If you need to adjust the subtitle starting position vertically, " \
- "set this. Negative values shift up, positive values down. 0 would " \
- "be no deviation from where the position specified in the subtitle." \
+ "set this. Negative values shift up, positive values down. 0 would " \
+ "be no deviation from where the position specified in the subtitle." \
)
#define DECODE_DEBUG 1
/* The number of color palette entries allowed in a subtitle. */
-#define NUM_SUBTITLE_COLORS 4
+#define NUM_SUBTITLE_COLORS 4
typedef enum {
SUBTITLE_BLOCK_EMPTY,
/* The byte storage used by one pixel */
#define PIXEL_SIZE 4
-/* Size in bytes of YUV portion above. */
+/* Size in bytes of YUV portion above. */
#define YUV_SIZE 3
int i_spu;
packet_state_t state; /* data-gathering state for this subtitle */
- uint16_t i_image; /* image number in the subtitle stream; 0 is the
- first one. */
- uint8_t i_packet;/* packet number for above image number; 0 is the
- first one. */
+ uint16_t i_image; /* image number in the subtitle stream; 0 is the
+ first one. */
+ uint8_t i_packet;/* packet number for above image number; 0 is the
+ first one. */
block_t *p_block;/* Bytes of the packet. */
-
+
uint8_t buffer[65536 + 20 ]; /* we will never overflow more than 11
- bytes if I'm right */
+ bytes if I'm right */
int b_packetizer;
- int i_spu_size; /* goal for subtitle_data_pos while gathering,
- size of used subtitle_data later */
+ int i_spu_size; /* goal for subtitle_data_pos while gathering,
+ size of used subtitle_data later */
vout_thread_t *p_vout;
+ int i_subpic_channel; /* Subpicture channel in which subtitles will
+ be written */
+
/* FIXME: Remove this? */
- uint8_t *subtitle_data; /* buffer used to accumulate data from
- successive packets in the same subtitle */
- int subtitle_data_size; /* size of the allocated subtitle_data */
+ uint8_t *subtitle_data; /* buffer used to accumulate data from
+ successive packets in the same subtitle */
+ int subtitle_data_size; /* size of the allocated subtitle_data */
/* Move into subpicture_sys_t? */
- uint16_t i_image_offset; /* offset from subtitle_data to compressed
- image data */
- int i_image_length; /* size of the compressed image data */
+ uint16_t i_image_offset; /* offset from subtitle_data to compressed
+ image data */
+ int i_image_length; /* size of the compressed image data */
int first_field_offset; /* offset of even raster lines. Used
- only for CVD.
- */
+ only for CVD. */
int second_field_offset; /* offset of odd raster lines */
int metadata_offset; /* offset to data describing the image */
int metadata_length; /* length of metadata */
- int subtitle_data_pos; /* where to write next chunk */
+ int subtitle_data_pos; /* where to write next chunk */
- mtime_t i_duration; /* how long to display the image, 0 stands
- for "until next subtitle" */
+ mtime_t i_duration; /* how long to display the image, 0 stands
+ for "until next subtitle" */
uint16_t i_x_start, i_y_start; /* position of top leftmost pixel of
- image when displayed */
- uint16_t i_width, i_height; /* dimensions in pixels of image */
+ image when displayed */
+ uint16_t i_width, i_height; /* dimensions in pixels of image */
ogt_yuvt_t p_palette[NUM_SUBTITLE_COLORS]; /* Palette of colors used
- in subtitle */
+ in subtitle */
ogt_yuvt_t p_palette_highlight[NUM_SUBTITLE_COLORS]; /* Only used
- for CVD */
+ for CVD */
uint8_t i_options;
uint8_t i_options2;
/* Link to our input */
vlc_object_t * p_input;
-
+
/* Cropping properties */
vlc_mutex_t lock;
vlc_bool_t b_crop;
/* This is only used for color palette Chromas like RGB2. */
ogt_yuvt_t p_palette[NUM_SUBTITLE_COLORS]; /* Palette of colors used
- in subtitle */
+ in subtitle */
};
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu;
+ int i_spu_channel;
/* Allocate the subpicture internal data. */
- p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+ p_spu = vout_CreateSubPicture( p_sys->p_vout, p_sys->i_subpic_channel,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
* spudec.c : SPU decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: spudec.c,v 1.33 2004/01/30 16:50:26 fenrir Exp $
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Laurent Aimar <fenrir@via.ecp.fr>
/*****************************************************************************
* Decode:
*****************************************************************************/
-static void Decode ( decoder_t *p_dec, block_t **pp_block )
+static void Decode( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block );
+ vout_thread_t *p_last_vout = p_dec->p_sys->p_vout;
if( p_spu )
{
if( ( p_sys->p_vout = FindVout( p_dec ) ) )
{
+ if( p_last_vout != p_sys->p_vout )
+ {
+ p_sys->i_subpic_channel =
+ vout_RegisterOSDChannel( p_sys->p_vout );
+ }
+
/* Parse and decode */
E_(ParsePacket)( p_dec );
* spudec.h : sub picture unit decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: spudec.h,v 1.8 2003/11/22 19:55:47 fenrir Exp $
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
int i_rle_size;
int i_spu;
+ int i_subpic_channel;
+
block_t *p_block;
uint8_t buffer[65536 + 20 ]; /* we will never overflow more than 11 bytes if I'm right */
struct decoder_sys_t
{
int i_align; /* Subtitles alignment on the vout */
+ int i_subpic_channel; /* Subpic channel for subtitles */
+
+ vout_thread_t *p_vout; /* last vout used */
#if defined(HAVE_ICONV)
iconv_t iconv_handle; /* handle to iconv instance */
msg_Dbg( p_dec, "no iconv support available" );
#endif
+
+ p_dec->p_sys->p_vout = NULL;
return VLC_SUCCESS;
}
p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
+ if( p_dec->p_sys->p_vout != p_vout )
+ {
+ p_dec->p_sys->i_subpic_channel = vout_RegisterOSDChannel( p_vout );
+ }
ParseText( p_dec, *pp_block, p_vout );
vlc_object_release( p_vout );
}
{
msg_Warn( p_dec, "couldn't find a video output, trashing subtitle" );
}
+ p_dec->p_sys->p_vout = p_vout;
block_Release( *pp_block );
*pp_block = NULL;
msg_Warn( p_dec, "subtitle without a date" );
return;
}
-
+
/* Check validity of packet data */
if( p_block->i_buffer <= 1 || p_block->p_buffer[0] == '\0' )
{
/* Should be resiliant against bad subtitles */
psz_subtitle = strndup( p_block->p_buffer, p_block->i_buffer );
-
+
i_align_h = p_sys->i_align ? 20 : 0;
i_align_v = 10;
}
}
StripTags( psz_subtitle );
- vout_ShowTextAbsolute( p_vout, SUBT1_CHAN, psz_subtitle, NULL,
+ vout_ShowTextAbsolute( p_vout, p_sys->i_subpic_channel, psz_subtitle, NULL,
OSD_ALIGN_BOTTOM | p_sys->i_align, i_align_h,
i_align_v, p_block->i_pts,
p_block->i_length ? p_block->i_pts + p_block->i_length : 0 );
}
psz_text[ i - i_left_moves ] = '\0';
}
-
mediacontrol_MediaTime,
end->value );
- vout_ShowTextRelative( p_vout, SUBT1_CHAN, ( char* ) message, NULL,
- OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
+ vout_ShowTextRelative( p_vout, DEFAULT_CHAN, ( char* ) message, NULL,
+ OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
i_duration );
}
else
( mediacontrol_Position * ) end );
i_fin += i_now;
- vout_ShowTextAbsolute( p_vout, SUBT1_CHAN, ( char* )message, NULL,
- OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
- i_debut, i_fin );
+ vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, ( char* ) message, NULL,
+ OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
+ i_debut, i_fin );
}
vlc_object_release( p_vout );
#include "vlc_keys.h"
#define BUFFER_SIZE 10
+
+#define CHANNELS_NUMBER 4
+#define VOLUME_TEXT_CHAN p_intf->p_sys->p_channels[ 0 ]
+#define VOLUME_WIDGET_CHAN p_intf->p_sys->p_channels[ 1 ]
+#define POSITION_TEXT_CHAN p_intf->p_sys->p_channels[ 2 ]
+#define POSITION_WIDGET_CHAN p_intf->p_sys->p_channels[ 3 ]
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
int p_keys[ BUFFER_SIZE ]; /* buffer that contains
* keyevents */
int i_size; /* number of events in buffer */
+ int p_channels[ CHANNELS_NUMBER ]; /* contains registered
+ * channel IDs */
input_thread_t * p_input; /* pointer to input */
vout_thread_t * p_vout; /* pointer to vout object */
};
vlc_value_t, vlc_value_t, void * );
static void PlayBookmark( intf_thread_t *, int );
static void SetBookmark ( intf_thread_t *, int );
-static void DisplayPosition( vout_thread_t *, input_thread_t * );
-static void DisplayVolume ( vout_thread_t *, audio_volume_t );
+static void DisplayPosition( intf_thread_t *, vout_thread_t *, input_thread_t * );
+static void DisplayVolume ( intf_thread_t *, vout_thread_t *, audio_volume_t );
+static void ClearChannels ( intf_thread_t *, vout_thread_t * );
/*****************************************************************************
* Module descriptor
playlist_t *p_playlist;
input_thread_t *p_input;
vout_thread_t *p_vout = NULL;
+ vout_thread_t *p_last_vout;
struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
vlc_value_t val;
int i;
p_input = p_intf->p_sys->p_input;
/* Update the vout */
+ p_last_vout = p_intf->p_sys->p_vout;
if( p_vout == NULL )
{
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
p_intf->p_sys->p_vout = NULL;
}
+ /* Register OSD channels */
+ if( p_vout && p_vout != p_last_vout )
+ {
+ for( i = 0; i < CHANNELS_NUMBER; i++ )
+ {
+ p_intf->p_sys->p_channels[ i ] =
+ vout_RegisterOSDChannel( p_vout );
+ }
+ }
+
/* Find action triggered by hotkey */
i_action = 0;
i_key = GetKey( p_intf );
if( i_action == ACTIONID_QUIT )
{
p_intf->p_vlc->b_die = VLC_TRUE;
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Quit" ) );
+ ClearChannels( p_intf, p_vout );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Quit" ) );
continue;
}
else if( i_action == ACTIONID_VOL_UP )
{
audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &i_newvol );
- DisplayVolume( p_vout, i_newvol );
+ DisplayVolume( p_intf, p_vout, i_newvol );
}
else if( i_action == ACTIONID_VOL_DOWN )
{
audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &i_newvol );
- DisplayVolume( p_vout, i_newvol );
+ DisplayVolume( p_intf, p_vout, i_newvol );
}
else if( i_action == ACTIONID_VOL_MUTE )
{
{
if( i_newvol == 0 )
{
- vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_MUTE_ICON );
+ ClearChannels( p_intf, p_vout );
+ vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
+ OSD_MUTE_ICON );
}
else
{
- DisplayVolume( p_vout, i_newvol );
+ DisplayVolume( p_intf, p_vout, i_newvol );
}
}
}
{
i_delay--;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
- vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms",
+ ClearChannels( p_intf, p_vout );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms",
i_delay*100);
}
}
{
i_delay++;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
- vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms",
+ ClearChannels( p_intf, p_vout );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms",
i_delay*100);
}
}
}
if( p_input && val.i_int != PAUSE_S )
{
- vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_PAUSE_ICON );
+ ClearChannels( p_intf, p_vout );
+ vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
+ OSD_PAUSE_ICON );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
FIND_ANYWHERE );
if( p_playlist )
{
- vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_PLAY_ICON );
+ ClearChannels( p_intf, p_vout );
+ vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
+ OSD_PLAY_ICON );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
if( i_action == ACTIONID_PAUSE )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
+ ClearChannels( p_intf, p_vout );
+ vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
+ OSD_PAUSE_ICON );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
{
val.i_time = -10000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
{
val.i_time = 10000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN && b_seekable )
{
val.i_time = -60000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_1MIN && b_seekable )
{
val.i_time = 60000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
{
val.i_time = -300000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_5MIN && b_seekable )
{
val.i_time = 300000000;
var_Set( p_input, "time-offset", val );
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action == ACTIONID_NEXT )
{
}
else if( i_action == ACTIONID_POSITION && b_seekable )
{
- DisplayPosition( p_vout, p_input );
+ DisplayPosition( p_intf, p_vout, p_input );
}
else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
i_action <= ACTIONID_PLAY_BOOKMARK10 )
}
}
-static void DisplayPosition( vout_thread_t *p_vout, input_thread_t *p_input )
+static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
+ input_thread_t *p_input )
{
char psz_duration[MSTRTIME_MAX_SIZE];
char psz_time[MSTRTIME_MAX_SIZE];
{
return;
}
+ ClearChannels( p_intf, p_vout );
var_Get( p_input, "time", &time );
i_seconds = time.i_time / 1000000;
if( time.i_time > 0 )
{
secstotimestr( psz_duration, time.i_time / 1000000 );
- vout_OSDMessage( p_input, POSITION_CHAN, "%s / %s",
+ vout_OSDMessage( p_input, POSITION_TEXT_CHAN, "%s / %s",
psz_time, psz_duration );
}
else if( i_seconds > 0 )
{
- vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
+ vout_OSDMessage( p_input, POSITION_TEXT_CHAN, psz_time );
}
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
var_Get( p_input, "position", &pos );
- vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_CHAN,
+ vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
pos.f_float * 100, OSD_HOR_SLIDER );
}
}
-static void DisplayVolume( vout_thread_t *p_vout, audio_volume_t i_vol )
+static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
+ audio_volume_t i_vol )
{
if( p_vout == NULL )
{
return;
}
+ ClearChannels( p_intf, p_vout );
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
- vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_CHAN,
+ vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
- vout_OSDMessage( p_vout, VOLUME_CHAN, "Vol %d%%",
+ vout_OSDMessage( p_vout, VOLUME_TEXT_CHAN, "Vol %d%%",
2*i_vol*100/AOUT_VOLUME_MAX );
}
}
+
+static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
+{
+ int i;
+
+ vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
+ for( i = 0; i < CHANNELS_NUMBER; i++ )
+ {
+ vout_ClearOSDChannel( p_vout, p_intf->p_sys->p_channels[ i ] );
+ }
+}
struct lirc_config *config;
vlc_mutex_t change_lock;
+ int i_osd_channel;
+
input_thread_t * p_input;
vout_thread_t * p_vout;
};
if( !strcmp( c, "QUIT" ) )
{
p_intf->p_vlc->b_die = VLC_TRUE;
- vout_OSDMessage( p_intf, SOLO_CHAN, _("Quit" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Quit" ) );
continue;
}
else if( !strcmp( c, "VOL_UP" ) )
{
audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &i_newvol );
- vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "VOL_DOWN" ) )
{
audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &i_newvol );
- vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "MUTE" ) )
aout_VolumeMute( p_intf, &i_newvol );
if( i_newvol == 0 )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Mute" ) );
}
else
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %d%%"),
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Vol %d%%"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
}
}
if( p_input && val.i_int != PAUSE_S )
{
- vout_OSDMessage( VLC_OBJECT(p_intf), SOLO_CHAN,
+ vout_OSDMessage( VLC_OBJECT(p_intf), DEFAULT_CHAN,
_( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Play" ) );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
list.p_list->p_values[i+1] );
i++;
}
- vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
+ vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Audio track: %s"),
list2.p_list->p_values[i].psz_string );
}
var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
i = i + 1;
}
- vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
+ vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Subtitle track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( !strcmp( c, "PAUSE" ) )
{
vlc_value_t val;
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
}
if( p_input && val.i_int != PAUSE_S )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Play" ) );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
FIND_ANYWHERE );
if( p_playlist != NULL )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Stop" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Stop" ) );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-faster", val );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Faster" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Faster" ) );
vlc_object_release( p_input );
}
}
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Slower" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Slower" ) );
vlc_object_release( p_input );
}
}
{
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Previous" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Previous" ) );
}
}
{
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Next" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Next" ) );
}
}
var_Set( p_playlist, "random", val );
if( val.b_bool )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random On" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random On" ) );
}
else
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random Off" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
var_Set( p_playlist, "repeat", val );
if( val.b_bool )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
}
else
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
var_Set( p_playlist, "loop", val );
if( val.b_bool )
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
}
else
{
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
vlc_value_t time;
time.i_time = 10 * 1000000;
var_Set( p_input, "time-offset", time );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump +10 Seconds" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Jump +10 Seconds" ) );
vlc_object_release( p_input );
}
}
vlc_value_t time;
time.i_time = -10 * 1000000;
var_Set( p_input, "time-offset", time );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump -10 Seconds" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Jump -10 Seconds" ) );
vlc_object_release( p_input );
}
}
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
- vout_OSDMessage( p_intf, SOLO_CHAN, "Vol %d%%",
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, "Vol %d%%",
i_volume*100/AOUT_VOLUME_MAX );
}
var_Set( p_playlist, "loop", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "repeat", val1 );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
break;
case 2:
var_Set( p_playlist, "repeat", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "loop", val1 );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
break;
default:
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
var_Set( p_playlist, "loop", val1 );
- vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
+ vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
break;
}
p_subpic = 0;
/* Create and initialize a subpicture */
- p_subpic = vout_CreateSubPicture( p_vout, i_channel, TEXT_CONTENT,
- MEMORY_SUBPICTURE );
+ p_subpic = vout_CreateSubPicture( p_vout, i_channel, MEMORY_SUBPICTURE );
if ( p_subpic == NULL )
{
return NULL;
/* No images in the heap */
p_vout->i_heap_size = 0;
+ /* Register the default subpicture channel */
+ p_vout->p_default_channel = NULL;
+ p_vout->i_channel_count = 1;
+
/* Initialize the rendering heap */
I_RENDERPICTURES = 0;
p_vout->render.i_width = i_width;
p_widget = 0;
/* Create and initialize a subpicture */
- p_subpic = vout_CreateSubPicture( p_vout, i_channel, GRAPH_CONTENT,
- MEMORY_SUBPICTURE );
+ p_subpic = vout_CreateSubPicture( p_vout, i_channel, MEMORY_SUBPICTURE );
if( p_subpic == NULL )
{
return NULL;
* Displays an OSD icon.
* Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
*****************************************************************************/
-void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
+void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
{
vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
subpicture_t *p_subpic;
subpicture_sys_t *p_widget;
- int i_x_margin, i_y_margin, i_channel;
+ int i_x_margin, i_y_margin;
if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) )
{
return;
}
- switch( i_type )
- {
- case OSD_SPEAKER_ICON:
- i_channel = VOLUME_CHAN;
- break;
- default:
- i_channel = SOLO_CHAN;
- break;
- }
-
p_subpic = vout_CreateWidget( p_vout, i_channel );
if( p_subpic == NULL )
{
* \param p_vout the video output this subpicture should be displayed on
* \param p_subpic the subpicture to display
*/
-void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
+void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
{
int i_margin;
* \return NULL on error, a reserved subpicture otherwise
*/
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel,
- int i_content, int i_type )
+ int i_type )
{
int i_subpic; /* subpicture index */
subpicture_t * p_subpic = NULL; /* first free subpicture */
- /* Get lock */
- vlc_mutex_lock( &p_vout->subpicture_lock );
-
- /*
- * Destroy all subpics which are not in the correct channel and
- * subpics which are in the right channel and have the same content type
- * (only concerns exclusive channels)
- */
- if( i_channel >= BEGIN_EXCLUSIVE_CHAN )
+ /* Clear the default channel before writing into it */
+ if( i_channel == DEFAULT_CHAN )
{
- for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
- {
- p_subpic = &p_vout->p_subpicture[i_subpic];
- if( p_subpic->i_status == FREE_SUBPICTURE
- || ( p_subpic->i_status != RESERVED_SUBPICTURE
- && p_subpic->i_status != READY_SUBPICTURE ) )
- {
- continue;
- }
- if( ( p_subpic->i_channel != i_channel
- && p_subpic->i_channel >= BEGIN_EXCLUSIVE_CHAN )
- || ( p_subpic->i_channel == i_channel
- && p_subpic->i_content == i_content ) )
- {
- if( p_subpic->pf_destroy )
- {
- p_subpic->pf_destroy( p_subpic );
- }
- p_subpic->i_status = FREE_SUBPICTURE;
- }
- }
+ vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
}
+ /* Get lock */
+ vlc_mutex_lock( &p_vout->subpicture_lock );
+
/*
* Look for an empty place
*/
/* Copy subpicture information, set some default values */
p_subpic->i_channel = i_channel;
- p_subpic->i_content = i_content;
-
p_subpic->i_type = i_type;
p_subpic->i_status = RESERVED_SUBPICTURE;
p_subpic->i_width = 0;
p_subpic->i_height = 0;
+ /* Remain last subpicture displayed in DEFAULT_CHAN */
+ if( i_channel == DEFAULT_CHAN )
+ {
+ p_vout->p_default_channel = p_subpic;
+ }
+
vlc_mutex_unlock( &p_vout->subpicture_lock );
return p_subpic;
return p_subpic;
}
+/*****************************************************************************
+ * vout_RegisterOSDChannel: register an OSD channel
+ *****************************************************************************
+ * This function affects an ID to an OSD channel
+ *****************************************************************************/
+int vout_RegisterOSDChannel( vout_thread_t *p_vout )
+{
+ msg_Dbg( p_vout, "Registering OSD channel, ID: %i", p_vout->i_channel_count + 1 );
+ return ++p_vout->i_channel_count;
+}
+
+/*****************************************************************************
+ * vout_ClearOSDChannel: clear an OSD channel
+ *****************************************************************************
+ * This function destroys the subpictures which belong to the OSD channel
+ * corresponding to i_channel_id.
+ *****************************************************************************/
+void vout_ClearOSDChannel( vout_thread_t *p_vout, int i_channel )
+{
+ int i_subpic; /* subpicture index */
+ subpicture_t * p_subpic = NULL; /* first free subpicture */
+
+ if( i_channel == DEFAULT_CHAN )
+ {
+ if( p_vout->p_default_channel != NULL )
+ {
+ vout_DestroySubPicture( p_vout, p_vout->p_default_channel );
+ }
+ p_vout->p_default_channel = NULL;
+ return;
+ }
+
+ vlc_mutex_lock( &p_vout->subpicture_lock );
+
+ for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
+ {
+ p_subpic = &p_vout->p_subpicture[i_subpic];
+ if( p_subpic->i_status == FREE_SUBPICTURE
+ || ( p_subpic->i_status != RESERVED_SUBPICTURE
+ && p_subpic->i_status != READY_SUBPICTURE ) )
+ {
+ continue;
+ }
+ if( p_subpic->i_channel == i_channel )
+ {
+ if( p_subpic->pf_destroy )
+ {
+ p_subpic->pf_destroy( p_subpic );
+ }
+ p_subpic->i_status = FREE_SUBPICTURE;
+ }
+ }
+
+ vlc_mutex_unlock( &p_vout->subpicture_lock );
+}