voutdir = $(pluginsdir)/video_output

noinst_LTLIBRARIES =
vout_LTLIBRARIES =

SOURCES_aa = aa.c
SOURCES_fb = fb.c
SOURCES_vout_sdl = sdl.c
SOURCES_directfb = directfb.c
SOURCES_vmem = vmem.c
SOURCES_yuv = yuv.c
SOURCES_android_surface = android/surface.c android/utils.c
SOURCES_android_opaque = android/opaque.c

if HAVE_DECKLINK
libdecklinkoutput_plugin_la_SOURCES = decklink.cpp
libdecklinkoutput_plugin_la_CXXFLAGS = $(AM_CFLAGS) $(CPPFLAGS_decklinkoutput)
libdecklinkoutput_plugin_la_LIBADD = $(LIBS_decklink) $(LIBDL)
vout_LTLIBRARIES += libdecklinkoutput_plugin.la
endif

if HAVE_OSX
libvout_macosx_plugin_la_SOURCES = macosx.m opengl.c opengl.h
libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
libvout_macosx_plugin_la_LIBADD = $(GL_LIBS)
libvout_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGL,-framework,Cocoa

libcaopengllayer_plugin_la_SOURCES = caopengllayer.m opengl.c opengl.h
libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
libcaopengllayer_plugin_la_LIBADD = $(GL_LIBS)
libcaopengllayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGL,-framework,Cocoa,-framework,QuartzCore
vout_LTLIBRARIES += libvout_macosx_plugin.la libcaopengllayer_plugin.la
endif

libvout_ios2_plugin_la_SOURCES = ios2.m opengl.h opengl.c
libvout_ios2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
libvout_ios2_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) $(GL_OBJCFLAGS)
libvout_ios2_plugin_la_LIBADD = $(AM_LIBADD) $(GL_LIBS)
libvout_ios2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit
if HAVE_IOS
vout_LTLIBRARIES += libvout_ios2_plugin.la
endif

### OpenGL ###
# TODO: merge all three source files (?)
libgles2_plugin_la_SOURCES = opengl.c opengl.h gl.c
libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES=2
libgles2_plugin_la_LIBADD = $(GLES2_LIBS)
libgles2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'

libgles1_plugin_la_SOURCES = opengl.c opengl.h gl.c
libgles1_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES1_CFLAGS) -DUSE_OPENGL_ES=1
libgles1_plugin_la_LIBADD = $(GLES1_LIBS)
libgles1_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'

EXTRA_LTLIBRARIES += libgles2_plugin.la libgles1_plugin.la
vout_LTLIBRARIES += $(LTLIBgles2) $(LTLIBgles1)

libgl_plugin_la_SOURCES = opengl.c opengl.h gl.c
libgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
libgl_plugin_la_LIBADD = $(GL_LIBS)
if HAVE_GL
vout_LTLIBRARIES += libgl_plugin.la
endif


### XCB ###
libvlc_xcb_events_la_SOURCES = xcb/events.c xcb/events.h
libvlc_xcb_events_la_CPPFLAGS = -DMODULE_STRING=\"xcb\"
libvlc_xcb_events_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS)
libvlc_xcb_events_la_LDFLAGS = -static
libvlc_xcb_events_la_LIBADD = $(XCB_LIBS)

libxcb_x11_plugin_la_SOURCES = \
	xcb/pictures.c xcb/pictures.h \
	xcb/x11.c
libxcb_x11_plugin_la_CFLAGS = $(AM_CFLAGS) \
	$(XCB_CFLAGS) $(XCB_SHM_CFLAGS)
libxcb_x11_plugin_la_LIBADD = libvlc_xcb_events.la \
	$(XCB_LIBS) $(XCB_SHM_LIBS)

libxcb_xv_plugin_la_SOURCES = \
	xcb/pictures.c xcb/pictures.h \
	xcb/xvideo.c
libxcb_xv_plugin_la_CFLAGS = $(AM_CFLAGS) \
	$(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_XV_CFLAGS)
libxcb_xv_plugin_la_LIBADD = libvlc_xcb_events.la \
	$(XCB_LIBS) $(XCB_SHM_LIBS) $(XCB_XV_LIBS)

libxcb_glx_plugin_la_SOURCES = \
	opengl.c opengl.h \
	xcb/glx.c
libxcb_glx_plugin_la_CFLAGS = $(AM_CFLAGS) \
	$(XCB_CFLAGS) $(GL_CFLAGS)
libxcb_glx_plugin_la_LIBADD = libvlc_xcb_events.la \
	$(XCB_LIBS) $(GL_LIBS)

libxcb_window_plugin_la_SOURCES = xcb/window.c xcb/keys.c xcb/keysym.h xcb/xcb_keysym.h
libxcb_window_plugin_la_CFLAGS = $(AM_CFLAGS) \
	$(CFLAGS_xcb_window) \
	$(XPROTO_CFLAGS) $(XCB_CFLAGS) $(XCB_KEYSYMS_CFLAGS)
libxcb_window_plugin_la_LIBADD = $(XPROTO_LIBS) $(XCB_LIBS) $(XCB_KEYSYMS_LIBS)

libegl_x11_plugin_la_SOURCES = egl.c
libegl_x11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_X11=1
libegl_x11_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS)
libegl_x11_plugin_la_LIBADD = $(EGL_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11

libglx_plugin_la_SOURCES = glx.c
libglx_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
libglx_plugin_la_LIBADD = $(GL_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11

if HAVE_XCB
noinst_LTLIBRARIES += libvlc_xcb_events.la
vout_LTLIBRARIES += libxcb_x11_plugin.la libxcb_window_plugin.la
if HAVE_XCB_KEYSYMS
libxcb_window_plugin_la_CFLAGS += -DHAVE_XCB_KEYSYMS
endif
if HAVE_XCB_XVIDEO
vout_LTLIBRARIES += libxcb_xv_plugin.la
endif
if HAVE_EGL
vout_LTLIBRARIES += libegl_x11_plugin.la
endif
if HAVE_GL
vout_LTLIBRARIES += libxcb_glx_plugin.la libglx_plugin.la
endif
endif


### Win32 ###
libdirect2d_plugin_la_SOURCES = msw/direct2d.c \
	msw/common.c msw/common.h msw/events.c msw/events.h \
	msw/win32touch.c msw/win32touch.h
libdirect2d_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
	-DMODULE_NAME_IS_direct2d
libdirect2d_plugin_la_LIBADD = -lgdi32 -lole32 -luuid
libdirect2d_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
vout_LTLIBRARIES += $(LTLIBdirect2d)
EXTRA_LTLIBRARIES += libdirect2d_plugin.la

libdirect3d_plugin_la_SOURCES = msw/direct3d.c \
	msw/common.c msw/common.h msw/events.c msw/events.h msw/builtin_shaders.h \
	msw/win32touch.c msw/win32touch.h
libdirect3d_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
	-DMODULE_NAME_IS_direct3d
libdirect3d_plugin_la_LIBADD = -lgdi32 -lole32 -luuid
libdirect3d_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
vout_LTLIBRARIES += $(LTLIBdirect3d)
EXTRA_LTLIBRARIES += libdirect3d_plugin.la

libdirectdraw_plugin_la_SOURCES = msw/directx.c \
	msw/common.c msw/common.h msw/events.c msw/events.h \
	msw/win32touch.c msw/win32touch.h
libdirectdraw_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
	-DMODULE_NAME_IS_directdraw
libdirectdraw_plugin_la_LIBADD = -luser32 -lgdi32 -lole32 -luuid
if HAVE_DIRECTX
vout_LTLIBRARIES += libdirectdraw_plugin.la
endif

libglwin32_plugin_la_SOURCES = msw/glwin32.c opengl.c opengl.h \
	msw/common.c msw/common.h msw/events.c msw/events.h \
	msw/win32touch.c msw/win32touch.h
libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
	-DMODULE_NAME_IS_glwin32
libglwin32_plugin_la_LIBADD = -lopengl32 -lgdi32 -lole32 -luuid
libglwin32_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
vout_LTLIBRARIES += $(LTLIBglwin32)
EXTRA_LTLIBRARIES += libglwin32_plugin.la

libwingdi_plugin_la_SOURCES = msw/wingdi.c \
	msw/common.c msw/common.h msw/events.c msw/events.h \
	msw/win32touch.c msw/win32touch.h
libwingdi_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
	-DMODULE_NAME_IS_wingdi
libwingdi_plugin_la_LIBADD = -lgdi32 -lole32 -luuid
if HAVE_WIN32
vout_LTLIBRARIES += libwingdi_plugin.la
endif

libegl_win32_plugin_la_SOURCES = egl.c
libegl_win32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WIN32=1
libegl_win32_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS)
libegl_win32_plugin_la_LIBADD = $(EGL_LIBS)
if HAVE_WIN32
if HAVE_EGL
vout_LTLIBRARIES += libegl_win32_plugin.la
endif
endif

libdrawable_plugin_la_SOURCES = drawable.c
if HAVE_WIN32
vout_LTLIBRARIES += libdrawable_plugin.la
endif

### OS/2 ###
if HAVE_OS2
vout_LTLIBRARIES += libdrawable_plugin.la
endif

libkva_plugin_la_SOURCES = kva.c
libkva_plugin_la_LIBADD = $(KVA_LIBS)
if HAVE_KVA
vout_LTLIBRARIES += libkva_plugin.la
endif

### Android ###

libegl_android_plugin_la_SOURCES = egl.c
libegl_android_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_PLATFORM_ANDROID=1
libegl_android_plugin_la_LIBADD = $(EGL_LIBS)

libandroid_native_window_plugin_la_SOURCES = android/nativewindow.c android/utils.c
libandroid_native_window_plugin_la_CFLAGS = $(AM_CFLAGS)
libandroid_native_window_plugin_la_LIBADD = -ldl

if HAVE_ANDROID
vout_LTLIBRARIES += libandroid_native_window_plugin.la
if HAVE_EGL
vout_LTLIBRARIES += libegl_android_plugin.la
endif
endif

### Coloured ASCII art ###
libcaca_plugin_la_SOURCES = caca.c
libcaca_plugin_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS)
libcaca_plugin_la_LIBADD = $(CACA_LIBS)
if !HAVE_WIN32
if !HAVE_DARWIN
libcaca_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIBS) -lX11
endif
endif
libcaca_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
EXTRA_LTLIBRARIES += libcaca_plugin.la
vout_LTLIBRARIES += $(LTLIBcaca)

### MMAL ###
libmmal_vout_plugin_la_SOURCES = mmal.c
libmmal_vout_plugin_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS_mmal_vout)
libmmal_vout_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' $(LDFLAGS_mmal_vout) -lm
libmmal_vout_plugin_la_LIBADD = $(LIBS_mmal_vout)
EXTRA_LTLIBRARIES += libmmal_vout_plugin.la
vout_LTLIBRARIES += $(LTLIBmmal_vout)

### Common ###
libvdummy_plugin_la_SOURCES = vdummy.c

vout_LTLIBRARIES += \
	libvdummy_plugin.la \
	libvmem_plugin.la \
	libyuv_plugin.la
