From 3318cf724a7f27e5146f55c1d4155a000829c525 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Mon, 15 Sep 2008 20:55:23 +0200 Subject: [PATCH] Removed useless width/height fields in subpicture_t. --- include/vlc_vout.h | 2 -- modules/codec/spudec/parse.c | 48 ++++++++++++++++++++++------------ modules/codec/zvbi.c | 2 -- modules/control/dbus.c | 12 ++++----- modules/video_filter/osdmenu.c | 5 ---- modules/video_filter/rss.c | 1 - 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/include/vlc_vout.h b/include/vlc_vout.h index 1062b6e8fb..ef53fc86f6 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -355,8 +355,6 @@ struct subpicture_t /**@{*/ int i_x; /**< offset from alignment position */ int i_y; /**< offset from alignment position */ - int i_width; /**< picture width */ - int i_height; /**< picture height */ int i_alpha; /**< transparency */ int i_original_picture_width; /**< original width of the movie */ int i_original_picture_height;/**< original height of the movie */ diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c index 5bfe1a7b75..e8d91c9630 100644 --- a/modules/codec/spudec/parse.c +++ b/modules/codec/spudec/parse.c @@ -40,9 +40,18 @@ /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int ParseControlSeq( decoder_t *, subpicture_t *, subpicture_data_t *); -static int ParseRLE ( decoder_t *, subpicture_t *, subpicture_data_t *); -static void Render ( decoder_t *, subpicture_t *, subpicture_data_t *); +typedef struct +{ + int i_width; + int i_height; +} spu_properties_t; + +static int ParseControlSeq( decoder_t *, subpicture_t *, subpicture_data_t *, + spu_properties_t * ); +static int ParseRLE ( decoder_t *, subpicture_data_t *, + const spu_properties_t * ); +static void Render ( decoder_t *, subpicture_t *, subpicture_data_t *, + const spu_properties_t * ); /***************************************************************************** * AddNibble: read a nibble from a source packet and add it to our integer. @@ -71,6 +80,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) decoder_sys_t *p_sys = p_dec->p_sys; subpicture_data_t *p_spu_data; subpicture_t *p_spu; + spu_properties_t spu_properties; /* Allocate the subpicture internal data. */ p_spu = p_dec->pf_spu_buffer_new( p_dec ); @@ -100,8 +110,10 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) p_spu->i_original_picture_height = p_dec->fmt_in.subs.spu.i_original_frame_height; + memset( &spu_properties, 0, sizeof(spu_properties) ); + /* Getting the control part */ - if( ParseControlSeq( p_dec, p_spu, p_spu_data ) ) + if( ParseControlSeq( p_dec, p_spu, p_spu_data, &spu_properties ) ) { /* There was a parse error, delete the subpicture */ p_dec->pf_spu_buffer_del( p_dec, p_spu ); @@ -109,7 +121,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) } /* We try to display it */ - if( ParseRLE( p_dec, p_spu, p_spu_data ) ) + if( ParseRLE( p_dec, p_spu_data, &spu_properties ) ) { /* There was a parse error, delete the subpicture */ p_dec->pf_spu_buffer_del( p_dec, p_spu ); @@ -122,7 +134,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) p_spu_data->pi_offset[0], p_spu_data->pi_offset[1] ); #endif - Render( p_dec, p_spu, p_spu_data ); + Render( p_dec, p_spu, p_spu_data, &spu_properties ); free( p_spu_data ); return p_spu; @@ -136,7 +148,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec ) * subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html *****************************************************************************/ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu, - subpicture_data_t *p_spu_data ) + subpicture_data_t *p_spu_data, spu_properties_t *p_spu_properties ) { decoder_sys_t *p_sys = p_dec->p_sys; @@ -267,16 +279,16 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu, p_spu->i_x = (p_sys->buffer[i_index+1]<<4)| ((p_sys->buffer[i_index+2]>>4)&0x0f); - p_spu->i_width = (((p_sys->buffer[i_index+2]&0x0f)<<8)| + p_spu_properties->i_width = (((p_sys->buffer[i_index+2]&0x0f)<<8)| p_sys->buffer[i_index+3]) - p_spu->i_x + 1; p_spu->i_y = (p_sys->buffer[i_index+4]<<4)| ((p_sys->buffer[i_index+5]>>4)&0x0f); - p_spu->i_height = (((p_sys->buffer[i_index+5]&0x0f)<<8)| + p_spu_properties->i_height = (((p_sys->buffer[i_index+5]&0x0f)<<8)| p_sys->buffer[i_index+6]) - p_spu->i_y + 1; /* Auto crop fullscreen subtitles */ - if( p_spu->i_height > 250 ) + if( p_spu_properties->i_height > 250 ) p_spu_data->b_auto_crop = true; i_index += 7; @@ -385,16 +397,17 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu, * convenient structure for later decoding. For more information on the * subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html *****************************************************************************/ -static int ParseRLE( decoder_t *p_dec, subpicture_t * p_spu, - subpicture_data_t *p_spu_data ) +static int ParseRLE( decoder_t *p_dec, + subpicture_data_t *p_spu_data, + const spu_properties_t *p_spu_properties ) { decoder_sys_t *p_sys = p_dec->p_sys; uint8_t *p_src = &p_sys->buffer[4]; unsigned int i_code; - unsigned int i_width = p_spu->i_width; - unsigned int i_height = p_spu->i_height; + unsigned int i_width = p_spu_properties->i_width; + unsigned int i_height = p_spu_properties->i_height; unsigned int i_x, i_y; uint16_t *p_dest = (uint16_t *)p_spu_data->p_data; @@ -636,7 +649,8 @@ static int ParseRLE( decoder_t *p_dec, subpicture_t * p_spu, } static void Render( decoder_t *p_dec, subpicture_t *p_spu, - subpicture_data_t *p_spu_data ) + subpicture_data_t *p_spu_data, + const spu_properties_t *p_spu_properties ) { uint8_t *p_p; int i_x, i_y, i_len, i_color, i_pitch; @@ -647,8 +661,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu, memset( &fmt, 0, sizeof(video_format_t) ); fmt.i_chroma = VLC_FOURCC('Y','U','V','P'); fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */ - fmt.i_width = fmt.i_visible_width = p_spu->i_width; - fmt.i_height = fmt.i_visible_height = p_spu->i_height - + fmt.i_width = fmt.i_visible_width = p_spu_properties->i_width; + fmt.i_height = fmt.i_visible_height = p_spu_properties->i_height - p_spu_data->i_y_top_offset - p_spu_data->i_y_bottom_offset; fmt.i_x_offset = fmt.i_y_offset = 0; p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_dec), &fmt ); diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c index 233833ccf5..c5c0e7b911 100644 --- a/modules/codec/zvbi.c +++ b/modules/codec/zvbi.c @@ -505,9 +505,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt, if( !b_text ) { - p_spu->i_width = p_spu->i_original_picture_width = fmt.i_width; - p_spu->i_height = p_spu->i_original_picture_height = fmt.i_height; } diff --git a/modules/control/dbus.c b/modules/control/dbus.c index 80dee19e21..f8eeec2c2e 100644 --- a/modules/control/dbus.c +++ b/modules/control/dbus.c @@ -101,6 +101,7 @@ struct intf_sys_t DBusConnection *p_conn; bool b_meta_read; dbus_int32_t i_caps; + bool b_dead; }; /***************************************************************************** @@ -727,6 +728,7 @@ static int Open( vlc_object_t *p_this ) p_sys->b_meta_read = false; p_sys->i_caps = CAPS_NONE; + p_sys->b_dead = false; dbus_error_init( &error ); @@ -793,8 +795,6 @@ static void Close ( vlc_object_t *p_this ) playlist_t *p_playlist = pl_Yield( p_intf );; input_thread_t *p_input; - p_this->b_dead = true; - PL_LOCK; var_DelCallback( p_playlist, "playlist-current", TrackChange, p_intf ); var_DelCallback( p_playlist, "intf-change", TrackListChangeEmit, p_intf ); @@ -887,7 +887,7 @@ static int TrackListChangeEmit( vlc_object_t *p_this, const char *psz_var, return VLC_SUCCESS; } - if( p_intf->b_dead ) + if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; UpdateCaps( p_intf, true ); @@ -935,7 +935,7 @@ static int StateChange( vlc_object_t *p_this, const char* psz_var, intf_thread_t *p_intf = ( intf_thread_t* ) p_data; intf_sys_t *p_sys = p_intf->p_sys; - if( p_intf->b_dead ) + if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; UpdateCaps( p_intf, true ); @@ -969,7 +969,7 @@ static int StatusChangeEmit( vlc_object_t *p_this, const char *psz_var, VLC_UNUSED(oldval); VLC_UNUSED(newval); intf_thread_t *p_intf = p_data; - if( p_intf->b_dead ) + if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; UpdateCaps( p_intf, false ); @@ -991,7 +991,7 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var, VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval ); VLC_UNUSED( newval ); - if( p_intf->b_dead ) + if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; p_sys->b_meta_read = false; diff --git a/modules/video_filter/osdmenu.c b/modules/video_filter/osdmenu.c index 3e8e583530..3393d660b3 100644 --- a/modules/video_filter/osdmenu.c +++ b/modules/video_filter/osdmenu.c @@ -530,8 +530,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date ) return NULL; } - p_spu->i_width = p_region->fmt.i_visible_width; - p_spu->i_height = p_region->fmt.i_visible_height; p_spu->i_alpha = p_filter->p_sys->i_alpha; /* proper positioning of OSD menu image */ @@ -577,9 +575,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date ) return NULL; } - p_spu->i_width += p_new->fmt.i_visible_width; - p_spu->i_height += p_new->fmt.i_visible_height; - if( !p_region_list ) { p_region_list = p_new; diff --git a/modules/video_filter/rss.c b/modules/video_filter/rss.c index c0aeb36cbc..f4d9e21589 100644 --- a/modules/video_filter/rss.c +++ b/modules/video_filter/rss.c @@ -533,7 +533,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) p_spu->i_x = p_sys->i_xoff; p_spu->i_y = p_sys->i_yoff; - p_spu->i_height = 1; p_spu->p_region->p_style = p_sys->p_style; if( p_feed->p_pic ) -- 2.39.2