Commit 81c7b062 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Rewritten embedded window internal ABI

parent 138da191
......@@ -399,8 +399,7 @@ struct vout_thread_t
unsigned int i_par_num; /**< monitor pixel aspect-ratio */
unsigned int i_par_den; /**< monitor pixel aspect-ratio */
intf_thread_t *p_parent_intf; /**< parent interface for embedded
vout (if any) */
struct vout_window_t *p_window; /**< window for embedded vout (if any) */
/**@}*/
/** \name Plugin used and shortcuts to access its capabilities */
......
/*****************************************************************************
* vlc_window.h: Embedded video output window
*****************************************************************************
* Copyright (C) 2008 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef LIBVLCCORE_WINDOW_H
# define LIBVLCCORE_WINDOW_H 1
# include <stdarg.h>
typedef struct vout_window_t vout_window_t;
struct vout_window_t
{
VLC_COMMON_MEMBERS
module_t *module;
vout_thread_t *vout;
void *handle; /* OS-specific Window handle */
unsigned width; /* pixels width */
unsigned height; /* pixels height */
int pos_x; /* horizontal position hint */
int pos_y; /* vertical position hint */
int (*control) (struct vout_window_t *, int, va_list);
};
#endif /* !LIBVLCCORE_WINDOW_H */
......@@ -982,7 +982,7 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
vout_OSDMessage( p_input, POSITION_TEXT_CHAN, psz_time );
}
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
if( !p_vout->p_window || p_vout->b_fullscreen )
{
var_Get( p_input, "position", &pos );
vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
......@@ -999,7 +999,7 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
}
ClearChannels( p_intf, p_vout );
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
if( !p_vout->p_window || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
......
......@@ -304,8 +304,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
p_vout->render_time = 10;
p_vout->c_fps_samples = 0;
p_vout->b_filter_change = 0;
p_vout->pf_control = 0;
p_vout->p_parent_intf = 0;
p_vout->pf_control = NULL;
p_vout->p_window = NULL;
p_vout->i_par_num = p_vout->i_par_den = 1;
/* Initialize locks */
......
......@@ -34,12 +34,14 @@
#include <stdlib.h> /* free() */
#include <sys/types.h> /* opendir() */
#include <dirent.h> /* opendir() */
#include <assert.h>
#include <vlc_interface.h>
#include <vlc_block.h>
#include <vlc_playlist.h>
#include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_image.h>
#include <vlc_osd.h>
#include <vlc_charset.h>
......@@ -100,18 +102,59 @@ void *vout_RequestWindow( vout_thread_t *p_vout,
int drawable = var_CreateGetInteger( p_vout, "drawable" );
if( drawable ) return (void *)(intptr_t)drawable;
return NULL;
vout_window_t *wnd = vlc_custom_create (VLC_OBJECT(p_vout), sizeof (*wnd),
VLC_OBJECT_GENERIC, "window");
if (wnd == NULL)
return NULL;
wnd->vout = p_vout;
wnd->width = *pi_width_hint;
wnd->height = *pi_height_hint;
wnd->pos_x = *pi_x_hint;
wnd->pos_y = *pi_y_hint;
vlc_object_attach (wnd, p_vout);
wnd->module = module_Need (wnd, "vout window", 0, 0);
if (wnd->module == NULL)
{
msg_Dbg (wnd, "no window provider available");
vlc_object_release (wnd);
return NULL;
}
p_vout->p_window = wnd;
*pi_width_hint = wnd->width;
*pi_height_hint = wnd->height;
*pi_x_hint = wnd->pos_x;
*pi_y_hint = wnd->pos_y;
return wnd->handle;
}
void vout_ReleaseWindow( vout_thread_t *p_vout, void *p_window )
void vout_ReleaseWindow( vout_thread_t *p_vout, void *dummy )
{
(void)p_vout; (void)p_window;
vout_window_t *wnd = p_vout->p_window;
if (wnd == NULL)
return;
p_vout->p_window = NULL;
assert (wnd->module);
module_Unneed (wnd, wnd->module);
vlc_object_detach (wnd);
vlc_object_release (wnd);
(void)dummy;
}
int vout_ControlWindow( vout_thread_t *p_vout, void *p_window,
int vout_ControlWindow( vout_thread_t *p_vout, void *dummy,
int i_query, va_list args )
{
(void)p_vout; (void)p_window; (void)i_query; (void)args;
vout_window_t *wnd = p_vout->p_window;
if (wnd == NULL)
return VLC_EGENERIC;
assert (wnd->control);
return wnd->control (wnd, i_query, args);
}
/*****************************************************************************
......@@ -782,23 +825,18 @@ int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args )
{
case VOUT_REPARENT:
case VOUT_CLOSE:
if( p_vout->p_parent_intf )
{
vlc_object_release( p_vout->p_parent_intf );
p_vout->p_parent_intf = NULL;
}
if( p_vout->p_window )
vout_ReleaseWindow( p_vout->p_window, NULL );
return VLC_SUCCESS;
break;
case VOUT_SNAPSHOT:
p_vout->b_snapshot = true;
return VLC_SUCCESS;
break;
default:
msg_Dbg( p_vout, "control query not supported" );
return VLC_EGENERIC;
}
return VLC_EGENERIC;
}
/*****************************************************************************
......
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