Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (19)
......@@ -168,7 +168,7 @@ libdirect3d9_plugin_la_SOURCES = video_output/win32/direct3d9.c \
video_output/win32/events.c video_output/win32/events.h \
video_output/win32/builtin_shaders.h \
video_output/win32/win32touch.c video_output/win32/win32touch.h
libdirect3d9_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la -lgdi32 $(LIBCOM) -luuid
libdirect3d9_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la -lgdi32 -luser32 $(LIBCOM) -luuid
libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
libglinterop_dxva2_plugin_la_SOURCES = video_output/opengl/interop_dxva2.c \
......@@ -193,14 +193,16 @@ libdirect3d11_plugin_la_SOURCES = video_output/win32/direct3d11.cpp \
video_output/win32/common.c video_output/win32/common.h
libdirect3d11_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(LIBCOMCXXFLAGS)
libdirect3d11_plugin_la_LIBADD = libchroma_copy.la libd3d11_common.la $(LIBCOM) -luuid
libdirect3d11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
if !HAVE_WINSTORE
libdirect3d11_plugin_la_CPPFLAGS += -DHAVE_WIN32_SENSORS
libdirect3d11_plugin_la_SOURCES += video_output/win32/events.c \
video_output/win32/events.h \
video_output/win32/d3d11_swapchain.cpp video_output/win32/d3d11_swapchain.h \
video_output/win32/dxgi_swapchain.cpp video_output/win32/dxgi_swapchain.h \
video_output/win32/sensors.cpp \
video_output/win32/win32touch.c video_output/win32/win32touch.h
libdirect3d11_plugin_la_LIBADD += -lgdi32
libdirect3d11_plugin_la_LIBADD += -lgdi32 -luser32
else
libdirect3d11_plugin_la_LIBADD += -ld3d11
libdirect3d11_plugin_la_LIBADD += -ld3dcompiler_47
......@@ -215,10 +217,11 @@ libglwin32_plugin_la_SOURCES = $(OPENGL_VOUT_COMMONSOURCES) \
video_output/win32/events.c video_output/win32/events.h \
video_output/win32/sensors.cpp \
video_output/win32/win32touch.c video_output/win32/win32touch.h
libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_WIN32_SENSORS
libglwin32_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(LIBCOMCXXFLAGS)
libwgl_plugin_la_SOURCES = video_output/win32/wgl.c
libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid libvlc_opengl.la
libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 -luser32 $(LIBCOM) -luuid libvlc_opengl.la
libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 libvlc_opengl.la
libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS)
......@@ -236,7 +239,7 @@ libwingdi_plugin_la_SOURCES = video_output/win32/wingdi.c \
video_output/win32/common.c video_output/win32/common.h \
video_output/win32/events.c video_output/win32/events.h \
video_output/win32/win32touch.c video_output/win32/win32touch.h
libwingdi_plugin_la_LIBADD = libchroma_copy.la -lgdi32 $(LIBCOM) -luuid
libwingdi_plugin_la_LIBADD = libchroma_copy.la -lgdi32 -luser32 $(LIBCOM) -luuid
if HAVE_WIN32_DESKTOP
vout_LTLIBRARIES += libwingdi_plugin.la
endif
......
......@@ -57,20 +57,12 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
return VLC_EGENERIC;
/* */
area->event = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window);
area->event = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window,
&vd->cfg->display,
projection_gestures ? &vd->owner : NULL);
if (!area->event)
return VLC_EGENERIC;
/* */
event_cfg_t cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.width = vd->cfg->display.width;
cfg.height = vd->cfg->display.height;
cfg.is_projected = projection_gestures;
if (EventThreadStart(area->event, &cfg))
return VLC_EGENERIC;
return VLC_SUCCESS;
}
......@@ -113,10 +105,7 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area)
/* */
void CommonWindowClean(display_win32_area_t *sys)
{
if (sys->event) {
EventThreadStop(sys->event);
EventThreadDestroy(sys->event);
}
EventThreadDestroy(sys->event);
}
#endif /* !VLC_WINSTORE_APP */
......
......@@ -59,9 +59,6 @@ void CommonControl(vout_display_t *, display_win32_area_t *, int );
void CommonPlacePicture (vout_display_t *, display_win32_area_t *);
void CommonInit(display_win32_area_t *, const video_format_t *);
void* HookWindowsSensors(vout_display_t*, HWND);
void UnhookWindowsSensors(void*);
# ifdef __cplusplus
}
# endif
......@@ -99,9 +99,6 @@ typedef struct vout_display_sys_t
int log_level;
/* Sensors */
void *p_sensors = NULL;
display_info_t display = {};
d3d11_device_t *d3d_dev = NULL;
......@@ -430,11 +427,6 @@ static int Open(vout_display_t *vd,
#endif // !VLC_WINSTORE_APP
}
#ifndef VLC_WINSTORE_APP
if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && CommonVideoHWND(&sys->area))
sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->area));
#endif // !VLC_WINSTORE_APP
if (Direct3D11Open(vd, fmtp, context)) {
msg_Err(vd, "Direct3D11 could not be opened");
goto error;
......@@ -471,7 +463,6 @@ static void Close(vout_display_t *vd)
vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
D3D_ReleaseShaderCompiler(sys->shaders);
#ifndef VLC_WINSTORE_APP
UnhookWindowsSensors(sys->p_sensors);
CommonWindowClean(&sys->area);
#endif
Direct3D11Close(vd);
......
......@@ -41,6 +41,9 @@
#include "events.h"
#include "common.h"
#ifdef HAVE_WIN32_SENSORS
#include "sensors.h"
#endif
/*****************************************************************************
* Local prototypes.
......@@ -53,17 +56,20 @@ struct event_thread_t
vlc_thread_t thread;
vlc_mutex_t lock;
vlc_cond_t wait;
bool b_ready;
atomic_bool b_done;
bool b_ready; // the thread was started
bool b_error;
atomic_bool b_done;
/* */
bool is_projected;
#ifdef HAVE_WIN32_SENSORS
/* Sensors */
const vout_display_owner_t *init_move;
void *p_sensors;
#endif
/* Gestures */
win32_gesture_sys_t *p_gesture;
struct win32_gesture_sys_t *p_gesture;
RECT window_area;
unsigned init_width, init_height;
/* */
vlc_window_t *parent_window;
......@@ -72,148 +78,14 @@ struct event_thread_t
HWND hvideownd;
};
/***************************
* Local Prototypes *
***************************/
/* Window Creation */
static int Win32VoutCreateWindow( event_thread_t * );
static void Win32VoutCloseWindow ( event_thread_t * );
/*****************************************************************************
* EventThread: Create video window & handle its messages
*****************************************************************************
* This function creates a video window and then enters an infinite loop
* that handles the messages sent to that window.
* The main goal of this thread is to isolate the Win32 PeekMessage function
* because this one can block for a long time.
*****************************************************************************/
static void *EventThread( void *p_this )
{
vlc_thread_set_name("vlc-vout-hwnd");
event_thread_t *p_event = (event_thread_t *)p_this;
MSG msg;
int canc = vlc_savecancel ();
vlc_mutex_lock( &p_event->lock );
/* Create a window for the video */
/* Creating a window under Windows also initializes the thread's event
* message queue */
if( Win32VoutCreateWindow( p_event ) )
p_event->b_error = true;
p_event->b_ready = true;
vlc_cond_signal( &p_event->wait );
const bool b_error = p_event->b_error;
vlc_mutex_unlock( &p_event->lock );
if( b_error )
{
vlc_restorecancel( canc );
return NULL;
}
/* Main loop */
/* GetMessage will sleep if there's no message in the queue */
for( ;; )
{
if( !GetMessage( &msg, 0, 0, 0 ) || atomic_load( &p_event->b_done ) )
{
break;
}
/* Messages we don't handle directly are dispatched to the
* window procedure */
TranslateMessage(&msg);
DispatchMessage(&msg);
} /* End Main loop */
msg_Dbg( p_event->obj, "Win32 Vout EventThread terminating" );
Win32VoutCloseWindow( p_event );
vlc_restorecancel(canc);
return NULL;
}
event_thread_t *EventThreadCreate( vlc_object_t *obj, vlc_window_t *parent_window)
{
if (parent_window->type != VLC_WINDOW_TYPE_HWND)
return NULL;
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( obj, "creating Vout EventThread" );
event_thread_t *p_event = malloc( sizeof(*p_event) );
if( !p_event )
return NULL;
p_event->obj = obj;
vlc_mutex_init( &p_event->lock );
vlc_cond_init( &p_event->wait );
atomic_init( &p_event->b_done, false );
p_event->parent_window = parent_window;
_snwprintf( p_event->class_video, ARRAY_SIZE(p_event->class_video),
TEXT("VLC video output %p"), (void *)p_event );
return p_event;
}
void EventThreadDestroy( event_thread_t *p_event )
{
free( p_event );
}
int EventThreadStart( event_thread_t *p_event, const event_cfg_t *p_cfg )
{
p_event->is_projected = p_cfg->is_projected;
p_event->window_area.left = 0;
p_event->window_area.top = 0;
p_event->window_area.right = p_cfg->width;
p_event->window_area.bottom = p_cfg->height;
p_event->b_ready = false;
atomic_store( &p_event->b_done, false);
p_event->b_error = false;
if( vlc_clone( &p_event->thread, EventThread, p_event ) )
{
msg_Err( p_event->obj, "cannot create Vout EventThread" );
return VLC_EGENERIC;
}
vlc_mutex_lock( &p_event->lock );
while( !p_event->b_ready )
vlc_cond_wait( &p_event->wait, &p_event->lock );
const bool b_error = p_event->b_error;
vlc_mutex_unlock( &p_event->lock );
if( b_error )
{
vlc_join( p_event->thread, NULL );
p_event->b_ready = false;
return VLC_EGENERIC;
}
msg_Dbg( p_event->obj, "Vout EventThread running" );
return VLC_SUCCESS;
}
HWND EventThreadVideoHWND( const event_thread_t *p_event )
HWND EventThreadVideoHWND( const struct event_thread_t *p_event )
{
return p_event->hvideownd;
}
void EventThreadStop( event_thread_t *p_event )
void EventThreadDestroy( struct event_thread_t *p_event )
{
if( !p_event->b_ready )
if ( p_event == NULL )
return;
atomic_store( &p_event->b_done, true );
......@@ -224,9 +96,14 @@ void EventThreadStop( event_thread_t *p_event )
PostMessage( p_event->hvideownd, WM_NULL, 0, 0);
vlc_join( p_event->thread, NULL );
p_event->b_ready = false;
}
#ifdef HAVE_WIN32_SENSORS
if (p_event->p_sensors)
UnhookWindowsSensors(p_event->p_sensors);
#endif
free( p_event );
}
/***********************************
* Local functions implementations *
......@@ -245,7 +122,7 @@ static LRESULT CALLBACK VideoEventProc( HWND hwnd, UINT message,
LONG_PTR p_user_data = GetWindowLongPtr( hwnd, GWLP_USERDATA );
if( p_user_data == 0 ) /* messages before WM_CREATE */
return DefWindowProc(hwnd, message, wParam, lParam);
event_thread_t *p_event = (event_thread_t *)p_user_data;
struct event_thread_t *p_event = (struct event_thread_t *)p_user_data;
switch( message )
{
......@@ -262,7 +139,9 @@ static LRESULT CALLBACK VideoEventProc( HWND hwnd, UINT message,
return 0;
case WM_GESTURE:
return DecodeGesture( p_event->obj, p_event->p_gesture, hwnd, message, wParam, lParam );
if (DecodeGesture( p_event->obj, p_event->p_gesture, (HGESTUREINFO)lParam ))
return 0;
return DefWindowProc(hwnd, message, wParam, lParam);
/*
** For OpenGL and Direct3D, vout will update the whole
......@@ -289,7 +168,7 @@ static LRESULT CALLBACK VideoEventProc( HWND hwnd, UINT message,
* the video will be displayed. This window will also allow us to capture the
* events.
*****************************************************************************/
static int Win32VoutCreateWindow( event_thread_t *p_event )
static int Win32VoutCreateWindow( struct event_thread_t *p_event )
{
HINSTANCE hInstance;
WNDCLASS wc; /* window class components */
......@@ -333,8 +212,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
i_style, /* window style */
CW_USEDEFAULT, /* default X coordinate */
CW_USEDEFAULT, /* default Y coordinate */
RECTWidth(p_event->window_area), /* window width */
RECTHeight(p_event->window_area), /* window height */
p_event->init_width, /* window width */
p_event->init_height, /* window height */
p_event->hparent, /* parent window */
NULL, /* no menu in this window */
hInstance, /* handle of this program instance */
......@@ -354,7 +233,12 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
SetWindowLong( p_event->hparent, GWL_STYLE,
parent_style | WS_CLIPCHILDREN );
InitGestures( p_event->hvideownd, &p_event->p_gesture, p_event->is_projected );
#ifdef HAVE_WIN32_SENSORS
if (p_event->init_move != NULL)
p_event->p_gesture = InitGestures( p_event->hvideownd, true );
else
#endif
p_event->p_gesture = InitGestures( p_event->hvideownd, false );
/* Now display the window */
ShowWindow( p_event->hvideownd, SW_SHOWNOACTIVATE );
......@@ -367,7 +251,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
*****************************************************************************
* This function returns all resources allocated by Win32VoutCreateWindow.
*****************************************************************************/
static void Win32VoutCloseWindow( event_thread_t *p_event )
static void Win32VoutCloseWindow( struct event_thread_t *p_event )
{
msg_Dbg( p_event->obj, "Win32VoutCloseWindow" );
......@@ -379,7 +263,134 @@ static void Win32VoutCloseWindow( event_thread_t *p_event )
CloseGestures( p_event->p_gesture);
}
void EventThreadUpdateSize( event_thread_t *p_event )
/*****************************************************************************
* EventThread: Create video window & handle its messages
*****************************************************************************
* This function creates a video window and then enters an infinite loop
* that handles the messages sent to that window.
* The main goal of this thread is to isolate the Win32 PeekMessage function
* because this one can block for a long time.
*****************************************************************************/
static void *EventThread( void *p_this )
{
vlc_thread_set_name("vlc-vout-hwnd");
struct event_thread_t *p_event = p_this;
MSG msg;
int canc = vlc_savecancel ();
vlc_mutex_lock( &p_event->lock );
/* Create a window for the video */
/* Creating a window under Windows also initializes the thread's event
* message queue */
if( Win32VoutCreateWindow( p_event ) )
p_event->b_error = true;
p_event->b_ready = true;
vlc_cond_signal( &p_event->wait );
const bool b_error = p_event->b_error;
vlc_mutex_unlock( &p_event->lock );
if( b_error )
{
vlc_restorecancel( canc );
return NULL;
}
/* Main loop */
/* GetMessage will sleep if there's no message in the queue */
for( ;; )
{
if( !GetMessage( &msg, 0, 0, 0 ) || atomic_load( &p_event->b_done ) )
{
break;
}
/* Messages we don't handle directly are dispatched to the
* window procedure */
TranslateMessage(&msg);
DispatchMessage(&msg);
} /* End Main loop */
msg_Dbg( p_event->obj, "Win32 Vout EventThread terminating" );
Win32VoutCloseWindow( p_event );
vlc_restorecancel(canc);
return NULL;
}
struct event_thread_t *EventThreadCreate( vlc_object_t *obj, vlc_window_t *parent_window,
const struct vout_display_placement *display,
const vout_display_owner_t *owner )
{
if (parent_window->type != VLC_WINDOW_TYPE_HWND)
return NULL;
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( obj, "creating Vout EventThread" );
struct event_thread_t *p_event = malloc( sizeof(*p_event) );
if( !p_event )
return NULL;
p_event->obj = obj;
vlc_mutex_init( &p_event->lock );
vlc_cond_init( &p_event->wait );
atomic_init( &p_event->b_done, false );
p_event->b_ready = false;
p_event->b_error = false;
p_event->parent_window = parent_window;
_snwprintf( p_event->class_video, ARRAY_SIZE(p_event->class_video),
TEXT("VLC video output %p"), (void *)p_event );
#ifdef HAVE_WIN32_SENSORS
p_event->init_move = owner;
p_event->p_sensors = NULL;
#else
VLC_UNUSED(owner);
#endif
p_event->init_width = display->width;
p_event->init_height = display->height;
if( vlc_clone( &p_event->thread, EventThread, p_event ) )
{
msg_Err( obj, "cannot create Vout EventThread" );
free(p_event);
return NULL;
}
vlc_mutex_lock( &p_event->lock );
while( !p_event->b_ready )
vlc_cond_wait( &p_event->wait, &p_event->lock );
const bool b_error = p_event->b_error;
vlc_mutex_unlock( &p_event->lock );
if( b_error )
{
vlc_join( p_event->thread, NULL );
free(p_event);
return NULL;
}
#ifdef HAVE_WIN32_SENSORS
if (owner != NULL)
p_event->p_sensors = HookWindowsSensors(vlc_object_logger(obj), owner, p_event->hvideownd);
#endif
msg_Dbg( obj, "Vout EventThread running" );
return p_event;
}
void EventThreadUpdateSize( struct event_thread_t *p_event )
{
RECT clientRect;
GetClientRect(p_event->hparent, &clientRect);
......
......@@ -27,17 +27,9 @@
/**
* HWNDs manager.
*/
typedef struct event_thread_t event_thread_t;
typedef struct {
bool is_projected;
unsigned width;
unsigned height;
} event_cfg_t;
event_thread_t *EventThreadCreate( vlc_object_t *, vlc_window_t *);
void EventThreadDestroy( event_thread_t * );
int EventThreadStart( event_thread_t *, const event_cfg_t * );
HWND EventThreadVideoHWND( const event_thread_t * );
void EventThreadStop( event_thread_t * );
void EventThreadUpdateSize( event_thread_t * );
struct event_thread_t *EventThreadCreate( vlc_object_t *, vlc_window_t *,
const struct vout_display_placement *,
const vout_display_owner_t * );
void EventThreadDestroy( struct event_thread_t * );
HWND EventThreadVideoHWND( const struct event_thread_t * );
void EventThreadUpdateSize( struct event_thread_t * );
......@@ -66,9 +66,6 @@ typedef struct vout_display_sys_t
vlc_gl_t *gl;
vout_display_opengl_t *vgl;
/* Sensors */
void *p_sensors;
} vout_display_sys_t;
static void Prepare(vout_display_t *, picture_t *, subpicture_t *, vlc_tick_t);
......@@ -137,9 +134,6 @@ static int Open(vout_display_t *vd,
goto error;
CommonPlacePicture(vd, &sys->area);
if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR)
sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->area));
vlc_window_SetTitle(vd->cfg->window, VOUT_TITLE " (OpenGL output)");
vout_display_cfg_t embed_cfg = *vd->cfg;
......@@ -200,7 +194,6 @@ static void Close(vout_display_t *vd)
vlc_object_delete(surface);
}
UnhookWindowsSensors(sys->p_sensors);
CommonWindowClean(&sys->area);
free(sys);
......
......@@ -5,6 +5,7 @@
# Direct3D11 video output
d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_scaler.cpp', 'd3d11_shaders.cpp', 'd3d_shaders.c', 'd3d_dynamic_shader.c', 'common.c')
d3d11_link_with = [ d3d11_common_lib ]
d3d11_cargs = []
d3d11_deps = []
if get_option('winstore_app')
d3d11_deps += [
......@@ -14,12 +15,17 @@ if get_option('winstore_app')
else
d3d11_sources += files('d3d11_swapchain.cpp', 'dxgi_swapchain.cpp', 'events.c', 'sensors.cpp', 'win32touch.c')
d3d11_link_with += [ chroma_copy_lib ]
d3d11_cargs += '-DHAVE_WIN32_SENSORS'
d3d11_deps += [
cc.find_library('user32')
]
endif
vlc_modules += {
'name' : 'direct3d11',
'sources' : d3d11_sources,
'link_with' : d3d11_link_with,
'c_args' : d3d11_cargs,
'dependencies' : d3d11_deps
}
......@@ -28,7 +34,10 @@ if have_win_desktop
vlc_modules += {
'name' : 'direct3d9',
'sources' : files('direct3d9.c', 'common.c', 'events.c', 'sensors.cpp', 'win32touch.c'),
'link_with' : [ d3d9_common_lib, chroma_copy_lib ]
'link_with' : [ d3d9_common_lib, chroma_copy_lib ],
'dependencies' : [
cc.find_library('user32')
]
}
# GDI video output
......@@ -36,6 +45,9 @@ if have_win_desktop
'name' : 'wingdi',
'sources' : files('wingdi.c', 'common.c', 'events.c', 'win32touch.c'),
'link_with' : [ chroma_copy_lib ]
'dependencies' : [
cc.find_library('user32')
]
}
opengl32_lib = cc.find_library('opengl32', required: false)
......@@ -47,8 +59,10 @@ if have_win_desktop
files('glwin32.c', 'common.c', 'events.c', 'sensors.cpp', 'win32touch.c'),
opengl_vout_commonsources
],
'c_args' : [ contrib_inc_args ],
'dependencies' : [ gl_common_dep, opengl32_lib ]
'c_args' : [ contrib_inc_args, '-DHAVE_WIN32_SENSORS' ],
'dependencies' : [ gl_common_dep, opengl32_lib,
cc.find_library('user32')
]
}
# WGL
......
......@@ -26,7 +26,7 @@
#endif
#include "events.h"
#include "common.h"
#include "sensors.h"
#include <initguid.h>
#include <wrl/client.h>
......@@ -41,8 +41,8 @@ using Microsoft::WRL::ComPtr;
class SensorReceiver : public ISensorEvents
{
public:
SensorReceiver(vout_display_t *vd, const vlc_viewpoint_t & init_viewpoint)
:vd(vd)
SensorReceiver(const vout_display_owner_t *o, const vlc_viewpoint_t & init_viewpoint)
:owner(*o)
,current_pos(init_viewpoint)
{}
......@@ -128,7 +128,8 @@ public:
old_pos.roll - current_pos.roll,
0.0f
};
vout_display_SendEventViewpointMoved(vd, &vp);
if (owner.viewpoint_moved)
owner.viewpoint_moved(owner.sys, &vp);
return S_OK;
}
......@@ -147,12 +148,12 @@ public:
}
private:
vout_display_t *const vd;
vout_display_owner_t owner;
vlc_viewpoint_t current_pos;
long m_cRef;
};
void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
void *HookWindowsSensors(vlc_logger *vd, const vout_display_owner_t *move, HWND hwnd)
{
ComPtr<ISensorManager> pSensorManager;
HRESULT hr = CoCreateInstance( __uuidof(SensorManager),
......@@ -165,13 +166,13 @@ void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
hr = pSensorManager->GetSensorsByType(SENSOR_TYPE_INCLINOMETER_3D, &pInclinometers);
if (FAILED(hr))
{
msg_Dbg(vd, "inclinometer not found. (hr=0x%lX)", hr);
vlc_debug(vd, "inclinometer not found. (hr=0x%lX)", hr);
return NULL;
}
ULONG count;
pInclinometers->GetCount(&count);
msg_Dbg(vd, "Found %lu inclinometer", count);
vlc_debug(vd, "Found %lu inclinometer", count);
for (ULONG i=0; i<count; ++i)
{
ComPtr<ISensor> pSensor;
......@@ -213,7 +214,7 @@ void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
PropVariantClear(&pvRot);
}
SensorReceiver *received = new(std::nothrow) SensorReceiver(vd, start_viewpoint);
SensorReceiver *received = new(std::nothrow) SensorReceiver(move, start_viewpoint);
if (received)
{
pSensor->SetEventSink(received);
......
/*****************************************************************************
* sensors.h: Windows sensor handling
*****************************************************************************
* Copyright © 2017 Steve Lhomme
* Copyright © 2017 VideoLabs
*
* Authors: Steve Lhomme <robux4@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 VLC_WIN32_COMMON_SENSOR_H
#define VLC_WIN32_COMMON_SENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
void* HookWindowsSensors(struct vlc_logger *, const vout_display_owner_t *, HWND);
void UnhookWindowsSensors(void*);
# ifdef __cplusplus
}
# endif
#endif // VLC_WIN32_COMMON_SENSOR_H
......@@ -31,45 +31,34 @@
#include <assert.h>
static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi );
static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi );
enum {
GESTURE_ACTION_UNDEFINED = 0,
GESTURE_ACTION_VOLUME,
GESTURE_ACTION_JUMP,
GESTURE_ACTION_BRIGHTNESS
};
LRESULT DecodeGesture( vlc_object_t *p_this, win32_gesture_sys_t *p_gesture,
HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
struct win32_gesture_sys_t
{
if( !p_gesture )
return DefWindowProc( hWnd, message, wParam, lParam );
DWORD i_type; /* Gesture ID */
int i_action; /* GESTURE_ACTION */
GESTUREINFO gi;
ZeroMemory( &gi, sizeof( GESTUREINFO ) );
gi.cbSize = sizeof( GESTUREINFO );
int i_beginx; /* Start X position */
int i_beginy; /* Start Y position */
int i_lasty; /* Last known Y position for PAN */
double f_lastzoom; /* Last zoom factor */
BOOL bResult = p_gesture->OurGetGestureInfo((HGESTUREINFO)lParam, &gi);
BOOL bHandled = FALSE; /* Needed to release the handle */
ULONGLONG i_ullArguments; /* Base values to compare between 2 zoom gestures */
bool b_2fingers; /* Did we detect 2 fingers? */
if( bResult )
bHandled = p_gesture->DecodeGestureImpl(p_this, p_gesture, &gi);
else
{
DWORD dwErr = GetLastError();
if( dwErr > 0 )
msg_Err( p_this, "Could not retrieve a valid GESTUREINFO structure" );
}
bool (*DecodeGestureImpl)( vlc_object_t *, struct win32_gesture_sys_t *, const GESTUREINFO* );
};
if( bHandled )
{
/* Close the Handle, if we handled the gesture, a contrario
* from the doc example */
p_gesture->OurCloseGestureInfoHandle((HGESTUREINFO)lParam);
return 0;
}
else
return DefWindowProc( hWnd, message, wParam, lParam );
}
static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi )
static bool DecodeGestureAction( vlc_object_t *p_this, struct win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi )
{
BOOL bHandled = FALSE; /* Needed to release the handle */
bool bHandled = false; /* Needed to release the handle */
switch ( p_gi->dwID )
{
case GID_BEGIN:
......@@ -107,7 +96,7 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
break;
case GID_PAN:
p_gesture->i_type = GID_PAN;
bHandled = TRUE;
bHandled = true;
if (p_gi->dwFlags & GF_BEGIN) {
p_gesture->i_beginx = p_gi->ptsLocation.x;
......@@ -166,7 +155,7 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
case GID_TWOFINGERTAP:
p_gesture->i_type = GID_TWOFINGERTAP;
var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_PLAY_PAUSE );
bHandled = TRUE;
bHandled = true;
break;
case GID_ZOOM:
p_gesture->i_type = GID_ZOOM;
......@@ -190,10 +179,10 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
default:
msg_Err( p_this, "Unmanaged dwFlag: %lx", p_gi->dwFlags );
}
bHandled = TRUE;
bHandled = true;
break;
case WM_VSCROLL:
bHandled = TRUE;
bHandled = true;
break;
default:
break;
......@@ -202,11 +191,11 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
}
static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi )
static bool DecodeGestureProjection( vlc_object_t *p_this, struct win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi )
{
//vout_display_t *vd = (vout_display_t *)p_this;
BOOL bHandled = FALSE; /* Needed to release the handle */
bool bHandled = false; /* Needed to release the handle */
switch ( p_gi->dwID )
{
case GID_BEGIN:
......@@ -238,7 +227,7 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
case GID_PAN:
//vd->cfg->display.width;
p_gesture->i_type = GID_PAN;
bHandled = TRUE;
bHandled = true;
if (p_gi->dwFlags & GF_BEGIN) {
p_gesture->i_beginx = p_gi->ptsLocation.x;
p_gesture->i_beginy = p_gi->ptsLocation.y;
......@@ -277,11 +266,11 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
case GID_TWOFINGERTAP:
p_gesture->i_type = GID_TWOFINGERTAP;
var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_PLAY_PAUSE );
bHandled = TRUE;
bHandled = true;
break;
case GID_ZOOM:
p_gesture->i_type = GID_ZOOM;
bHandled = TRUE;
bHandled = true;
switch( p_gi->dwFlags )
{
case GF_BEGIN:
......@@ -308,7 +297,7 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
}
break;
case WM_VSCROLL:
bHandled = TRUE;
bHandled = true;
break;
default:
break;
......@@ -316,7 +305,37 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
return bHandled;
}
BOOL InitGestures( HWND hwnd, win32_gesture_sys_t **pp_gesture, bool b_isProjected )
bool DecodeGesture( vlc_object_t *p_this, struct win32_gesture_sys_t *p_gesture,
HGESTUREINFO hGestureInfo )
{
if( !p_gesture )
return false;
GESTUREINFO gi;
ZeroMemory( &gi, sizeof( GESTUREINFO ) );
gi.cbSize = sizeof( GESTUREINFO );
if( GetGestureInfo(hGestureInfo, &gi) )
{
if( p_gesture->DecodeGestureImpl(p_this, p_gesture, &gi) )
{
/* Close the Handle, if we handled the gesture, a contrario
* from the doc example */
CloseGestureInfoHandle(hGestureInfo);
return true;
}
}
else
{
DWORD dwErr = GetLastError();
if( dwErr > 0 )
msg_Err( p_this, "Could not retrieve a valid GESTUREINFO structure" );
}
return false;
}
struct win32_gesture_sys_t *InitGestures( HWND hwnd, bool b_isProjected )
{
BOOL result = FALSE;
GESTURECONFIG config = { 0, 0, 0 };
......@@ -337,37 +356,21 @@ BOOL InitGestures( HWND hwnd, win32_gesture_sys_t **pp_gesture, bool b_isProject
config.dwBlock = GC_PAN_WITH_INERTIA;
}
win32_gesture_sys_t *p_gesture = malloc( sizeof(win32_gesture_sys_t) );
if( !p_gesture )
{
*pp_gesture = NULL;
return FALSE;
}
HINSTANCE h_user32_dll = LoadLibrary(TEXT("user32.dll"));
if( !h_user32_dll )
{
*pp_gesture = NULL;
free( p_gesture );
return FALSE;
}
BOOL (WINAPI *OurSetGestureConfig) (HWND, DWORD, UINT, PGESTURECONFIG, UINT);
OurSetGestureConfig = (void *)GetProcAddress(h_user32_dll, "SetGestureConfig");
p_gesture->OurCloseGestureInfoHandle =
(void *)GetProcAddress(h_user32_dll, "CloseGestureInfoHandle" );
p_gesture->OurGetGestureInfo =
(void *)GetProcAddress(h_user32_dll, "GetGestureInfo");
if( OurSetGestureConfig )
struct win32_gesture_sys_t *p_gesture = malloc( sizeof(*p_gesture) );
if( unlikely(!p_gesture) )
return NULL;
result = SetGestureConfig(
hwnd,
0,
1,
&config,
sizeof( GESTURECONFIG )
);
if (result == 0)
{
result = OurSetGestureConfig(
hwnd,
0,
1,
&config,
sizeof( GESTURECONFIG )
);
free(p_gesture);
return NULL;
}
if (b_isProjected)
p_gesture->DecodeGestureImpl = DecodeGestureProjection;
......@@ -379,15 +382,11 @@ BOOL InitGestures( HWND hwnd, win32_gesture_sys_t **pp_gesture, bool b_isProject
p_gesture->i_action = GESTURE_ACTION_UNDEFINED;
p_gesture->i_beginx = p_gesture->i_beginy = -1;
p_gesture->i_lasty = -1;
p_gesture->huser_dll = h_user32_dll;
*pp_gesture = p_gesture;
return result;
return p_gesture;
}
void CloseGestures( win32_gesture_sys_t *p_gesture )
void CloseGestures( struct win32_gesture_sys_t *p_gesture )
{
if (p_gesture && p_gesture->huser_dll )
FreeLibrary( p_gesture->huser_dll );
free( p_gesture );
}
......@@ -41,40 +41,13 @@
extern "C" {
#endif
enum {
GESTURE_ACTION_UNDEFINED = 0,
GESTURE_ACTION_VOLUME,
GESTURE_ACTION_JUMP,
GESTURE_ACTION_BRIGHTNESS
};
struct win32_gesture_sys_t;
struct win32_gesture_sys_t *InitGestures( HWND hwnd, bool b_isProjected );
typedef struct win32_gesture_sys_t {
DWORD i_type; /* Gesture ID */
int i_action; /* GESTURE_ACTION */
bool DecodeGesture( vlc_object_t *, struct win32_gesture_sys_t *, HGESTUREINFO );
int i_beginx; /* Start X position */
int i_beginy; /* Start Y position */
int i_lasty; /* Last known Y position for PAN */
double f_lastzoom; /* Last zoom factor */
ULONGLONG i_ullArguments; /* Base values to compare between 2 zoom gestures */
bool b_2fingers; /* Did we detect 2 fingers? */
BOOL (*DecodeGestureImpl)( vlc_object_t *p_this, struct win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi );
HINSTANCE huser_dll; /* user32.dll */
BOOL (WINAPI * OurCloseGestureInfoHandle)(HGESTUREINFO hGestureInfo);
BOOL (WINAPI * OurGetGestureInfo)(HGESTUREINFO hGestureInfo, PGESTUREINFO pGestureInfo);
} win32_gesture_sys_t;
BOOL InitGestures( HWND hwnd, win32_gesture_sys_t **p_gesture, bool b_isProjected );
LRESULT DecodeGesture( vlc_object_t *p_intf, win32_gesture_sys_t *p_gesture,
HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
void CloseGestures( win32_gesture_sys_t *p_gesture );
void CloseGestures( struct win32_gesture_sys_t * );
#ifdef __cplusplus
}
......