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.
<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.
......
......@@ -65,4 +65,4 @@ VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
# 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 ) );
......@@ -125,6 +125,10 @@ struct vout_thread_t
/* 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;
......@@ -256,9 +260,11 @@ enum output_query_e
* \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 *,
......
......@@ -193,10 +193,9 @@ struct picture_heap_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
......@@ -241,24 +240,14 @@ struct subpicture_t
#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
*****************************************************************************/
......
......@@ -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
* 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 )
{
......
......@@ -175,6 +175,7 @@ typedef struct
dvbsub_page_t* p_page;
dvbsub_object_t* p_objects;
subpicture_t* p_spu[16];
int i_subpic_channel;
} dvbsub_all_t;
......@@ -295,6 +296,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block )
{
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 )
{
......@@ -311,6 +313,7 @@ static void Decode( decoder_t *p_dec, block_t **pp_block )
return;
}
p_last_vout = p_sys->p_vout;
if( ( p_sys->p_vout = FindVout( p_dec ) ) )
{
int i_data_identifier;
......@@ -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 );
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 )
{
......@@ -1258,7 +1267,7 @@ static void render( dvbsub_all_t *dvbsub, vout_thread_t *p_vout )
/* 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 )
{
......
......@@ -48,7 +48,7 @@ vlc_module_begin();
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 );
......@@ -57,12 +57,12 @@ vlc_module_begin();
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") );
......@@ -145,6 +145,7 @@ 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;
dbg_print( (DECODE_DBG_CALL) , "");
......@@ -156,6 +157,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
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 );
......@@ -229,36 +236,37 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
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;
}
......@@ -268,8 +276,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
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;
}
......@@ -280,8 +288,8 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
}
/* 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 );
......@@ -295,6 +303,5 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
p_sys->state = SUBTITLE_BLOCK_PARTIAL;
}
return NULL;
}
......@@ -292,7 +292,7 @@ E_(ParsePacket)( decoder_t *p_dec)
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 )
{
......
......@@ -48,7 +48,7 @@ vlc_module_begin();
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 );
......@@ -57,12 +57,10 @@ vlc_module_begin();
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") );
......@@ -145,6 +143,7 @@ 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;
dbg_print( (DECODE_DBG_CALL) , "");
......@@ -156,6 +155,12 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
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 );
......@@ -239,34 +244,36 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
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;
}
}
......@@ -332,7 +339,7 @@ Reassemble( decoder_t *p_dec, block_t **pp_block )
}
/*
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
......
......@@ -165,7 +165,7 @@ E_(ParsePacket)( decoder_t *p_dec)
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 )
{
......
......@@ -35,7 +35,7 @@
#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." \
)
......@@ -51,7 +51,7 @@
"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 " \
......@@ -66,26 +66,26 @@
)
#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
......@@ -107,7 +107,7 @@
/* 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,
......@@ -118,7 +118,7 @@ typedef enum {
/* 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
......@@ -133,50 +133,52 @@ struct decoder_sys_t
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;
......@@ -194,7 +196,7 @@ struct subpicture_sys_t
/* Link to our input */
vlc_object_t * p_input;
/* Cropping properties */
vlc_mutex_t lock;
vlc_bool_t b_crop;
......@@ -202,6 +204,6 @@ struct subpicture_sys_t
/* 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 */
};
......@@ -70,9 +70,10 @@ void E_(ParsePacket)( decoder_t *p_dec)
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 )
{
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -153,10 +153,11 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* 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 )
{
......@@ -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_last_vout != p_sys->p_vout )
{
p_sys->i_subpic_channel =
vout_RegisterOSDChannel( p_sys->p_vout );
}
/* Parse and decode */
E_(ParsePacket)( p_dec );
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -30,6 +30,8 @@ struct decoder_sys_t
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 */
......
......@@ -43,6 +43,9 @@
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 */
......@@ -182,6 +185,8 @@ static int OpenDecoder( vlc_object_t *p_this )
msg_Dbg( p_dec, "no iconv support available" );
#endif
p_dec->p_sys->p_vout = NULL;
return VLC_SUCCESS;
}
......@@ -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 );
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 );
}
......@@ -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" );
}
p_dec->p_sys->p_vout = p_vout;