Commit 11e8ae92 authored by Yoann Peronneau's avatar Yoann Peronneau

* src/video_output/vout_subpictures.c : New OSD channels

When you want to use OSD, you have to register an OSD channel, by calling
vout_RegisterOSDChannel, then pass it to vout_CreateSubPicture.
There is a particular channel, DEFAULT_CHANNEL that can be used for
general purpose.
See modules/control/hotkeys.c for an example.
parent 6dcbb0a9
...@@ -126,8 +126,9 @@ and <function> vout_DatePicture </function> upon necessary. ...@@ -126,8 +126,9 @@ and <function> vout_DatePicture </function> upon necessary.
<listitem> <para> <type> subpicture_t * </type> <function> <listitem> <para> <type> subpicture_t * </type> <function>
vout_CreateSubPicture </function> <parameter> ( vout_thread_t *p_vout, vout_CreateSubPicture </function> <parameter> ( vout_thread_t *p_vout,
int i_type, int i_size ) </parameter> : int i_channel, int i_type ) </parameter> :
Returns an allocated subpicture buffer. <parameter> i_type 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 </parameter> is <constant> DVD_SUBPICTURE </constant> or
<constant> TEXT_SUBPICTURE</constant>, <parameter> i_size <constant> TEXT_SUBPICTURE</constant>, <parameter> i_size
</parameter> is the length in bytes of the packet. </parameter> is the length in bytes of the packet.
......
...@@ -65,4 +65,4 @@ VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) ); ...@@ -65,4 +65,4 @@ VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
# define vout_OSDMessage __vout_OSDMessage # define vout_OSDMessage __vout_OSDMessage
#endif #endif
VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) ); 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 ) );
...@@ -125,6 +125,10 @@ struct vout_thread_t ...@@ -125,6 +125,10 @@ struct vout_thread_t
/* Picture and subpicture heaps */ /* Picture and subpicture heaps */
picture_t p_picture[2*VOUT_MAX_PICTURES]; /**< pictures */ picture_t p_picture[2*VOUT_MAX_PICTURES]; /**< pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /**< subpictures */ 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 */ /* Statistics */
count_t c_loops; count_t c_loops;
...@@ -256,9 +260,11 @@ enum output_query_e ...@@ -256,9 +260,11 @@ enum output_query_e
* \addtogroup subpicture * \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_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) );
VLC_EXPORT( void, vout_DisplaySubPicture, ( 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 ); subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t );
void vout_RenderSubPictures ( vout_thread_t *, picture_t *, void vout_RenderSubPictures ( vout_thread_t *, picture_t *,
......
...@@ -193,10 +193,9 @@ struct picture_heap_t ...@@ -193,10 +193,9 @@ struct picture_heap_t
*/ */
struct subpicture_t struct subpicture_t
{ {
/** \name Channel and content type */ /** \name Channel ID */
/**@{*/ /**@{*/
int i_channel; /**< subpicture channel */ int i_channel; /**< subpicture channel ID */
int i_content; /**< content type */
/**@}*/ /**@}*/
/** \name Type and flags /** \name Type and flags
...@@ -241,24 +240,14 @@ struct subpicture_t ...@@ -241,24 +240,14 @@ struct subpicture_t
#define EMPTY_SUBPICTURE 0 /* subtitle slot is empty and available */ #define EMPTY_SUBPICTURE 0 /* subtitle slot is empty and available */
#define MEMORY_SUBPICTURE 100 /* subpicture stored in memory */ #define MEMORY_SUBPICTURE 100 /* subpicture stored in memory */
/* Default subpicture channel ID */
#define DEFAULT_CHAN 1
/* Subpicture status */ /* Subpicture status */
#define FREE_SUBPICTURE 0 /* free and not allocated */ #define FREE_SUBPICTURE 0 /* free and not allocated */
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */ #define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */ #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 * Prototypes
*****************************************************************************/ *****************************************************************************/
......
...@@ -843,7 +843,7 @@ static int DisplayAnchor( intf_thread_t *p_intf, ...@@ -843,7 +843,7 @@ static int DisplayAnchor( intf_thread_t *p_intf,
/* TODO: p_subpicture doesn't have the proper i_x and i_y /* TODO: p_subpicture doesn't have the proper i_x and i_y
* coordinates. Need to look at the subpicture display system to * coordinates. Need to look at the subpicture display system to
* work out why. */ * 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, psz_anchor_description, p_style, OSD_ALIGN_BOTTOM,
i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS ) i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS )
{ {
......
...@@ -175,6 +175,7 @@ typedef struct ...@@ -175,6 +175,7 @@ typedef struct
dvbsub_page_t* p_page; dvbsub_page_t* p_page;
dvbsub_object_t* p_objects; dvbsub_object_t* p_objects;
subpicture_t* p_spu[16]; subpicture_t* p_spu[16];
int i_subpic_channel;
} dvbsub_all_t; } dvbsub_all_t;
...@@ -295,6 +296,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block ) ...@@ -295,6 +296,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block; block_t *p_block;
vout_thread_t *p_last_vout;
if( pp_block == NULL || *pp_block == NULL ) if( pp_block == NULL || *pp_block == NULL )
{ {
...@@ -311,6 +313,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block ) ...@@ -311,6 +313,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block )
return; return;
} }
p_last_vout = p_sys->p_vout;
if( ( p_sys->p_vout = FindVout( p_dec ) ) ) if( ( p_sys->p_vout = FindVout( p_dec ) ) )
{ {
int i_data_identifier; int i_data_identifier;
...@@ -332,6 +335,12 @@ static void Decode( decoder_t *p_dec, block_t **pp_block ) ...@@ -332,6 +335,12 @@ static void Decode( decoder_t *p_dec, block_t **pp_block )
} }
i_end_data_marker = bs_read( &p_sys->bs, 8 ); 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 */ /* Check if the page is to be displayed */
if( p_sys->dvbsub.p_page && p_sys->dvbsub.p_objects ) if( p_sys->dvbsub.p_page && p_sys->dvbsub.p_objects )
{ {
...@@ -1258,7 +1267,7 @@ static void render( dvbsub_all_t *dvbsub, vout_thread_t *p_vout ) ...@@ -1258,7 +1267,7 @@ static void render( dvbsub_all_t *dvbsub, vout_thread_t *p_vout )
/* Allocate the subpicture internal data. */ /* Allocate the subpicture internal data. */
dvbsub->p_spu[j] = dvbsub->p_spu[j] =
vout_CreateSubPicture( p_vout, SUBT1_CHAN, TEXT_CONTENT, vout_CreateSubPicture( p_vout, dvbsub->i_subpic_channel,
MEMORY_SUBPICTURE ); MEMORY_SUBPICTURE );
if( dvbsub->p_spu[j] == NULL ) if( dvbsub->p_spu[j] == NULL )
{ {
......
...@@ -48,7 +48,7 @@ vlc_module_begin(); ...@@ -48,7 +48,7 @@ vlc_module_begin();
set_callbacks( VCDSubOpen, VCDSubClose ); set_callbacks( VCDSubOpen, VCDSubClose );
add_integer ( MODULE_STRING "-debug", 0, NULL, 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, add_integer ( MODULE_STRING "-horizontal-correct", 0, NULL,
HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE ); HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE );
...@@ -57,12 +57,12 @@ vlc_module_begin(); ...@@ -57,12 +57,12 @@ vlc_module_begin();
VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE ); VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE );
add_string( MODULE_STRING "-aspect-ratio", "", NULL, add_string( MODULE_STRING "-aspect-ratio", "", NULL,
SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT, SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT,
VLC_TRUE ); VLC_TRUE );
add_integer( MODULE_STRING "-duration-scaling", 3, NULL, add_integer( MODULE_STRING "-duration-scaling", 3, NULL,
DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT, DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT,
VLC_TRUE ); VLC_TRUE );
add_submodule(); add_submodule();
set_description( _("Chaoji VCD subtitle packetizer") ); set_description( _("Chaoji VCD subtitle packetizer") );
...@@ -145,6 +145,7 @@ Decode ( decoder_t *p_dec, block_t **pp_block ) ...@@ -145,6 +145,7 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block ); 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) , ""); dbg_print( (DECODE_DBG_CALL) , "");
...@@ -156,6 +157,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block ) ...@@ -156,6 +157,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
if( ( p_sys->p_vout = VCDSubFindVout( p_dec ) ) ) 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 */ /* Parse and decode */
E_(ParsePacket)( p_dec ); E_(ParsePacket)( p_dec );
...@@ -229,36 +236,37 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -229,36 +236,37 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
p_buffer = p_block->p_buffer; p_buffer = p_block->p_buffer;
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET), dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
"header: 0x%02x 0x%02x 0x%02x 0x%02x, 0x%02x, 0x%02x, size: %i", "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[1], p_buffer[2], p_buffer[3], p_buffer[4],
p_buffer[5], p_buffer[6], p_buffer[5], p_buffer[6],
p_block->i_buffer); p_block->i_buffer);
/* Attach to our input thread and see if subtitle is selected. */ /* Attach to our input thread and see if subtitle is selected. */
{ {
vlc_object_t * p_input; vlc_object_t * p_input;
vlc_value_t val; 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 ); vlc_object_release( p_input );
/* Number could be 0bd, 1bd, 2bd, 3bd for 0..3. If so /* Number could be 0bd, 1bd, 2bd, 3bd for 0..3. If so
reduce it to 0..3. reduce it to 0..3.
*/ */
if ( (val.i_int & 0xff) == 0xbd ) val.i_int >>= 8; if ( (val.i_int & 0xff) == 0xbd ) val.i_int >>= 8;
if( val.i_int == -1 || val.i_int != p_buffer[0] ) if( val.i_int == -1 || val.i_int != p_buffer[0] )
return NULL; return NULL;
} }
...@@ -268,8 +276,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -268,8 +276,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
image don't. */ image don't. */
if ( p_sys->state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts == 0 ) { if ( p_sys->state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts == 0 ) {
msg_Warn( p_dec, msg_Warn( p_dec,
"first packet expected but no PTS present -- skipped\n"); "first packet expected but no PTS present -- skipped\n");
return NULL; return NULL;
} }
...@@ -280,8 +288,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -280,8 +288,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
} }
/* FIXME - remove append_data and use chainappend */ /* FIXME - remove append_data and use chainappend */
VCDSubAppendData( p_dec, p_buffer + SPU_HEADER_LEN, VCDSubAppendData( p_dec, p_buffer + SPU_HEADER_LEN,
p_block->i_buffer - SPU_HEADER_LEN ); p_block->i_buffer - SPU_HEADER_LEN );
block_ChainAppend( &p_sys->p_block, p_block ); block_ChainAppend( &p_sys->p_block, p_block );
...@@ -295,6 +303,5 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -295,6 +303,5 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
p_sys->state = SUBTITLE_BLOCK_PARTIAL; p_sys->state = SUBTITLE_BLOCK_PARTIAL;
} }
return NULL; return NULL;
} }
...@@ -292,7 +292,7 @@ E_(ParsePacket)( decoder_t *p_dec) ...@@ -292,7 +292,7 @@ E_(ParsePacket)( decoder_t *p_dec)
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , ""); dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */ /* 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 ); MEMORY_SUBPICTURE );
if( p_spu == NULL ) if( p_spu == NULL )
{ {
......
...@@ -48,7 +48,7 @@ vlc_module_begin(); ...@@ -48,7 +48,7 @@ vlc_module_begin();
set_callbacks( VCDSubOpen, VCDSubClose ); set_callbacks( VCDSubOpen, VCDSubClose );
add_integer ( MODULE_STRING "-debug", 0, NULL, 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, add_integer ( MODULE_STRING "-horizontal-correct", 0, NULL,
HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE ); HORIZONTAL_CORRECT, HORIZONTAL_CORRECT_LONGTEXT, VLC_FALSE );
...@@ -57,12 +57,10 @@ vlc_module_begin(); ...@@ -57,12 +57,10 @@ vlc_module_begin();
VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE ); VERTICAL_CORRECT, VERTICAL_CORRECT_LONGTEXT, VLC_FALSE );
add_string( MODULE_STRING "-aspect-ratio", "", NULL, add_string( MODULE_STRING "-aspect-ratio", "", NULL,
SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT, SUB_ASPECT_RATIO_TEXT, SUB_ASPECT_RATIO_LONGTEXT, VLC_TRUE );
VLC_TRUE );
add_integer( MODULE_STRING "-duration-scaling", 9, NULL, add_integer( MODULE_STRING "-duration-scaling", 9, NULL,
DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT, DURATION_SCALE_TEXT, DURATION_SCALE_LONGTEXT, VLC_TRUE );
VLC_TRUE );
add_submodule(); add_submodule();
set_description( _("Philips OGT (SVCD subtitle) packetizer") ); set_description( _("Philips OGT (SVCD subtitle) packetizer") );
...@@ -145,6 +143,7 @@ Decode ( decoder_t *p_dec, block_t **pp_block ) ...@@ -145,6 +143,7 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block ); 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) , ""); dbg_print( (DECODE_DBG_CALL) , "");
...@@ -156,6 +155,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block ) ...@@ -156,6 +155,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
if( ( p_sys->p_vout = VCDSubFindVout( p_dec ) ) ) 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 */ /* Parse and decode */
E_(ParsePacket)( p_dec ); E_(ParsePacket)( p_dec );
...@@ -239,34 +244,36 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -239,34 +244,36 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
p_buffer = p_block->p_buffer; p_buffer = p_block->p_buffer;
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET), dbg_print( (DECODE_DBG_CALL|DECODE_DBG_PACKET),
"header: 0x%02x 0x%02x 0x%02x 0x%02x, size: %i", "header: 0x%02x 0x%02x 0x%02x 0x%02x, size: %i",
p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4], p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4],
p_block->i_buffer); p_block->i_buffer);
/* Attach to our input thread and see if subtitle is selected. */ /* Attach to our input thread and see if subtitle is selected. */
{ {
vlc_object_t * p_input; vlc_object_t * p_input;
vlc_value_t val; 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 ) ) { if( var_Get( p_input, "spu-channel", &val ) )
vlc_object_release( p_input ); {
vlc_object_release( p_input );
return NULL; return NULL;
} }
vlc_object_release( p_input ); 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]); "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 dummy ES that the menu selection uses has an 0x70 at
the head which we need to strip off. */ the head which we need to strip off. */
if( val.i_int == -1 || (val.i_int & 0x03) != p_buffer[1] ) { if( val.i_int == -1 || (val.i_int & 0x03) != p_buffer[1] )
dbg_print( DECODE_DBG_PACKET, "subtitle not for us.\n"); {
return NULL; dbg_print( DECODE_DBG_PACKET, "subtitle not for us.\n");
return NULL;
} }
} }
...@@ -332,7 +339,7 @@ Reassemble( decoder_t *p_dec, block_t **pp_block ) ...@@ -332,7 +339,7 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
} }
/* /*
* Local variables: * Local variables:
* c-file-style: "gnu" * c-file-style: "gnu"
* tab-width: 8 * tab-width: 8
......
...@@ -165,7 +165,7 @@ E_(ParsePacket)( decoder_t *p_dec) ...@@ -165,7 +165,7 @@ E_(ParsePacket)( decoder_t *p_dec)
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , ""); dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */ /* 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 ); MEMORY_SUBPICTURE );
if( p_spu == NULL ) if( p_spu == NULL )
{ {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define DECODE_DBG_PNG 64 /* Extract subtitles to PNG files. */ #define DECODE_DBG_PNG 64 /* Extract subtitles to PNG files. */
#define DECODE_DBG_INFO 128 #define DECODE_DBG_INFO 128
#define DEBUG_TEXT N_( \ #define DEBUG_TEXT N_( \
"If nonzero, this gives additional debug information." \ "If nonzero, this gives additional debug information." \
) )
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
"misc info 128\n" ) "misc info 128\n" )
#define SUB_ASPECT_RATIO_TEXT N_("Subtitle aspect-ratio correction") #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 " \ "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 " \ "the right value will be determined automatically. Usually this is what " \
"you want. For OGT and CVD subtitles this undoes the effect " \ "you want. For OGT and CVD subtitles this undoes the effect " \
...@@ -66,26 +66,26 @@ ...@@ -66,26 +66,26 @@
) )
#define DURATION_SCALE_TEXT N_("Factor to increase subtitle display interval") #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, " \ "If you find you need extra time for reading subtitles, " \
"you can set this higher and it will multiply the display " \ "you can set this higher and it will multiply the display " \
"time by that amount. Use 0 to mean until the next " \ "time by that amount. Use 0 to mean until the next " \
"subtitle.") "subtitle.")
#define HORIZONTAL_CORRECT \ #define HORIZONTAL_CORRECT \
N_("Add this to starting horizontal position of subtitle.") 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, " \ "If you need to adjust the subtitle starting position horizontally, " \
"set this. Negative values shift left and positive values right. 0 would " \ "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 \ #define VERTICAL_CORRECT \
N_("Add this to starting vertical position of subtitle.") 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, " \ "If you need to adjust the subtitle starting position vertically, " \
"set this. Negative values shift up, positive values down. 0 would " \ "set this. Negative values shift up, positive values down. 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 DECODE_DEBUG 1 #define DECODE_DEBUG 1
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
/* The number of color palette entries allowed in a subtitle. */ /* The number of color palette entries allowed in a subtitle. */
#define NUM_SUBTITLE_COLORS 4 #define NUM_SUBTITLE_COLORS 4
typedef enum { typedef enum {
SUBTITLE_BLOCK_EMPTY, SUBTITLE_BLOCK_EMPTY,
...@@ -118,7 +118,7 @@ typedef enum { ...@@ -118,7 +118,7 @@ typedef enum {
/* The byte storage used by one pixel */ /* The byte storage used by one pixel */
#define PIXEL_SIZE 4 #define PIXEL_SIZE 4
/* Size in bytes of YUV portion above. */ /* Size in bytes of YUV portion above. */
#define YUV_SIZE 3 #define YUV_SIZE 3
...@@ -133,50 +133,52 @@ struct decoder_sys_t ...@@ -133,50 +133,52 @@ struct decoder_sys_t
int i_spu; int i_spu;
packet_state_t state; /* data-gathering state for this subtitle */ packet_state_t state; /* data-gathering state for this subtitle */
uint16_t i_image; /* image number in the subtitle stream; 0 is the uint16_t i_image; /* image number in the subtitle stream; 0 is the
first one. */ first one. */
uint8_t i_packet;/* packet number for above image number; 0 is the uint8_t i_packet;/* packet number for above image number; 0 is the
first one. */ first one. */
block_t *p_block;/* Bytes of the packet. */ block_t *p_block;/* Bytes of the packet. */
uint8_t buffer[65536 + 20 ]; /* we will never overflow more than 11 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 b_packetizer;
int i_spu_size; /* goal for subtitle_data_pos while gathering, int i_spu_size; /* goal for subtitle_data_pos while gathering,
size of used subtitle_data later */ size of used subtitle_data later */
vout_thread_t *p_vout; vout_thread_t *p_vout;
int i_subpic_channel; /* Subpicture channel in which subtitles will
be written */
/* FIXME: Remove this? */ /* FIXME: Remove this? */
uint8_t *subtitle_data; /* buffer used to accumulate data from uint8_t *subtitle_data; /* buffer used to accumulate data from
successive packets in the same subtitle */ successive packets in the same subtitle */
int subtitle_data_size; /* size of the allocated subtitle_data */ int subtitle_data_size; /* size of the allocated subtitle_data */
/* Move into subpicture_sys_t? */ /* Move into subpicture_sys_t? */
uint16_t i_image_offset; /* offset from subtitle_data to compressed uint16_t i_image_offset; /* offset from subtitle_data to compressed
image data */ image data */
int i_image_length; /* size of the compressed image data */ int i_image_length; /* size of the compressed image data */
int first_field_offset; /* offset of even raster lines. Used 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 second_field_offset; /* offset of odd raster lines */
int metadata_offset; /* offset to data describing the image */ int metadata_offset; /* offset to data describing the image */
int metadata_length; /* length of metadata */ 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 mtime_t i_duration; /* how long to display the image, 0 stands
for "until next subtitle" */ for "until next subtitle" */
uint16_t i_x_start, i_y_start; /* position of top leftmost pixel of uint16_t i_x_start, i_y_start; /* position of top leftmost pixel of
image when displayed */ image when displayed */
uint16_t i_width, i_height; /* dimensions in pixels of image */ uint16_t i_width, i_height; /* dimensions in pixels of image */
ogt_yuvt_t p_palette[NUM_SUBTITLE_COLORS]; /* Palette of colors used 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 ogt_yuvt_t p_palette_highlight[NUM_SUBTITLE_COLORS]; /* Only used
for CVD */ for CVD */
uint8_t i_options; uint8_t i_options;
uint8_t i_options2; uint8_t i_options2;
...@@ -194,7 +196,7 @@ struct subpicture_sys_t ...@@ -194,7 +196,7 @@ struct subpicture_sys_t
/* Link to our input */ /* Link to our input */
vlc_object_t * p_input; vlc_object_t * p_input;
/* Cropping properties */ /* Cropping properties */
vlc_mutex_t lock; vlc_mutex_t lock;
vlc_bool_t b_crop; vlc_bool_t b_crop;
...@@ -202,6 +204,6 @@ struct subpicture_sys_t ...@@ -202,6 +204,6 @@ struct subpicture_sys_t
/* This is only used for color palette Chromas like RGB2. */ /* This is only used for color palette Chromas like RGB2. */
ogt_yuvt_t p_palette[NUM_SUBTITLE_COLORS]; /* Palette of colors used ogt_yuvt_t p_palette[NUM_SUBTITLE_COLORS]; /* Palette of colors used
in subtitle */ in subtitle */
}; };
...@@ -70,9 +70,10 @@ void E_(ParsePacket)( decoder_t *p_dec) ...@@ -70,9 +70,10 @@ void E_(ParsePacket)( decoder_t *p_dec)
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu; subpicture_t *p_spu;
int i_spu_channel;
/* Allocate the subpicture internal data. */ /* 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 ); MEMORY_SUBPICTURE );
if( p_spu == NULL ) if( p_spu == NULL )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* spudec.c : SPU decoder thread * spudec.c : SPU decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -153,10 +153,11 @@ static void Close( vlc_object_t *p_this ) ...@@ -153,10 +153,11 @@ static void Close( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* Decode: * 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; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_spu = Reassemble( p_dec, pp_block ); 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_spu )
{ {
...@@ -166,6 +167,12 @@ static void Decode ( decoder_t *p_dec, block_t **pp_block ) ...@@ -166,6 +167,12 @@ static void Decode ( decoder_t *p_dec, block_t **pp_block )
if( ( p_sys->p_vout = FindVout( p_dec ) ) ) 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 */ /* Parse and decode */
E_(ParsePacket)( p_dec ); E_(ParsePacket)( p_dec );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* spudec.h : sub picture unit decoder thread interface * spudec.h : sub picture unit decoder thread interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -30,6 +30,8 @@ struct decoder_sys_t ...@@ -30,6 +30,8 @@ struct decoder_sys_t
int i_rle_size; int i_rle_size;
int i_spu; int i_spu;
int i_subpic_channel;
block_t *p_block; block_t *p_block;
uint8_t buffer[65536 + 20 ]; /* we will never overflow more than 11 bytes if I'm right */ uint8_t buffer[65536 + 20 ]; /* we will never overflow more than 11 bytes if I'm right */
......
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
struct decoder_sys_t struct decoder_sys_t
{ {
int i_align; /* Subtitles alignment on the vout */ 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) #if defined(HAVE_ICONV)
iconv_t iconv_handle; /* handle to iconv instance */ iconv_t iconv_handle; /* handle to iconv instance */
...@@ -182,6 +185,8 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -182,6 +185,8 @@ static int OpenDecoder( vlc_object_t *p_this )
msg_Dbg( p_dec, "no iconv support available" ); msg_Dbg( p_dec, "no iconv support available" );
#endif #endif
p_dec->p_sys->p_vout = NULL;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -204,6 +209,10 @@ static void DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -204,6 +209,10 @@ static void DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE ); p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout ) 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 ); ParseText( p_dec, *pp_block, p_vout );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
...@@ -211,6 +220,7 @@ static void DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -211,6 +220,7 @@ static void DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
msg_Warn( p_dec, "couldn't find a video output, trashing subtitle" ); msg_Warn( p_dec, "couldn't find a video output, trashing subtitle" );
} }
p_dec->p_sys->p_vout = p_vout;
block_Release( *pp_block ); block_Release( *pp_block );
*pp_block = NULL; *pp_block = NULL;
...@@ -271,7 +281,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block, ...@@ -271,7 +281,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
msg_Warn( p_dec, "subtitle without a date" ); msg_Warn( p_dec, "subtitle without a date" );
return; return;
} }
/* Check validity of packet data */ /* Check validity of packet data */
if( p_block->i_buffer <= 1 || p_block->p_buffer[0] == '\0' ) if( p_block->i_buffer <= 1 || p_block->p_buffer[0] == '\0' )
{ {
...@@ -281,7 +291,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block, ...@@ -281,7 +291,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
/* Should be resiliant against bad subtitles */ /* Should be resiliant against bad subtitles */
psz_subtitle = strndup( p_block->p_buffer, p_block->i_buffer ); psz_subtitle = strndup( p_block->p_buffer, p_block->i_buffer );
i_align_h = p_sys->i_align ? 20 : 0; i_align_h = p_sys->i_align ? 20 : 0;
i_align_v = 10; i_align_v = 10;
...@@ -371,7 +381,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block, ...@@ -371,7 +381,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
} }
} }
StripTags( psz_subtitle ); 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, OSD_ALIGN_BOTTOM | p_sys->i_align, i_align_h,
i_align_v, p_block->i_pts, i_align_v, p_block->i_pts,
p_block->i_length ? p_block->i_pts + p_block->i_length : 0 ); p_block->i_length ? p_block->i_pts + p_block->i_length : 0 );
...@@ -421,4 +431,3 @@ static void StripTags( char *psz_text ) ...@@ -421,4 +431,3 @@ static void StripTags( char *psz_text )
} }
psz_text[ i - i_left_moves ] = '\0'; psz_text[ i - i_left_moves ] = '\0';
} }
...@@ -742,8 +742,8 @@ mediacontrol_display_text( mediacontrol_Instance *self, ...@@ -742,8 +742,8 @@ mediacontrol_display_text( mediacontrol_Instance *self,
mediacontrol_MediaTime, mediacontrol_MediaTime,
end->value ); end->value );
vout_ShowTextRelative( p_vout, SUBT1_CHAN, ( char* ) message, NULL, vout_ShowTextRelative( p_vout, DEFAULT_CHAN, ( char* ) message, NULL,
OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20, OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
i_duration ); i_duration );
} }
else else
...@@ -768,9 +768,9 @@ mediacontrol_display_text( mediacontrol_Instance *self, ...@@ -768,9 +768,9 @@ mediacontrol_display_text( mediacontrol_Instance *self,
( mediacontrol_Position * ) end ); ( mediacontrol_Position * ) end );
i_fin += i_now; i_fin += i_now;
vout_ShowTextAbsolute( p_vout, SUBT1_CHAN, ( char* )message, NULL, vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, ( char* ) message, NULL,
OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20, OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 20, 20,
i_debut, i_fin ); i_debut, i_fin );
} }
vlc_object_release( p_vout ); vlc_object_release( p_vout );
......
This diff is collapsed.
...@@ -45,6 +45,8 @@ struct intf_sys_t ...@@ -45,6 +45,8 @@ struct intf_sys_t
struct lirc_config *config; struct lirc_config *config;
vlc_mutex_t change_lock; vlc_mutex_t change_lock;
int i_osd_channel;
input_thread_t * p_input; input_thread_t * p_input;
vout_thread_t * p_vout; vout_thread_t * p_vout;
}; };
...@@ -189,21 +191,21 @@ static void Run( intf_thread_t *p_intf ) ...@@ -189,21 +191,21 @@ static void Run( intf_thread_t *p_intf )
if( !strcmp( c, "QUIT" ) ) if( !strcmp( c, "QUIT" ) )
{ {
p_intf->p_vlc->b_die = VLC_TRUE; p_intf->p_vlc->b_die = VLC_TRUE;
vout_OSDMessage( p_intf, SOLO_CHAN, _("Quit" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Quit" ) );
continue; continue;
} }
else if( !strcmp( c, "VOL_UP" ) ) else if( !strcmp( c, "VOL_UP" ) )
{ {
audio_volume_t i_newvol; audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &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 ); i_newvol * 100 / AOUT_VOLUME_MAX );
} }
else if( !strcmp( c, "VOL_DOWN" ) ) else if( !strcmp( c, "VOL_DOWN" ) )
{ {
audio_volume_t i_newvol; audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &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 ); i_newvol * 100 / AOUT_VOLUME_MAX );
} }
else if( !strcmp( c, "MUTE" ) ) else if( !strcmp( c, "MUTE" ) )
...@@ -212,11 +214,11 @@ static void Run( intf_thread_t *p_intf ) ...@@ -212,11 +214,11 @@ static void Run( intf_thread_t *p_intf )
aout_VolumeMute( p_intf, &i_newvol ); aout_VolumeMute( p_intf, &i_newvol );
if( i_newvol == 0 ) if( i_newvol == 0 )
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Mute" ) );
} }
else else
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %d%%"), vout_OSDMessage( p_intf, DEFAULT_CHAN, _("Vol %d%%"),
i_newvol * 100 / AOUT_VOLUME_MAX ); i_newvol * 100 / AOUT_VOLUME_MAX );
} }
} }
...@@ -305,7 +307,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -305,7 +307,7 @@ static void Run( intf_thread_t *p_intf )
} }
if( p_input && val.i_int != PAUSE_S ) 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" ) ); _( "Pause" ) );
val.i_int = PAUSE_S; val.i_int = PAUSE_S;
var_Set( p_input, "state", val ); var_Set( p_input, "state", val );
...@@ -320,7 +322,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -320,7 +322,7 @@ static void Run( intf_thread_t *p_intf )
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); 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 ); playlist_Play( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -367,7 +369,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -367,7 +369,7 @@ static void Run( intf_thread_t *p_intf )
list.p_list->p_values[i+1] ); list.p_list->p_values[i+1] );
i++; i++;
} }
vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN, vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Audio track: %s"), _("Audio track: %s"),
list2.p_list->p_values[i].psz_string ); list2.p_list->p_values[i].psz_string );
} }
...@@ -403,14 +405,14 @@ static void Run( intf_thread_t *p_intf ) ...@@ -403,14 +405,14 @@ static void Run( intf_thread_t *p_intf )
var_Set( p_input, "spu-es", list.p_list->p_values[i+1] ); var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
i = i + 1; i = i + 1;
} }
vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN, vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Subtitle track: %s"), _("Subtitle track: %s"),
list2.p_list->p_values[i].psz_string ); list2.p_list->p_values[i].psz_string );
} }
else if( !strcmp( c, "PAUSE" ) ) else if( !strcmp( c, "PAUSE" ) )
{ {
vlc_value_t val; vlc_value_t val;
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S; val.i_int = PAUSE_S;
var_Set( p_input, "state", val ); var_Set( p_input, "state", val );
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
} }
if( p_input && val.i_int != PAUSE_S ) 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; val.i_int = PAUSE_S;
var_Set( p_input, "state", val ); var_Set( p_input, "state", val );
} }
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); 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 ); playlist_Play( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist != NULL ) if( p_playlist != NULL )
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Stop" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Stop" ) );
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE; vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-faster", val ); 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_object_release( p_input );
} }
} }
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE; vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val ); 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 ); vlc_object_release( p_input );
} }
} }
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
{ {
playlist_Prev( p_playlist ); playlist_Prev( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Previous" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Previous" ) );
} }
} }
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
{ {
playlist_Next( p_playlist ); playlist_Next( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Next" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Next" ) );
} }
} }
...@@ -170,11 +170,11 @@ ...@@ -170,11 +170,11 @@
var_Set( p_playlist, "random", val ); var_Set( p_playlist, "random", val );
if( val.b_bool ) if( val.b_bool )
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random On" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random On" ) );
} }
else 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; p_intf->p_sys->b_playlist_update = VLC_TRUE;
...@@ -202,11 +202,11 @@ ...@@ -202,11 +202,11 @@
var_Set( p_playlist, "repeat", val ); var_Set( p_playlist, "repeat", val );
if( val.b_bool ) if( val.b_bool )
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
} }
else 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; p_intf->p_sys->b_playlist_update = VLC_TRUE;
...@@ -234,11 +234,11 @@ ...@@ -234,11 +234,11 @@
var_Set( p_playlist, "loop", val ); var_Set( p_playlist, "loop", val );
if( val.b_bool ) if( val.b_bool )
{ {
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
} }
else 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; p_intf->p_sys->b_playlist_update = VLC_TRUE;
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
vlc_value_t time; vlc_value_t time;
time.i_time = 10 * 1000000; time.i_time = 10 * 1000000;
var_Set( p_input, "time-offset", time ); 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_object_release( p_input );
} }
} }
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
vlc_value_t time; vlc_value_t time;
time.i_time = -10 * 1000000; time.i_time = -10 * 1000000;
var_Set( p_input, "time-offset", time ); 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_object_release( p_input );
} }
} }
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; [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 ); i_volume*100/AOUT_VOLUME_MAX );
} }
......
...@@ -545,7 +545,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -545,7 +545,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
var_Set( p_playlist, "loop", val1 ); var_Set( p_playlist, "loop", val1 );
val1.b_bool = 1; val1.b_bool = 1;
var_Set( p_playlist, "repeat", val1 ); var_Set( p_playlist, "repeat", val1 );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
break; break;
case 2: case 2:
...@@ -553,7 +553,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -553,7 +553,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
var_Set( p_playlist, "repeat", val1 ); var_Set( p_playlist, "repeat", val1 );
val1.b_bool = 1; val1.b_bool = 1;
var_Set( p_playlist, "loop", val1 ); var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
break; break;
default: default:
...@@ -564,7 +564,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -564,7 +564,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
val1.b_bool = 0; val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 ); var_Set( p_playlist, "repeat", val1 );
var_Set( p_playlist, "loop", val1 ); var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
} }
break; break;
} }
......
...@@ -706,8 +706,7 @@ static subpicture_t *AddText ( vout_thread_t *p_vout, int i_channel, ...@@ -706,8 +706,7 @@ static subpicture_t *AddText ( vout_thread_t *p_vout, int i_channel,
p_subpic = 0; p_subpic = 0;
/* Create and initialize a subpicture */ /* Create and initialize a subpicture */
p_subpic = vout_CreateSubPicture( p_vout, i_channel, TEXT_CONTENT, p_subpic = vout_CreateSubPicture( p_vout, i_channel, MEMORY_SUBPICTURE );
MEMORY_SUBPICTURE );
if ( p_subpic == NULL ) if ( p_subpic == NULL )
{ {
return NULL; return NULL;
......
...@@ -253,6 +253,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -253,6 +253,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
/* No images in the heap */ /* No images in the heap */
p_vout->i_heap_size = 0; 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 */ /* Initialize the rendering heap */
I_RENDERPICTURES = 0; I_RENDERPICTURES = 0;
p_vout->render.i_width = i_width; p_vout->render.i_width = i_width;
......
...@@ -382,8 +382,7 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel ) ...@@ -382,8 +382,7 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
p_widget = 0; p_widget = 0;
/* Create and initialize a subpicture */ /* Create and initialize a subpicture */
p_subpic = vout_CreateSubPicture( p_vout, i_channel, GRAPH_CONTENT, p_subpic = vout_CreateSubPicture( p_vout, i_channel, MEMORY_SUBPICTURE );
MEMORY_SUBPICTURE );
if( p_subpic == NULL ) if( p_subpic == NULL )
{ {
return NULL; return NULL;
...@@ -493,29 +492,19 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position, ...@@ -493,29 +492,19 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
* Displays an OSD icon. * Displays an OSD icon.
* Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_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, vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
subpicture_t *p_subpic; subpicture_t *p_subpic;
subpicture_sys_t *p_widget; 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" ) ) if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) )
{ {
return; 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 ); p_subpic = vout_CreateWidget( p_vout, i_channel );
if( p_subpic == NULL ) if( p_subpic == NULL )
{ {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* \param p_vout the video output this subpicture should be displayed on * \param p_vout the video output this subpicture should be displayed on
* \param p_subpic the subpicture to display * \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; int i_margin;
...@@ -83,44 +83,20 @@ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) ...@@ -83,44 +83,20 @@ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
* \return NULL on error, a reserved subpicture otherwise * \return NULL on error, a reserved subpicture otherwise
*/ */
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel, 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 */ int i_subpic; /* subpicture index */
subpicture_t * p_subpic = NULL; /* first free subpicture */ subpicture_t * p_subpic = NULL; /* first free subpicture */
/* Get lock */ /* Clear the default channel before writing into it */
vlc_mutex_lock( &p_vout->subpicture_lock ); if( i_channel == DEFAULT_CHAN )
/*
* 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 )
{ {
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ ) vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
{
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;
}
}
} }
/* Get lock */
vlc_mutex_lock( &p_vout->subpicture_lock );
/* /*
* Look for an empty place * Look for an empty place
*/ */
...@@ -146,8 +122,6 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel, ...@@ -146,8 +122,6 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel,
/* Copy subpicture information, set some default values */ /* Copy subpicture information, set some default values */
p_subpic->i_channel = i_channel; p_subpic->i_channel = i_channel;
p_subpic->i_content = i_content;
p_subpic->i_type = i_type; p_subpic->i_type = i_type;
p_subpic->i_status = RESERVED_SUBPICTURE; p_subpic->i_status = RESERVED_SUBPICTURE;
...@@ -160,6 +134,12 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel, ...@@ -160,6 +134,12 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel,
p_subpic->i_width = 0; p_subpic->i_width = 0;
p_subpic->i_height = 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 ); vlc_mutex_unlock( &p_vout->subpicture_lock );
return p_subpic; return p_subpic;
...@@ -337,3 +317,58 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout, ...@@ -337,3 +317,58 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout,
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 );
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment