From b2158a53abddf5165f8bbacaea8f58c1b0b17f9a Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Wed, 10 Jul 2002 14:09:55 +0000 Subject: * handle aspect special buffer to force aspect ratio * detect pan&scan material and tell spu decoder about it * handle pan&scan in the dxr3 video out CVS patchset: 2249 CVS date: 2002/07/10 14:09:55 --- src/dxr3/dxr3_decode_spu.c | 12 ++++++------ src/dxr3/dxr3_decode_video.c | 29 ++++++++++++++++++++++++++++- src/dxr3/video_out_dxr3.c | 16 +++++++++++----- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 2a02c3595..4140713c7 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.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_decode_spu.c,v 1.10 2002/07/08 19:52:01 mroi Exp $ + * $Id: dxr3_decode_spu.c,v 1.11 2002/07/10 14:09:55 mroi Exp $ */ /* dxr3 spu decoder plugin. @@ -90,7 +90,6 @@ typedef struct dxr3_spudec_s { int aspect; /* this is needed for correct highlight placement */ int height; /* in anamorphic menus */ - int pan_scan; } dxr3_spudec_t; /* helper functions */ @@ -151,7 +150,6 @@ spu_decoder_t *init_spu_decoder_plugin(int iface_version, xine_t *xine) this->buttonN = 1; this->aspect = XINE_ASPECT_RATIO_4_3; - this->pan_scan = 0; xine_register_event_listener(xine, dxr3_spudec_event_listener, this); @@ -318,8 +316,8 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) #endif return; } - if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && this->xine->spu_channel_user == -1 && - !this->pan_scan && this->xine->spu_channel_letterbox >= 0 && + if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && + this->xine->spu_channel_user == -1 && this->xine->spu_channel_letterbox >= 0 && this->xine->video_driver->get_property(this->xine->video_driver, VO_PROP_VO_TYPE) == VO_TYPE_DXR3_LETTERBOXED) { /* Use the letterbox version of the subpicture for tv out. */ @@ -463,6 +461,7 @@ static void dxr3_spudec_event_listener(void *this_gen, xine_event_t *event_gen) printf("dxr3_decode_spu: aspect changed to %d\n", this->aspect); #endif break; +#if 0 case XINE_EVENT_ASPECT_CHANGE: switch (((xine_aspect_ratio_event_t *)event)->ratio_code) { case ASPECT_FULL: @@ -484,6 +483,7 @@ static void dxr3_spudec_event_listener(void *this_gen, xine_event_t *event_gen) VO_PROP_ZOOM_FACTOR, this->pan_scan ? 1 : -1); } break; +#endif #if 0 /* FIXME: I think this event is not necessary any more * We know from nav packet decoding, if we are in a menu. */ @@ -528,7 +528,7 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 btn->top = button_ptr->y_start; btn->right = button_ptr->x_end; btn->bottom = button_ptr->y_end; - if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && !this->pan_scan && + if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && this->xine->video_driver->get_property(this->xine->video_driver, VO_PROP_VO_TYPE) == VO_TYPE_DXR3_LETTERBOXED) { /* modify button areas for anamorphic menus on tv out */ diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index e5fef25f0..8e4bc78b7 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.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_decode_video.c,v 1.11 2002/07/08 19:52:01 mroi Exp $ + * $Id: dxr3_decode_video.c,v 1.12 2002/07/10 14:09:56 mroi Exp $ */ /* dxr3 video decoder plugin. @@ -89,6 +89,8 @@ typedef struct dxr3_decoder_s { int frame_rate_code; int repeat_first_field; /* mpeg stream header data */ + int force_aspect; /* when input plugin has better info, we are forced + * to use a certain aspect */ int last_width; int last_height; int last_aspect; /* used to detect changes for event sending */ @@ -229,6 +231,8 @@ static void dxr3_init(video_decoder_t *this_gen, vo_instance_t *video_out) this->have_header_info = 0; this->repeat_first_field = 0; + this->force_aspect = 0; + this->last_width = 0; this->last_height = 0; this->last_aspect = 0; @@ -255,6 +259,27 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) vpts = 0; + /* handle aspect hints from xine-dvdnav */ + if (buf->decoder_flags & BUF_FLAG_SPECIAL) { + if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) { + this->aspect = this->force_aspect = buf->decoder_info[2]; + if (buf->decoder_info[3] == 0x1 && this->force_aspect == XINE_ASPECT_RATIO_ANAMORPHIC) + /* letterboxing is denied, we have to do pan&scan */ + this->aspect = this->force_aspect = XINE_ASPECT_RATIO_PAN_SCAN; + /* when aspect changed, we have to send an event for dxr3 spu decoder */ + if (!this->last_aspect || this->last_aspect != this->aspect) { + xine_frame_change_event_t event; + event.event.type = XINE_EVENT_FRAME_CHANGE; + event.width = this->last_width; + event.height = this->last_height; + event.aspect = this->aspect; + xine_send_event(this->xine, &event.event); + this->last_aspect = this->aspect; + } + } + return; + } + /* parse frames in the buffer handed in, evaluate headers, * send frames to video_out and handle some syncing */ @@ -548,6 +573,8 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer) this->have_header_info = 1; + if (this->force_aspect) this->aspect = this->force_aspect; + /* when width, height or aspect changes, * we have to send an event for dxr3 spu decoder */ if (!this->last_width || !this->last_height || !this->last_aspect || diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index 4f24bbd60..c459ace4b 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.38 2002/07/08 19:52:02 mroi Exp $ + * $Id: video_out_dxr3.c,v 1.39 2002/07/10 14:09:56 mroi Exp $ */ /* mpeg1 encoding video out plugin for the dxr3. @@ -455,8 +455,15 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge aspect = ASPECT_FULL; if (ratio_code == XINE_ASPECT_RATIO_ANAMORPHIC || ratio_code == XINE_ASPECT_RATIO_211_1) aspect = ASPECT_ANAMORPHIC; - - if(this->aspect != aspect) + if (ratio_code == XINE_ASPECT_RATIO_PAN_SCAN && !this->pan_scan) { + dxr3_set_property(this_gen, VO_PROP_ZOOM_FACTOR, 1); + this->pan_scan = 1; + } + if (ratio_code != XINE_ASPECT_RATIO_PAN_SCAN && this->pan_scan) { + this->pan_scan = 0; + dxr3_set_property(this_gen, VO_PROP_ZOOM_FACTOR, -1); + } + if (this->aspect != aspect) dxr3_set_property(this_gen, VO_PROP_ASPECT_RATIO, aspect); return; @@ -486,6 +493,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge oheight = height; break; case XINE_ASPECT_RATIO_ANAMORPHIC: + case XINE_ASPECT_RATIO_PAN_SCAN: aspect = ASPECT_ANAMORPHIC; oheight = height; break; @@ -745,12 +753,10 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) /* FIXME: We should send an anamorphic hint to widescreen tvs, so they * can switch to 16:9 mode. I don't know if the dxr3 can do this. */ } - this->pan_scan = 1; } else if (value == -1) { #if LOG_VID printf("video_out_dxr3: disabling 16:9 zoom\n"); #endif - this->pan_scan = 0; dxr3_set_property(this_gen, VO_PROP_ASPECT_RATIO, this->aspect); } } -- cgit v1.2.3