Commit 28ed0fc9 authored by Gildas Bazin's avatar Gildas Bazin

* ALL: separation of the SPU engine from the VOUT.

* modules/stream_out/transcode.c: re-use the SPU engine.
* src/video_output/vout_subpictures.c: support for resizing subpictures.
parent e9097e4f
......@@ -108,6 +108,7 @@ HEADERS_include = \
include/vlc_meta.h \
include/vlc_objects.h \
include/vlc_playlist.h \
include/vlc_spu.h \
include/vlc_stream.h \
include/vlc_threads_funcs.h \
include/vlc_threads.h \
......
......@@ -126,22 +126,8 @@ struct vout_thread_t
/* Picture heap */
picture_t p_picture[2*VOUT_MAX_PICTURES+1]; /**< pictures */
/* Subpicture properties */
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 */
filter_t *p_blend; /**< alpha blending module */
filter_t *p_text; /**< text renderer module */
vlc_bool_t b_force_crop; /**< force cropping of subpicture */
int i_crop_x, i_crop_y, i_crop_width, i_crop_height; /**< cropping */
vlc_bool_t b_force_alpha; /**< force alpha palette of subpicture */
uint8_t pi_alpha[4]; /**< forced alpha palette */
/* Subpicture unit */
spu_t *p_spu;
/* Statistics */
count_t c_loops;
......@@ -260,27 +246,6 @@ enum output_query_e
VOUT_CLOSE
};
/**
* \addtogroup subpicture
* @{
*/
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 ) );
#define spu_CreateRegion(a,b) __spu_CreateRegion(VLC_OBJECT(a),b)
VLC_EXPORT( subpicture_region_t *,__spu_CreateRegion, ( vlc_object_t *, video_format_t * ) );
#define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
void vout_InitSPU( vout_thread_t * );
void vout_DestroySPU( vout_thread_t * );
void vout_AttachSPU( vout_thread_t *, vlc_object_t *, vlc_bool_t );
subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t );
void vout_RenderSubPictures( vout_thread_t *, picture_t *,
picture_t *, subpicture_t * );
/** @}*/
/**
* @}
*/
......@@ -2,7 +2,7 @@
* vout.h: video output header for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vout.h,v 1.3 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -36,6 +36,7 @@ extern "C" {
*****************************************************************************/
#include "vlc_video.h"
#include "video_output.h"
#include "vlc_spu.h"
# ifdef __cplusplus
}
......
......@@ -279,16 +279,18 @@ typedef struct aout_filter_t aout_filter_t;
/* Video */
typedef struct vout_thread_t vout_thread_t;
typedef struct vout_sys_t vout_sys_t;
typedef struct vout_synchro_t vout_synchro_t;
typedef struct chroma_sys_t chroma_sys_t;
typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t;
typedef struct picture_sys_t picture_sys_t;
typedef struct picture_heap_t picture_heap_t;
typedef struct spu_t spu_t;
typedef struct subpicture_t subpicture_t;
typedef struct subpicture_sys_t subpicture_sys_t;
typedef struct subpicture_region_t subpicture_region_t;
typedef struct vout_synchro_t vout_synchro_t;
typedef struct text_renderer_sys_t text_renderer_sys_t;
typedef struct text_style_t text_style_t;
/* Stream output */
......
......@@ -43,7 +43,7 @@ struct filter_t
/* Module properties */
module_t * p_module;
filter_sys_t * p_sys;
filter_sys_t * p_sys;
/* Input format */
es_format_t fmt_in;
......@@ -57,6 +57,8 @@ struct filter_t
picture_t *, picture_t *,
int, int );
subpicture_t * ( *pf_subpicture_filter ) ( filter_t * );
subpicture_t * ( *pf_render_string ) ( filter_t *, block_t * );
/*
......
......@@ -54,6 +54,8 @@
#define VLC_OBJECT_STREAM (-20)
#define VLC_OBJECT_OPENGL (-21)
#define VLC_OBJECT_FILTER (-22)
#define VLC_OBJECT_VOD (-23)
#define VLC_OBJECT_SPU (-24)
#define VLC_OBJECT_GENERIC (-666)
......
/*****************************************************************************
* vlc_spu.h : subpicture unit
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* \defgroup spu Subpicture Unit
* This module describes the programming interface for the subpicture unit.
* It includes functions allowing to create/destroy an spu, create/destroy
* subpictures and render them.
* @{
*/
/**
* Subpicture unit descriptor
*/
struct spu_t
{
VLC_COMMON_MEMBERS
vlc_mutex_t subpicture_lock; /**< subpicture heap lock */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /**< subpictures */
int i_channel; /**< number of subpicture channels registered */
filter_t *p_blend; /**< alpha blending module */
filter_t *p_text; /**< text renderer module */
filter_t *p_scale; /**< scaling module */
vlc_bool_t b_force_crop; /**< force cropping of subpicture */
int i_crop_x, i_crop_y, i_crop_width, i_crop_height; /**< cropping */
int i_margin; /**< force position of a subpicture */
vlc_bool_t b_force_alpha; /**< force alpha palette of subpicture */
uint8_t pi_alpha[4]; /**< forced alpha palette */
int ( *pf_control ) ( spu_t *, int, va_list );
};
static inline int spu_vaControl( spu_t *p_spu, int i_query, va_list args )
{
if( p_spu->pf_control )
return p_spu->pf_control( p_spu, i_query, args );
else
return VLC_EGENERIC;
}
static inline int spu_Control( spu_t *p_spu, int i_query, ... )
{
va_list args;
int i_result;
va_start( args, i_query );
i_result = spu_vaControl( p_spu, i_query, args );
va_end( args );
return i_result;
}
enum spu_query_e
{
SPU_CHANNEL_REGISTER, /* arg1= int * res= */
SPU_CHANNEL_CLEAR /* arg1= int res= */
};
/**
* \addtogroup subpicture
* @{
*/
#define spu_Init(a) __spu_Init(VLC_OBJECT(a))
VLC_EXPORT( spu_t *, __spu_Init, ( vlc_object_t * ) );
VLC_EXPORT( void, spu_Destroy, ( spu_t * ) );
void spu_Attach( spu_t *, vlc_object_t *, vlc_bool_t );
VLC_EXPORT( subpicture_t *, spu_CreateSubpicture, ( spu_t * ) );
VLC_EXPORT( void, spu_DestroySubpicture, ( spu_t *, subpicture_t * ) );
VLC_EXPORT( void, spu_DisplaySubpicture, ( spu_t *, subpicture_t * ) );
#define spu_CreateRegion(a,b) __spu_CreateRegion(VLC_OBJECT(a),b)
VLC_EXPORT( subpicture_region_t *,__spu_CreateRegion, ( vlc_object_t *, video_format_t * ) );
#define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t ) );
VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, video_format_t *, picture_t *, picture_t *, subpicture_t *, int, int ) );
/** @}*/
/**
* @}
*/
......@@ -210,8 +210,8 @@ struct subpicture_region_t
int i_y; /**< position of region */
subpicture_region_t *p_next; /**< next region in the list */
subpicture_region_t *p_cache; /**< modified version of this region */
/**@}*/
};
/**
......
......@@ -151,24 +151,11 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
/* Erase the anchor text description from the video output if it exists */
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout != NULL && p_vout->p_subpicture != NULL )
if( p_vout )
{
subpicture_t *p_subpic;
int i_subpic;
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
p_subpic = &p_vout->p_subpicture[i_subpic];
if( p_subpic != NULL &&
( p_subpic->i_status == RESERVED_SUBPICTURE
|| p_subpic->i_status == READY_SUBPICTURE ) )
{
vout_DestroySubPicture( p_vout, p_subpic );
}
}
spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
vlc_object_release( p_vout );
}
if( p_vout ) vlc_object_release( p_vout );
var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
......
......@@ -49,26 +49,11 @@ void VCDSubClose( vlc_object_t *p_this )
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
if( !p_sys->b_packetizer )
if( !p_sys->b_packetizer && p_sys->p_vout )
{
/* FIXME check if it's ok to not lock vout */
if( p_sys->p_vout != NULL && p_sys->p_vout->p_subpicture != NULL )
{
subpicture_t * p_subpic;
int i_subpic;
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
p_subpic = &p_sys->p_vout->p_subpicture[i_subpic];
if( p_subpic != NULL &&
( ( p_subpic->i_status == RESERVED_SUBPICTURE ) ||
( p_subpic->i_status == READY_SUBPICTURE ) ) )
{
vout_DestroySubPicture( p_sys->p_vout, p_subpic );
}
}
}
spu_Control( p_sys->p_vout->p_spu, SPU_CHANNEL_CLEAR,
p_sys->i_subpic_channel );
}
if( p_sys->p_block )
......
......@@ -158,8 +158,8 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
{
if( p_last_vout != p_sys->p_vout )
{
p_sys->i_subpic_channel =
vout_RegisterOSDChannel( p_sys->p_vout );
spu_Control( p_sys->p_vout->p_spu, SPU_CHANNEL_REGISTER,
&p_sys->i_subpic_channel );
}
/* Parse and decode */
......
......@@ -292,12 +292,10 @@ 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, p_sys->i_subpic_channel,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
return;
}
p_spu = spu_CreateSubpicture( p_sys->p_vout->p_spu );
if( p_spu == NULL ) return;
p_spu->i_channel = p_sys->i_subpic_channel;
/* In ParseImage we expand the run-length encoded color 0's; also
we expand pixels and remove the color palette. This should
......@@ -349,12 +347,12 @@ E_(ParsePacket)( decoder_t *p_dec)
if( ParseImage( p_dec, p_spu ) )
{
/* There was a parse error, delete the subpicture */
vout_DestroySubPicture( p_sys->p_vout, p_spu );
spu_DestroySubpicture( p_sys->p_vout->p_spu, p_spu );
return;
}
/* SPU is finished - we can ask the video output to display it */
vout_DisplaySubPicture( p_sys->p_vout, p_spu );
spu_DisplaySubpicture( p_sys->p_vout->p_spu, p_spu );
}
......
......@@ -156,8 +156,8 @@ Decode ( decoder_t *p_dec, block_t **pp_block )
{
if( p_last_vout != p_sys->p_vout )
{
p_sys->i_subpic_channel =
vout_RegisterOSDChannel( p_sys->p_vout );
spu_Control( p_sys->p_vout->p_spu, SPU_CHANNEL_REGISTER,
&p_sys->i_subpic_channel );
}
/* Parse and decode */
......
......@@ -165,12 +165,10 @@ 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, p_sys->i_subpic_channel,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
return;
}
p_spu = spu_CreateSubpicture( p_sys->p_vout->p_spu );
if( p_spu == NULL ) return;
p_spu->i_channel = p_sys->i_subpic_channel;
/* In ParseImage we expand the run-length encoded color 0's; also
we expand pixels and remove the color palette. This should
......@@ -221,12 +219,12 @@ E_(ParsePacket)( decoder_t *p_dec)
if( ParseImage( p_dec, p_spu ) )
{
/* There was a parse error, delete the subpicture */
vout_DestroySubPicture( p_sys->p_vout, p_spu );
spu_DestroySubpicture( p_sys->p_vout->p_spu, p_spu );
return;
}
/* SPU is finished - we can ask the video output to display it */
vout_DisplaySubPicture( p_sys->p_vout, p_spu );
spu_DisplaySubpicture( p_sys->p_vout->p_spu, p_spu );
}
......
......@@ -228,8 +228,8 @@ static void Run( intf_thread_t *p_intf )
{
for( i = 0; i < CHANNELS_NUMBER; i++ )
{
p_intf->p_sys->p_channels[ i ] =
vout_RegisterOSDChannel( p_vout );
spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER,
&p_intf->p_sys->p_channels[ i ] );
}
}
......@@ -734,10 +734,11 @@ static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
if( p_vout )
{
vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
for( i = 0; i < CHANNELS_NUMBER; i++ )
{
vout_ClearOSDChannel( p_vout, p_intf->p_sys->p_channels[ i ] );
spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR,
p_intf->p_sys->p_channels[ i ] );
}
}
}
This diff is collapsed.
......@@ -193,6 +193,9 @@ void input_DecoderDelete( decoder_t *p_dec )
}
else
{
/* Flush */
input_DecoderDecode( p_dec, NULL );
module_Unneed( p_dec, p_dec->p_module );
}
......@@ -667,7 +670,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
vout_DisplaySubPicture( p_vout, p_spu );
spu_DisplaySubpicture( p_vout->p_spu, p_spu );
vlc_object_release( p_vout );
}
}
......@@ -734,7 +737,8 @@ static void DeleteDecoder( decoder_t * p_dec )
p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
vout_ClearOSDChannel( p_vout, p_dec->p_owner->i_spu_channel );
spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR,
p_dec->p_owner->i_spu_channel );
vlc_object_release( p_vout );
}
}
......@@ -916,7 +920,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec )
{
decoder_owner_sys_t *p_sys = (decoder_owner_sys_t *)p_dec->p_owner;
vout_thread_t *p_vout = NULL;
subpicture_t *p_spu;
subpicture_t *p_subpic;
int i_attempts = 30;
while( i_attempts-- )
......@@ -937,20 +941,20 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec )
if( p_sys->p_spu_vout != p_vout )
{
p_sys->i_spu_channel =
vout_RegisterOSDChannel( p_vout );
spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER,
&p_sys->i_spu_channel );
p_sys->p_spu_vout = p_vout;
}
p_spu = vout_CreateSubPicture( p_vout, p_sys->i_spu_channel,
MEMORY_SUBPICTURE );
p_subpic = spu_CreateSubpicture( p_vout->p_spu );
p_subpic->i_channel = p_sys->i_spu_channel;
vlc_object_release( p_vout );
return p_spu;
return p_subpic;
}
static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_spu )
static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_subpic )
{
vout_DestroySubPicture( p_dec->p_owner->p_vout, p_spu );
spu_DestroySubpicture( p_dec->p_owner->p_vout->p_spu, p_subpic );
}
......@@ -91,6 +91,7 @@
#include "vlc_video.h"
#include "video_output.h"
#include "vout_synchro.h"
#include "vlc_spu.h"
#include "audio_output.h"
#include "aout_internal.h"
......
......@@ -39,6 +39,7 @@
#include "vlc_video.h"
#include "video_output.h"
#include "vlc_spu.h"
#include "audio_output.h"
#include "aout_internal.h"
......@@ -51,6 +52,8 @@
#include "vlc_httpd.h"
#include "vlc_vlm.h"
#include "vlc_vod.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -158,6 +161,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size = sizeof(vout_thread_t);
psz_type = "video output";
break;
case VLC_OBJECT_SPU:
i_size = sizeof(spu_t);
psz_type = "subpicture unit";
break;
case VLC_OBJECT_AOUT:
i_size = sizeof(aout_instance_t);
psz_type = "audio output";
......@@ -174,6 +181,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size = sizeof( vlm_t );
psz_type = "vlm dameon";
break;
case VLC_OBJECT_VOD:
i_size = sizeof( vod_t );
psz_type = "vod server";
break;
case VLC_OBJECT_OPENGL:
i_size = sizeof( vout_thread_t );
psz_type = "opengl provider";
......
......@@ -37,6 +37,7 @@
#include "vlc_video.h"
#include "video_output.h"
#include "vlc_spu.h"
#include <vlc/input.h> /* for input_thread_t and i_pts_delay */
#if defined( SYS_DARWIN )
......@@ -85,7 +86,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
if( p_playlist )
{
vout_AttachSPU( p_vout, p_this, VLC_FALSE );
spu_Attach( p_vout->p_spu, p_this, VLC_FALSE );
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_playlist );
......@@ -180,7 +181,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );
vout_AttachSPU( p_vout, p_this, VLC_TRUE );
spu_Attach( p_vout->p_spu, p_this, VLC_TRUE );
vlc_object_attach( p_vout, p_this );
vlc_object_release( p_vout );
}
......@@ -234,10 +235,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
/* 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;
......@@ -280,7 +277,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
/* Initialize locks */
vlc_mutex_init( p_vout, &p_vout->picture_lock );
vlc_mutex_init( p_vout, &p_vout->subpicture_lock );
vlc_mutex_init( p_vout, &p_vout->change_lock );
/* Mouse coordinates */
......@@ -291,8 +287,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER );
/* Initialize subpicture unit */
vout_InitSPU( p_vout );
vout_AttachSPU( p_vout, p_parent, VLC_TRUE );
p_vout->p_spu = spu_Init( p_vout );
spu_Attach( p_vout->p_spu, p_parent, VLC_TRUE );
/* Attach the new object now so we can use var inheritance below */
vlc_object_attach( p_vout, p_parent );
......@@ -886,7 +882,7 @@ static void RunThread( vout_thread_t *p_vout)
/*
* Check for subpictures to display
*/
p_subpic = vout_SortSubPictures( p_vout, display_date );
p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date );
/*
* Perform rendering
......@@ -1100,7 +1096,8 @@ static void EndThread( vout_thread_t *p_vout )
}
/* Destroy subpicture unit */
vout_DestroySPU( p_vout );
spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), VLC_FALSE );
spu_Destroy( p_vout->p_spu );
/* Destroy translation tables */
p_vout->pf_end( p_vout );
......@@ -1119,7 +1116,6 @@ static void DestroyThread( vout_thread_t *p_vout )
{
/* Destroy the locks */
vlc_mutex_destroy( &p_vout->picture_lock );
vlc_mutex_destroy( &p_vout->subpicture_lock );
vlc_mutex_destroy( &p_vout->change_lock );
/* Release the module */
......
......@@ -72,7 +72,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
if( !psz_string ) return VLC_EGENERIC;
p_spu = vout_CreateSubPicture( p_vout, !DEFAULT_CHAN, MEMORY_SUBPICTURE );
p_spu = spu_CreateSubpicture( p_vout->p_spu );
if( !p_spu ) return VLC_EGENERIC;
/* Create a new subpicture region */
......@@ -85,7 +85,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
if( !p_spu->p_region )
{
msg_Err( p_vout, "cannot allocate SPU region" );
vout_DestroySubPicture( p_vout, p_spu );
spu_DestroySubpicture( p_vout->p_spu, p_spu );
return VLC_EGENERIC;
}
......@@ -100,7 +100,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
p_spu->i_flags = i_flags;
p_spu->i_channel = i_channel;
vout_DisplaySubPicture( p_vout, p_spu );
spu_DisplaySubpicture( p_vout->p_spu, p_spu );
return VLC_SUCCESS;
}
......
......@@ -382,11 +382,12 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
p_widget = 0;
/* Create and initialize a subpicture */
p_subpic = vout_CreateSubPicture( p_vout, i_channel, MEMORY_SUBPICTURE );
p_subpic = spu_CreateSubpicture( p_vout->p_spu );
if( p_subpic == NULL )
{
return NULL;
}
p_subpic->i_channel = i_channel;
p_subpic->pf_render = Render;
p_subpic->pf_destroy = FreeWidget;
p_subpic->i_start = i_now;
......@@ -397,7 +398,7 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
if( p_widget == NULL )
{
FreeWidget( p_subpic );
vout_DestroySubPicture( p_vout, p_subpic );
spu_DestroySubpicture( p_vout->p_spu, p_subpic );
return NULL;
}
p_subpic->p_sys = p_widget;
......@@ -454,7 +455,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
if( p_widget->p_pic == NULL )
{
FreeWidget( p_subpic );
vout_DestroySubPicture( p_vout, p_subpic );
spu_DestroySubpicture( p_vout->p_spu, p_subpic );
return;
}
memset( p_widget->p_pic, 0, p_widget->i_width * p_widget->i_height );
......@@ -462,7 +463,6 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
if( i_type == OSD_HOR_SLIDER )
{
int i_x_pos = ( p_widget->i_width - 2 ) * i_position / 100;
int i_y_pos = p_widget->i_height / 2;
DrawRect( p_vout, p_subpic, i_x_pos - 1, 2, i_x_pos + 1,
p_widget->i_height - 3, STYLE_FILLED );
DrawRect( p_vout, p_subpic, 0, 0, p_widget->i_width - 1,
......@@ -482,7 +482,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
p_widget->i_height - 1, STYLE_EMPTY );
}
vout_DisplaySubPicture( p_vout, p_subpic );
spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
vlc_object_release( p_vout );
return;
......@@ -525,7 +525,7 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
if( p_widget->p_pic == NULL )
{
FreeWidget( p_subpic );
vout_DestroySubPicture( p_vout, p_subpic );
spu_DestroySubpicture( p_vout->p_spu, p_subpic );
return;
}
memset( p_widget->p_pic, 0, p_widget->i_width * p_widget->i_height );
......@@ -567,7 +567,7 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
}
}
vout_DisplaySubPicture( p_vout, p_subpic );
spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
vlc_object_release( p_vout );
return;
......
......@@ -33,6 +33,7 @@
#include "vlc_video.h"
#include "video_output.h"
#include "vlc_spu.h"
#include "vout_pictures.h"
......@@ -285,6 +286,9 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
subpicture_t *p_subpic )
{
video_format_t fmt;
int i_scale_width, i_scale_height;
if( p_pic == NULL )
{
/* XXX: subtitles */
......@@ -292,6 +296,13 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL;
}
fmt.i_aspect = p_vout->output.i_aspect;
fmt.i_chroma = p_vout->output.i_chroma;
fmt.i_width = p_vout->output.i_width;
fmt.i_height = p_vout->output.i_height;
i_scale_width = p_vout->output.i_width * 1000 / p_vout->render.i_width;
i_scale_height = p_vout->output.i_height * 1000 / p_vout->render.i_height;
if( p_pic->i_type == DIRECT_PICTURE )
{
if( !p_vout->render.b_allow_modify_pics || p_pic->i_refcount ||
......@@ -307,8 +318,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
* subtitles. */
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0],
p_pic , p_subpic );
spu_RenderSubpictures( p_vout->p_spu, &fmt,
PP_OUTPUTPICTURE[0], p_pic, p_subpic,
i_scale_width, i_scale_height );
return PP_OUTPUTPICTURE[0];
}
......@@ -322,7 +334,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
/* Picture is in a direct buffer but isn't used by the
* decoder. We can safely render subtitles on it and
* display it. */
vout_RenderSubPictures( p_vout, p_pic, p_pic, p_subpic );
spu_RenderSubpictures( p_vout->p_spu, &fmt, p_pic, p_pic, p_subpic,
i_scale_width, i_scale_height );
return p_pic;
}
......@@ -340,7 +353,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL;
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_pic, p_subpic );
spu_RenderSubpictures( p_vout->p_spu, &fmt, PP_OUTPUTPICTURE[0],
p_pic, p_subpic, i_scale_width, i_scale_height);
if( PP_OUTPUTPICTURE[0]->pf_unlock )
PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
......@@ -374,7 +388,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic );
/* Render subpictures on the first direct buffer */
vout_RenderSubPictures( p_vout, p_tmp_pic, p_tmp_pic, p_subpic );
spu_RenderSubpictures( p_vout->p_spu, &fmt, p_tmp_pic,
p_tmp_pic, p_subpic,
i_scale_width, i_scale_height );
if( p_vout->p_picture[0].pf_lock )
if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
......@@ -392,8 +408,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
/* Render subpictures on the first direct buffer */
vout_RenderSubPictures( p_vout, &p_vout->p_picture[0],
&p_vout->p_picture[0], p_subpic );
spu_RenderSubpictures( p_vout->p_spu, &fmt, &p_vout->p_picture[0],
&p_vout->p_picture[0], p_subpic,
i_scale_width, i_scale_height );
}
if( p_vout->p_picture[0].pf_unlock )
......@@ -929,4 +946,8 @@ void __vout_CopyPicture( vlc_object_t *p_this,
}
p_dest->date = p_src->date;
p_dest->b_force = p_src->b_force;
p_dest->i_nb_fields = p_src->i_nb_fields;
p_dest->b_progressive = p_src->b_progressive;
p_dest->b_top_field_first = p_src->b_top_field_first;
}
This diff is collapsed.
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