diff options
-rw-r--r-- | src/xine-engine/video_out.c | 60 | ||||
-rw-r--r-- | src/xine-engine/xine_interface.c | 46 |
2 files changed, 62 insertions, 44 deletions
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 516cf2b74..70ce11f4c 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.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.c,v 1.140 2003/02/06 00:09:20 miguelfreitas Exp $ + * $Id: video_out.c,v 1.141 2003/02/06 10:59:02 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -1089,10 +1089,36 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { case VO_PROP_DISCARD_FRAMES: ret = this->discard_frames; break; + + /* + * handle XINE_PARAM_xxx properties (convert from driver's range) + */ + case XINE_PARAM_VO_HUE: + case XINE_PARAM_VO_SATURATION: + case XINE_PARAM_VO_CONTRAST: + case XINE_PARAM_VO_BRIGHTNESS: { + int v, min_v, max_v, range_v; + + pthread_mutex_lock( &this->driver_lock ); + this->driver->get_property_min_max (this->driver, + property & 0xffffff, + &min_v, &max_v); + + v = this->driver->get_property (this->driver, property & 0xffffff); + + range_v = max_v - min_v; + if (range_v > 0) + ret = (v-min_v) * 65535 / range_v; + else + ret = 0; + pthread_mutex_unlock( &this->driver_lock ); + } + break; + default: pthread_mutex_lock( &this->driver_lock ); - ret = this->driver->get_property(this->driver, property); + ret = this->driver->get_property(this->driver, property & 0xffffff); pthread_mutex_unlock( &this->driver_lock ); } return ret; @@ -1134,10 +1160,38 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value } break; + /* + * handle XINE_PARAM_xxx properties (convert to driver's range) + */ + case XINE_PARAM_VO_HUE: + case XINE_PARAM_VO_SATURATION: + case XINE_PARAM_VO_CONTRAST: + case XINE_PARAM_VO_BRIGHTNESS: + if (!this->grab_only) { + int v, min_v, max_v, range_v; + + pthread_mutex_lock( &this->driver_lock ); + + this->driver->get_property_min_max (this->driver, + property & 0xffffff, + &min_v, &max_v); + + range_v = max_v - min_v; + + v = (value * range_v) / 65535 + min_v; + + this->driver->set_property(this->driver, property & 0xffffff, v); + pthread_mutex_unlock( &this->driver_lock ); + ret = value; + } else + ret = 0; + break; + + default: if (!this->grab_only) { pthread_mutex_lock( &this->driver_lock ); - ret = this->driver->set_property(this->driver, property, value); + ret = this->driver->set_property(this->driver, property & 0xffffff, value); pthread_mutex_unlock( &this->driver_lock ); } else ret = 0; diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 307c6aaaa..ecce238b0 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.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: xine_interface.c,v 1.38 2003/01/13 02:15:07 miguelfreitas Exp $ + * $Id: xine_interface.c,v 1.39 2003/02/06 10:59:02 miguelfreitas Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -368,29 +368,14 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: - case XINE_PARAM_VO_BRIGHTNESS: { - int v, min_v, max_v, range_v; - - - stream->video_driver->get_property_min_max (stream->video_driver, - param & 0xffffff, - &min_v, &max_v); - - range_v = max_v - min_v; - - v = (value * range_v) / 65535 + min_v; - - stream->video_driver->set_property(stream->video_driver, param & 0xffffff, v); - } - break; - + case XINE_PARAM_VO_BRIGHTNESS: case XINE_PARAM_VO_DEINTERLACE: case XINE_PARAM_VO_ASPECT_RATIO: case XINE_PARAM_VO_ZOOM_X: case XINE_PARAM_VO_ZOOM_Y: case XINE_PARAM_VO_PAN_SCAN: case XINE_PARAM_VO_TVMODE: - stream->video_driver->set_property(stream->video_driver, param & 0xffffff, value); + stream->video_out->set_property(stream->video_out, param, value); break; default: @@ -440,35 +425,14 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: - case XINE_PARAM_VO_BRIGHTNESS: { - int v, min_v, max_v, range_v; - - - stream->video_driver->get_property_min_max (stream->video_driver, - param & 0xffffff, - &min_v, &max_v); - - v = stream->video_driver->get_property (stream->video_driver, param & 0xffffff); - - range_v = max_v - min_v; - - /* printf ("xine_interface: %d [%d %d]\n", v, min_v, max_v); */ - - if (range_v > 0) - return (v-min_v) * 65535 / range_v; - else - return 0; - } - break; - - + case XINE_PARAM_VO_BRIGHTNESS: case XINE_PARAM_VO_DEINTERLACE: case XINE_PARAM_VO_ASPECT_RATIO: case XINE_PARAM_VO_ZOOM_X: case XINE_PARAM_VO_ZOOM_Y: case XINE_PARAM_VO_PAN_SCAN: case XINE_PARAM_VO_TVMODE: - return stream->video_driver->get_property(stream->video_driver, param & 0xffffff); + return stream->video_out->get_property(stream->video_out, param); break; default: |