Commit 8b09b55d authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/access/dvdplay/access.c: activated button highlighting.

  * ./modules/codec/spudec/parse.c: implemented subtitle cropping and
    temporarily disabled subtitle cropping.
  * ./modules/codec/spudec/render.c: split RenderSPU into chroma-specific
    functions.
parent 2401b662
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.56 2002/07/23 00:39:16 sam Exp $
* $Id: video.h,v 1.57 2002/11/06 18:07:57 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -166,7 +166,6 @@ struct subpicture_t
/* Type and flags - should NOT be modified except by the vout thread */
int i_type; /* type */
int i_status; /* flags */
int i_size; /* data size */
subpicture_t * p_next; /* next subtitle to be displayed */
/* Date properties */
......@@ -199,13 +198,13 @@ struct subpicture_t
} type;
#endif
/* The subpicture rendering routine */
/* The subpicture rendering and destruction routines */
void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * );
void ( *pf_destroy ) ( subpicture_t * );
/* Private data - the subtitle plugin might want to put stuff here to
* keep track of the subpicture */
subpicture_sys_t *p_sys; /* subpicture data */
void *p_sys_orig; /* pointer before memalign */
};
/* Subpicture type */
......@@ -216,5 +215,4 @@ struct subpicture_t
#define FREE_SUBPICTURE 0 /* free and not allocated */
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */
#define DESTROYED_SUBPICTURE 3 /* allocated but not used anymore */
......@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.84 2002/10/17 16:03:18 sam Exp $
* $Id: video_output.h,v 1.85 2002/11/06 18:07:57 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -158,7 +158,7 @@ VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, int, int, i
picture_t * vout_RenderPicture ( vout_thread_t *, picture_t *,
subpicture_t * );
VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int, int ) );
VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int ) );
VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) );
VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) );
......
......@@ -2,7 +2,7 @@
* access.c: access capabilities for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: access.c,v 1.4 2002/10/26 15:24:19 gbazin Exp $
* $Id: access.c,v 1.5 2002/11/06 18:07:57 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -87,7 +87,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
p_dvd = malloc( sizeof(dvd_data_t) );
if( p_dvd == NULL )
{
msg_Err( p_input, "dvdplay error: out of memory" );
msg_Err( p_input, "out of memory" );
return -1;
}
......@@ -114,7 +114,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
if( p_dvd->vmg == NULL )
{
msg_Err( p_input, "dvdplay error: can't open source" );
msg_Err( p_input, "cannot open %s", psz_source );
free( p_dvd );
return -1;
}
......@@ -184,6 +184,18 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
p_input->psz_demux = "dvdplay";
/* FIXME: we might lose variables here */
var_Create( p_input, "x-start", VLC_VAR_INTEGER );
var_Create( p_input, "y-start", VLC_VAR_INTEGER );
var_Create( p_input, "x-end", VLC_VAR_INTEGER );
var_Create( p_input, "y-end", VLC_VAR_INTEGER );
var_Create( p_input, "color", VLC_VAR_ADDRESS );
var_Create( p_input, "contrast", VLC_VAR_ADDRESS );
var_Create( p_input, "highlight", VLC_VAR_BOOL );
var_Create( p_input, "highlight-mutex", VLC_VAR_MUTEX );
return 0;
}
......@@ -195,6 +207,17 @@ void E_(CloseDVD) ( vlc_object_t *p_this )
input_thread_t * p_input = (input_thread_t *)p_this;
dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data;
var_Destroy( p_input, "highlight-mutex" );
var_Destroy( p_input, "highlight" );
var_Destroy( p_input, "x-start" );
var_Destroy( p_input, "x-end" );
var_Destroy( p_input, "y-start" );
var_Destroy( p_input, "y-end" );
var_Destroy( p_input, "color" );
var_Destroy( p_input, "contrast" );
/* close libdvdplay */
dvdplay_close( p_dvd->vmg );
......@@ -350,6 +373,7 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
{
input_thread_t * p_input;
dvd_data_t * p_dvd;
vlc_value_t val;
int i;
p_input = (input_thread_t*)p_args;
......@@ -407,11 +431,38 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
case COMPLETE_VIDEO:
break;
case NEW_HIGHLIGHT:
if( var_Get( p_input, "highlight-mutex", &val ) == VLC_SUCCESS )
{
vlc_mutex_t *p_mutex = val.p_address;
vlc_mutex_lock( p_mutex );
/* Retrieve the highlight from dvdplay */
dvdplay_highlight( p_dvd->vmg, &p_dvd->hli );
/* Fill our internal variables with this data */
val.i_int = p_dvd->hli.i_x_start;
var_Set( p_input, "x-start", val );
val.i_int = p_dvd->hli.i_y_start;
var_Set( p_input, "y-start", val );
val.i_int = p_dvd->hli.i_x_end;
var_Set( p_input, "x-end", val );
val.i_int = p_dvd->hli.i_y_end;
var_Set( p_input, "y-end", val );
val.p_address = (void *)p_dvd->hli.pi_color;
var_Set( p_input, "color", val );
val.p_address = (void *)p_dvd->hli.pi_contrast;
var_Set( p_input, "contrast", val );
/* Tell the SPU decoder that there's a new highlight */
val.b_bool = VLC_TRUE;
var_Set( p_input, "highlight", val );
vlc_mutex_unlock( p_mutex );
}
break;
default:
msg_Err( p_input, "unknown event from libdvdplay (%d)",
event );
msg_Err( p_input, "unknown event from libdvdplay (%d)", event );
}
return;
......@@ -494,3 +545,4 @@ static int dvdNewPGC( input_thread_t * p_input )
return 0;
}
......@@ -2,7 +2,7 @@
* dvd.h: structure of the dvdplay plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: dvd.h,v 1.2 2002/11/06 18:07:57 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -56,6 +56,7 @@ typedef struct
dvdplay_event_t event;
dvdplay_ctrl_t control;
dvdplay_highlight_t hli;
} dvd_data_t;
......@@ -2,7 +2,7 @@
* intf.c: interface for DVD video manager
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.2 2002/10/17 16:03:18 sam Exp $
* $Id: intf.c,v 1.3 2002/11/06 18:07:57 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
*
......@@ -33,6 +33,7 @@
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "dvd.h"
......@@ -190,10 +191,6 @@ static void RunIntf( intf_thread_t *p_intf )
p_intf->p_sys->b_move = VLC_FALSE;
}
msg_Dbg( p_intf, "send button coordinates: %dx%d",
p_intf->p_sys->control.mouse.i_x,
p_intf->p_sys->control.mouse.i_y );
/* we can safely interact with libdvdplay
* with the stream lock */
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
......@@ -343,7 +340,6 @@ int dvdIntfStillTime( intf_thread_t *p_intf, int i_sec )
#endif
vlc_mutex_unlock( &p_intf->change_lock );
return 0;
return VLC_SUCCESS;
}
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* spudec.c : SPU decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spudec.c,v 1.6 2002/10/31 09:40:26 gbazin Exp $
* $Id: spudec.c,v 1.7 2002/11/06 18:07:57 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -68,14 +68,15 @@ static int OpenDecoder( vlc_object_t *p_this )
{
decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this;
if( p_fifo->i_fourcc == VLC_FOURCC('s','p','u',' ')
|| p_fifo->i_fourcc == VLC_FOURCC('s','p','u','b') )
if( p_fifo->i_fourcc != VLC_FOURCC('s','p','u',' ')
&& p_fifo->i_fourcc != VLC_FOURCC('s','p','u','b') )
{
p_fifo->pf_run = RunDecoder;
return VLC_SUCCESS;
return VLC_EGENERIC;
}
return VLC_EGENERIC;
p_fifo->pf_run = RunDecoder;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -112,10 +113,12 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
*/
while( (!p_spudec->p_fifo->b_die) && (!p_spudec->p_fifo->b_error) )
{
if( !E_(SyncPacket)( p_spudec ) )
if( E_(SyncPacket)( p_spudec ) )
{
E_(ParsePacket)( p_spudec );
continue;
}
E_(ParsePacket)( p_spudec );
}
/*
......
......@@ -2,7 +2,7 @@
* spudec.h : sub picture unit decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: spudec.h,v 1.2 2002/08/16 03:07:56 sam Exp $
* $Id: spudec.h,v 1.3 2002/11/06 18:07:57 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
typedef struct spudec_thread_t spudec_thread_t;
struct subpicture_sys_t
{
mtime_t i_pts; /* presentation timestamp */
......@@ -30,14 +32,22 @@ struct subpicture_sys_t
/* Color information */
vlc_bool_t b_palette;
u8 pi_alpha[4];
u8 pi_yuv[4][3];
uint8_t pi_alpha[4];
uint8_t pi_yuv[4][3];
/* Link to our input */
vlc_object_t * p_input;
/* Cropping properties */
vlc_mutex_t lock;
vlc_bool_t b_crop;
int i_x_start, i_y_start, i_x_end, i_y_end;
};
/*****************************************************************************
* spudec_thread_t : sub picture unit decoder thread descriptor
*****************************************************************************/
typedef struct spudec_thread_t
struct spudec_thread_t
{
/*
* Thread properties and locks
......@@ -61,8 +71,7 @@ typedef struct spudec_thread_t
*/
int i_spu_size; /* size of current SPU packet */
int i_rle_size; /* size of the RLE part */
} spudec_thread_t;
};
/*****************************************************************************
* Amount of bytes we GetChunk() in one go
......
......@@ -2,7 +2,7 @@
* vout_subpictures.c : subpicture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: vout_subpictures.c,v 1.15 2002/10/17 08:24:12 sam Exp $
* $Id: vout_subpictures.c,v 1.16 2002/11/06 18:07:56 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -77,12 +77,10 @@ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
* already allocated zone of memory in the spu data fields. It needs locking
* since several pictures can be created by several producers threads.
*****************************************************************************/
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
int i_size )
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
{
int i_subpic; /* subpicture index */
subpicture_t * p_free_subpic = NULL; /* first free subpicture */
subpicture_t * p_destroyed_subpic = NULL; /* first destroyed subpic */
subpicture_t * p_subpic = NULL; /* first free subpicture */
/* Get lock */
vlc_mutex_lock( &p_vout->subpicture_lock );
......@@ -92,78 +90,39 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
*/
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
if( p_vout->p_subpicture[i_subpic].i_status == DESTROYED_SUBPICTURE )
{
/* Subpicture is marked for destruction, but is still allocated */
if( (p_vout->p_subpicture[i_subpic].i_type == i_type) &&
(p_vout->p_subpicture[i_subpic].i_size >= i_size) )
{
/* Memory size do match or is smaller : memory will not be
* reallocated, and function can end immediately - this is
* the best possible case, since no memory allocation needs
* to be done */
p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
vlc_mutex_unlock( &p_vout->subpicture_lock );
return &p_vout->p_subpicture[i_subpic];
}
else if( p_destroyed_subpic == NULL )
{
/* Memory size do not match, but subpicture index will be kept
* in case we find no other place */
p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
}
}
else if( (p_free_subpic == NULL) &&
(p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE ))
if( p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE )
{
/* Subpicture is empty and ready for allocation */
p_free_subpic = &p_vout->p_subpicture[i_subpic];
}
p_subpic = &p_vout->p_subpicture[i_subpic];
p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
break;
}
/* If no free subpictures are available, use a destroyed subpicture */
if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
{
/* No free subpicture or matching destroyed subpictures have been
* found, but a destroyed subpicture is still available */
free( p_destroyed_subpic->p_sys_orig );
p_free_subpic = p_destroyed_subpic;
}
/* If no free or destroyed subpicture could be found */
if( p_free_subpic == NULL )
/* If no free subpicture could be found */
if( p_subpic == NULL )
{
msg_Err( p_vout, "subpicture heap is full" );
vlc_mutex_unlock( &p_vout->subpicture_lock );
return NULL;
}
p_free_subpic->p_sys =
vlc_memalign( &p_free_subpic->p_sys_orig, 16, i_size );
if( p_free_subpic->p_sys != NULL )
{
/* Copy subpicture information, set some default values */
p_free_subpic->i_type = i_type;
p_free_subpic->i_status = RESERVED_SUBPICTURE;
p_free_subpic->i_size = i_size;
p_free_subpic->i_x = 0;
p_free_subpic->i_y = 0;
p_free_subpic->i_width = 0;
p_free_subpic->i_height = 0;
}
else
{
/* Memory allocation failed : set subpicture as empty */
msg_Err( p_vout, "out of memory" );
p_free_subpic->i_type = EMPTY_SUBPICTURE;
p_free_subpic->i_status = FREE_SUBPICTURE;
p_free_subpic = NULL;
}
p_subpic->i_type = i_type;
p_subpic->i_status = RESERVED_SUBPICTURE;
p_subpic->i_start = 0;
p_subpic->i_stop = 0;
p_subpic->b_ephemer = VLC_FALSE;
p_subpic->i_x = 0;
p_subpic->i_y = 0;
p_subpic->i_width = 0;
p_subpic->i_height = 0;
vlc_mutex_unlock( &p_vout->subpicture_lock );
return p_free_subpic;
return p_subpic;
}
/*****************************************************************************
......@@ -184,7 +143,12 @@ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
p_subpic, p_subpic->i_status );
}
p_subpic->i_status = DESTROYED_SUBPICTURE;
if( p_subpic->pf_destroy )
{
p_subpic->pf_destroy( p_subpic );
}
p_subpic->i_status = FREE_SUBPICTURE;
}
/*****************************************************************************
......
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