From 04f281497ebbb6bfadf75b4faf4332b53c3c21eb Mon Sep 17 00:00:00 2001 From: Mike Lampard Date: Tue, 23 Oct 2001 12:08:39 +0000 Subject: update spu decoder to auto-display menus, and display only the user selected stream. Change request_dest_size in video_out to comply with Guenters api changes. CVS patchset: 866 CVS date: 2001/10/23 12:08:39 --- src/dxr3/dxr3_decoder.c | 47 +++++++++++++++++++++++++++++++++++++++-------- src/dxr3/video_out_dxr3.c | 8 ++++---- 2 files changed, 43 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/dxr3/dxr3_decoder.c b/src/dxr3/dxr3_decoder.c index 5ff9c1b32..d1e4c8cbc 100644 --- a/src/dxr3/dxr3_decoder.c +++ b/src/dxr3/dxr3_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_decoder.c,v 1.17 2001/10/20 12:08:31 guenter Exp $ + * $Id: dxr3_decoder.c,v 1.18 2001/10/23 12:08:39 mlampard Exp $ * * dxr3 video and spu decoder plugin. Accepts the video and spu data * from XINE and sends it directly to the corresponding dxr3 devices. @@ -336,25 +336,35 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, /* * Second part of the dxr3 plugin: subpicture decoder */ +#define MAX_SPU_STREAMS 32 +typedef struct spudec_stream_state_s { + uint32_t stream_filter; +} spudec_stream_state_t; + typedef struct spudec_decoder_s { - spu_decoder_t spu_decoder; + spu_decoder_t spu_decoder; + spudec_stream_state_t spu_stream_state[MAX_SPU_STREAMS]; - vo_instance_t *vo_out; - int fd_spu; + vo_instance_t *vo_out; + int fd_spu; + int streams; /* number of streams available */ + xine_t *xine; } spudec_decoder_t; static int spudec_can_handle (spu_decoder_t *this_gen, int buf_type) { int type = buf_type & 0xFFFF0000; - return (type == BUF_SPU_PACKAGE || type == BUF_SPU_CLUT); + return (type == BUF_SPU_PACKAGE || type == BUF_SPU_CLUT || + type == BUF_SPU_SUBP_CONTROL); } static void spudec_init (spu_decoder_t *this_gen, vo_instance_t *vo_out) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; char tmpstr[100]; - + int i; + this->vo_out = vo_out; /* open spu device */ @@ -365,6 +375,8 @@ static void spudec_init (spu_decoder_t *this_gen, vo_instance_t *vo_out) return; } + for (i=0; i < MAX_SPU_STREAMS; i++) /* reset the spu filter for non-dvdnav */ + this->spu_stream_state[i].stream_filter = 1; } static void swab_clut(int* clut) @@ -378,7 +390,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; ssize_t written; - + uint32_t stream_id = buf->type & 0x1f ; + if (buf->type == BUF_SPU_CLUT) { if (buf->content[0] == 0) /* cheap endianess detection */ swab_clut((int*)buf->content); @@ -387,9 +400,24 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) return; } + if(buf->type == BUF_SPU_SUBP_CONTROL){ + int i; + uint32_t *subp_control = (uint32_t*) buf->content; + this->streams=0; + for (i = 0; i < 32; i++) { + this->spu_stream_state[i].stream_filter = subp_control[i]; + /* Temporary hack to find out if we _may_ be in a menu */ + /* menu's only have one stream, so do some dvd's :( */ + this->streams+=subp_control[i]; + } + return; + } + /* Is this also needed for subpicture? */ if (buf->decoder_info[0] == 0) return; + if ( this->spu_stream_state[stream_id].stream_filter == 0) return; + if (buf->PTS) { int vpts; vpts = this->spu_decoder.metronom->got_spu_packet @@ -399,6 +427,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) fprintf(stderr, "dxr3: spu setpts failed (%s)\n", strerror(errno)); } + if (this->xine->spu_channel != stream_id && this->streams!=1 ) return; + written = write(this->fd_spu, buf->content, buf->size); if (written < 0) { fprintf(stderr, "dxr3: spu device write failed (%s)\n", @@ -499,7 +529,8 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) this->spu_decoder.close = spudec_close; this->spu_decoder.get_identifier = spudec_get_id; this->spu_decoder.priority = 10; - + this->xine = xine; + xine_register_event_listener(xine, spudec_event_listener, this); return (spu_decoder_t *) this; diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index d86a2f7ef..e549e6e6b 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_dxr3.c,v 1.10 2001/10/14 14:49:54 ehasenle Exp $ + * $Id: video_out_dxr3.c,v 1.11 2001/10/23 12:08:39 mlampard Exp $ * * Dummy video out plugin for the dxr3. Is responsible for setting * tv_mode, bcs values and the aspectratio. @@ -71,8 +71,8 @@ typedef struct dxr3_driver_s { int video_width; int video_height; int video_aspect; - void (*request_dest_size) (int video_width, int video_height, int *dest_x, - int *dest_y, int *dest_height, int *dest_width); + void (*request_dest_size) (char *user_data, int video_width, int video_height, + int *dest_x, int *dest_y, int *dest_height, int *dest_width); } dxr3_driver_t; static int dxr3_set_property (vo_driver_t *this_gen, int property, int value); @@ -316,7 +316,7 @@ static int dxr3_set_property (vo_driver_t *this_gen, strerror(errno)); if (this->overlay_enabled && !fullscreen){ int foo; - this->request_dest_size(this->width, + this->request_dest_size((char *)this, this->width, this->width/this->desired_ratio, &foo, &foo, &foo, &foo); } break; -- cgit v1.2.3