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 (4)
Showing
with 169 additions and 75 deletions
......@@ -49,6 +49,37 @@ enum vlc_gl_api_type {
VLC_OPENGL_ES2,
};
struct vlc_gl_cfg
{
bool need_alpha; /* False by default */
};
typedef int (*vlc_gl_activate)(vlc_gl_t *, unsigned width, unsigned height,
const struct vlc_gl_cfg *cfg);
#define set_callback_opengl_common(activate) \
{ \
vlc_gl_activate activate__ = activate; \
(void) activate__; \
set_callback(activate) \
} \
#define set_callback_opengl(activate, priority) \
set_callback_opengl_common(activate) \
set_capability("opengl", priority)
#define set_callback_opengl_offscreen(activate, priority) \
set_callback_opengl_common(activate) \
set_capability("opengl offscreen", priority)
#define set_callback_opengl_es2(activate, priority) \
set_callback_opengl_common(activate) \
set_capability("opengl es2", priority)
#define set_callback_opengl_es2_offscreen(activate, priority) \
set_callback_opengl_common(activate) \
set_capability("opengl es2 offscreen", priority)
struct vlc_gl_operations
{
union {
......@@ -97,14 +128,17 @@ struct vlc_gl_t
* @param cfg initial configuration (including window to use as OpenGL surface)
* @param flags OpenGL context type
* @param name module name (or NULL for auto)
* @param gl_cfg OpenGL configuration (or NULL for default)
* @return a new context, or NULL on failure
*/
VLC_API vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *cfg,
unsigned flags, const char *name) VLC_USED;
unsigned flags, const char *name,
const struct vlc_gl_cfg *gl_cfg) VLC_USED;
VLC_API vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
struct vlc_decoder_device *device,
unsigned width, unsigned height,
unsigned flags, const char *name);
unsigned flags, const char *name,
const struct vlc_gl_cfg *gl_cfg);
VLC_API void vlc_gl_Delete(vlc_gl_t *);
......@@ -159,7 +193,9 @@ static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
VLC_API vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *,
const struct vlc_window_cfg *,
struct vlc_window **) VLC_USED;
struct vlc_window **,
const struct vlc_gl_cfg *) VLC_USED;
VLC_API bool vlc_gl_surface_CheckSize(vlc_gl_t *, unsigned *w, unsigned *h);
VLC_API void vlc_gl_surface_Destroy(vlc_gl_t *);
......
......@@ -385,8 +385,15 @@ static void Close( vlc_gl_t *gl )
vlc_egl_display_Delete(sys->vlc_display);
}
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
struct vlc_gl_pbuffer *sys = vlc_obj_malloc(&gl->obj, sizeof *sys);
if (sys == NULL)
return VLC_ENOMEM;
......@@ -482,11 +489,9 @@ vlc_module_begin()
set_shortname( N_("egl_pbuffer") )
set_description( N_("EGL PBuffer offscreen opengl provider") )
#ifdef USE_OPENGL_ES2
set_capability( "opengl es2 offscreen", 1)
set_callback_opengl_es2_offscreen( Open, 1 )
#else
set_capability( "opengl offscreen", 1 )
set_callback_opengl_offscreen( Open, 1 )
#endif
add_shortcut( "egl_pbuffer" )
set_callback( Open )
vlc_module_end()
......@@ -327,8 +327,15 @@ error:
return VLC_EGENERIC;
}
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
if (gl->device == NULL || gl->device->type != VLC_DECODER_DEVICE_AWINDOW)
{
msg_Err(gl, "Wrong decoder device");
......@@ -434,8 +441,7 @@ error1:
vlc_module_begin()
set_shortname( N_("egl_surfacetexture") )
set_description( N_("EGL Android SurfaceTexture offscreen opengl provider") )
set_capability( "opengl es2 offscreen", 100)
set_callback_opengl_es2_offscreen(Open, 100)
add_shortcut( "egl_surfacetexture" )
set_callback( Open )
vlc_module_end()
......@@ -183,7 +183,7 @@ static int Open( vlc_object_t *obj )
struct vlc_decoder_device *device = filter_HoldDecoderDevice(filter);
sys->gl = vlc_gl_CreateOffscreen(obj, device, width, height, VLCGLAPI,
NULL);
NULL, NULL);
/* The vlc_gl_t instance must have hold the device if it needs it. */
if (device)
......
......@@ -606,7 +606,7 @@ static void ClearSurface(vout_display_t *vd)
{
/* Clear the surface to black with OpenGL ES 2 */
char *modlist = var_InheritString(sys->embed, "gles2");
vlc_gl_t *gl = vlc_gl_Create(vd->cfg, VLC_OPENGL_ES2, modlist);
vlc_gl_t *gl = vlc_gl_Create(vd->cfg, VLC_OPENGL_ES2, modlist, NULL);
free(modlist);
if (gl == NULL)
return;
......
......@@ -506,8 +506,15 @@ static void FreeCVBuffer(picture_t *picture)
@end
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
VLCCVOpenGLProvider *sys = [[VLCCVOpenGLProvider alloc] initWithGL:gl width:width height:height];
if (sys == nil)
return VLC_EGENERIC;;
......@@ -521,10 +528,9 @@ vlc_module_begin()
set_shortname( N_("cvpx_gl") )
set_description( N_("OpenGL backed by CVPixelBuffer") )
#if TARGET_OS_IPHONE
set_capability( "opengl es2 offscreen", 100 )
set_callback_opengl_es2_offscreen( Open, 100 )
#else
set_capability( "opengl offscreen", 100 )
set_callback_opengl_offscreen( Open, 100 )
#endif
add_shortcut( "cvpx_gl" )
set_callback( Open)
vlc_module_end()
......@@ -490,10 +490,17 @@ static void Close(vlc_gl_t *gl)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
vlc_window_t *wnd = gl->surface;
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
/* We only support UIView container window. */
if (wnd->type != VLC_WINDOW_TYPE_NSOBJECT)
return VLC_EGENERIC;
......@@ -521,7 +528,6 @@ vlc_module_begin ()
set_shortname (N_("CAEAGL"))
set_description (N_("CAEAGL provider for OpenGL"))
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("opengl es2", 50)
set_callback(Open)
set_callback_opengl_es2 (Open, 50)
add_shortcut ("caeagl")
vlc_module_end ()
......@@ -152,10 +152,17 @@ static void Close(vlc_gl_t *gl)
free(sys);
}
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
vlc_object_t *obj = VLC_OBJECT(gl);
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
if (gl->surface->type != VLC_WINDOW_TYPE_XID || !vlc_xlib_init (obj))
return VLC_EGENERIC;
......@@ -317,6 +324,5 @@ vlc_module_begin ()
set_shortname (N_("GLX"))
set_description (N_("GLX extension for OpenGL"))
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("opengl", 20)
set_callback(Open)
set_callback_opengl(Open, 20)
vlc_module_end ()
......@@ -105,7 +105,7 @@ static int InitInstance(vlc_placebo_t *pl, const vout_display_cfg_t *cfg)
bool current = false;
char *name = var_InheritString(pl, MODULE_VARNAME);
sys->gl = vlc_gl_Create(cfg, API, name);
sys->gl = vlc_gl_Create(cfg, API, name, NULL);
free(name);
if (!sys->gl || vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
goto error;
......
......@@ -186,7 +186,7 @@ static int Open(vout_display_t *vd,
}
#endif
sys->gl = vlc_gl_Create(vd->cfg, API, gl_name);
sys->gl = vlc_gl_Create(vd->cfg, API, gl_name, NULL);
free(gl_name);
if (sys->gl == NULL)
goto error;
......
......@@ -597,7 +597,8 @@ static void InitEGL(void)
* Probe EGL display availability
*/
static int Open(vlc_gl_t *gl, const struct gl_api *api,
unsigned width, unsigned height)
unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
InitEGL();
......@@ -644,6 +645,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 5,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, gl_cfg->need_alpha ? 5 : 0,
EGL_RENDERABLE_TYPE, api->render_bit,
EGL_NONE
};
......@@ -699,22 +701,24 @@ error:
return ret;
}
static int OpenGLES2(vlc_gl_t *gl, unsigned width, unsigned height)
static int OpenGLES2(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
static const struct gl_api api = {
"OpenGL_ES", EGL_OPENGL_ES_API, 4, EGL_OPENGL_ES2_BIT,
{ EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE },
};
return Open(gl, &api, width, height);
return Open(gl, &api, width, height, gl_cfg);
}
static int OpenGL(vlc_gl_t *gl, unsigned width, unsigned height)
static int OpenGL(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
static const struct gl_api api = {
"OpenGL", EGL_OPENGL_API, 4, EGL_OPENGL_BIT,
{ EGL_NONE },
};
return Open(gl, &api, width, height);
return Open(gl, &api, width, height, gl_cfg);
}
#ifdef USE_PLATFORM_XCB
......@@ -728,13 +732,11 @@ vlc_module_begin ()
set_shortname (N_("EGL"))
set_description (N_("EGL extension for OpenGL"))
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability("opengl", VLC_PRIORITY)
set_callback(OpenGL)
set_callback_opengl(OpenGL, VLC_PRIORITY)
add_shortcut ("egl")
add_submodule ()
set_capability("opengl es2", VLC_PRIORITY)
set_callback(OpenGLES2)
set_callback_opengl_es2(OpenGLES2, VLC_PRIORITY)
add_shortcut ("egl")
vlc_module_end ()
......@@ -122,7 +122,8 @@ static void Close(vlc_gl_t *gl)
} \
} while( 0 )
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
vout_display_sys_t * sys;
......@@ -131,6 +132,12 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
engineType != libvlc_video_engine_gles2 )
return VLC_ENOTSUP;
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
/* Allocate structure */
gl->sys = sys = vlc_obj_calloc(VLC_OBJECT(gl), 1, sizeof(*sys));
if( !sys )
......@@ -181,12 +188,11 @@ vlc_module_begin()
set_description("GL texture output")
set_subcategory(SUBCAT_VIDEO_VOUT)
set_capability("opengl", 0)
set_callback(Open)
set_callback_opengl(Open, 0)
add_shortcut("vglmem")
add_submodule()
set_capability("opengl es2", 0)
set_callback(Open)
set_callback_opengl_es2(Open, 0)
add_shortcut("vglmem")
vlc_module_end()
......@@ -148,7 +148,7 @@ static int Open(vout_display_t *vd,
goto error;
char *modlist = var_InheritString(embed_cfg.window, "gl");
sys->gl = vlc_gl_Create(&embed_cfg, VLC_OPENGL, modlist);
sys->gl = vlc_gl_Create(&embed_cfg, VLC_OPENGL, modlist, NULL);
free(modlist);
if (!sys->gl)
{
......
......@@ -35,7 +35,8 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int Open(vlc_gl_t *, unsigned width, unsigned height);
static int Open(vlc_gl_t *, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg);
static void Close(vlc_gl_t *);
#define HW_GPU_AFFINITY_TEXT N_("GPU affinity")
......@@ -47,8 +48,7 @@ vlc_module_begin()
add_integer("gpu-affinity", -1, HW_GPU_AFFINITY_TEXT, NULL)
set_capability("opengl", 50)
set_callback(Open)
set_callback_opengl(Open, 50)
add_shortcut("wgl")
vlc_module_end()
......@@ -149,10 +149,17 @@ static void DestroyGPUAffinityDC(vlc_gl_t *gl) {
fncDeleteDCNV(sys->affinityHDC);
}
static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *gl_cfg)
{
vout_display_sys_t *sys;
if (gl_cfg->need_alpha)
{
msg_Err(gl, "Cannot support alpha yet");
return VLC_ENOTSUP;
}
/* Allocate structure */
gl->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
......
......@@ -199,7 +199,7 @@ static int Open(vlc_object_t * p_this)
.height = var_InheritInteger(p_filter, "glspectrum-height"),
};
p_sys->gl = vlc_gl_surface_Create(p_this, &cfg, NULL);
p_sys->gl = vlc_gl_surface_Create(p_this, &cfg, NULL, NULL);
if (p_sys->gl == NULL)
return VLC_EGENERIC;
......
......@@ -190,7 +190,7 @@ static int Open( vlc_object_t * p_this )
cfg.width = var_CreateGetInteger( p_filter, "projectm-width" );
cfg.height = var_CreateGetInteger( p_filter, "projectm-height" );
p_sys->gl = vlc_gl_surface_Create( VLC_OBJECT(p_filter), &cfg, NULL );
p_sys->gl = vlc_gl_surface_Create( VLC_OBJECT(p_filter), &cfg, NULL, NULL );
if( p_sys->gl == NULL )
goto error;
......
......@@ -134,7 +134,7 @@ static int Open( vlc_object_t * p_this )
cfg.width = var_InheritInteger( p_filter, "vsxu-width" );
cfg.height = var_InheritInteger( p_filter, "vsxu-height" );
p_sys->gl = vlc_gl_surface_Create( VLC_OBJECT(p_filter), &cfg, NULL );
p_sys->gl = vlc_gl_surface_Create( VLC_OBJECT(p_filter), &cfg, NULL, NULL);
if( p_sys->gl == NULL )
goto error;
......
......@@ -33,6 +33,10 @@
#include "libvlc.h"
#include <vlc_modules.h>
static const struct vlc_gl_cfg gl_cfg_default = {
.need_alpha = false
};
struct vlc_gl_priv_t
{
vlc_gl_t gl;
......@@ -40,12 +44,13 @@ struct vlc_gl_priv_t
static int vlc_gl_start(void *func, bool forced, va_list ap)
{
int (*activate)(vlc_gl_t *, unsigned, unsigned) = func;
vlc_gl_activate activate = func;
vlc_gl_t *gl = va_arg(ap, vlc_gl_t *);
unsigned width = va_arg(ap, unsigned);
unsigned height = va_arg(ap, unsigned);
const struct vlc_gl_cfg *gl_cfg = va_arg(ap, const struct vlc_gl_cfg *);
int ret = activate(gl, width, height);
int ret = activate(gl, width, height, gl_cfg);
if (ret)
vlc_objres_clear(VLC_OBJECT(gl));
(void) forced;
......@@ -53,11 +58,14 @@ static int vlc_gl_start(void *func, bool forced, va_list ap)
}
vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
unsigned flags, const char *name)
unsigned flags, const char *name,
const struct vlc_gl_cfg * gl_cfg)
{
vlc_window_t *wnd = cfg->window;
struct vlc_gl_priv_t *glpriv;
const char *type;
if (gl_cfg == NULL)
gl_cfg = &gl_cfg_default;
enum vlc_gl_api_type api_type;
......@@ -85,7 +93,8 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
gl->device = NULL;
gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl,
cfg->display.width, cfg->display.height);
cfg->display.width, cfg->display.height,
gl_cfg);
if (gl->module == NULL)
{
vlc_object_delete(gl);
......@@ -104,12 +113,15 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
struct vlc_decoder_device *device,
unsigned width, unsigned height,
unsigned flags, const char *name)
unsigned flags, const char *name,
const struct vlc_gl_cfg *gl_cfg)
{
struct vlc_gl_priv_t *glpriv;
const char *type;
enum vlc_gl_api_type api_type;
if (gl_cfg == NULL)
gl_cfg = &gl_cfg_default;
switch (flags /*& VLC_OPENGL_API_MASK*/)
{
......@@ -140,7 +152,7 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
gl->surface = NULL;
gl->device = device ? vlc_decoder_device_Hold(device) : NULL;
gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl, width,
height);
height, gl_cfg);
if (gl->module == NULL)
{
vlc_object_delete(gl);
......@@ -199,7 +211,8 @@ static void vlc_gl_surface_ResizeNotify(vlc_window_t *surface,
vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
const vlc_window_cfg_t *cfg,
struct vlc_window **restrict wp)
struct vlc_window **restrict wp,
const struct vlc_gl_cfg *gl_cfg)
{
vlc_gl_surface_t *sys = malloc(sizeof (*sys));
if (unlikely(sys == NULL))
......@@ -244,7 +257,7 @@ vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
}
vlc_mutex_unlock(&sys->lock);
vlc_gl_t *gl = vlc_gl_Create(&dcfg, VLC_OPENGL, NULL);
vlc_gl_t *gl = vlc_gl_Create(&dcfg, VLC_OPENGL, NULL, gl_cfg);
if (gl == NULL) {
vlc_window_Disable(surface);
vlc_window_Delete(surface);
......
......@@ -122,9 +122,10 @@ static void OpenGLClose(vlc_gl_t *gl)
static int
OpenOpenGLCommon(
vlc_gl_t *gl, unsigned width, unsigned height,
bool offscreen, enum vlc_gl_api_type api_type)
bool offscreen, enum vlc_gl_api_type api_type,
const struct vlc_gl_cfg *cfg)
{
(void)width; (void)height;
(void)width; (void)height; (void) cfg;
assert(gl->api_type == api_type);
static const struct vlc_gl_operations onscreen_ops =
......@@ -152,20 +153,24 @@ OpenOpenGLCommon(
}
static int
OpenOpenGL(vlc_gl_t *gl, unsigned width, unsigned height)
{ return OpenOpenGLCommon(gl, width, height, false, VLC_OPENGL); };
OpenOpenGL(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *cfg)
{ return OpenOpenGLCommon(gl, width, height, false, VLC_OPENGL, cfg); };
static int
OpenOpenGLES(vlc_gl_t *gl, unsigned width, unsigned height)
{ return OpenOpenGLCommon(gl, width, height, false, VLC_OPENGL_ES2); };
OpenOpenGLES(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *cfg)
{ return OpenOpenGLCommon(gl, width, height, false, VLC_OPENGL_ES2, cfg); };
static int
OpenOpenGLOffscreen(vlc_gl_t *gl, unsigned width, unsigned height)
{ return OpenOpenGLCommon(gl, width, height, true, VLC_OPENGL); };
OpenOpenGLOffscreen(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *cfg)
{ return OpenOpenGLCommon(gl, width, height, true, VLC_OPENGL, cfg); };
static int
OpenOpenGLESOffscreen(vlc_gl_t *gl, unsigned width, unsigned height)
{ return OpenOpenGLCommon(gl, width, height, true, VLC_OPENGL_ES2); };
OpenOpenGLESOffscreen(vlc_gl_t *gl, unsigned width, unsigned height,
const struct vlc_gl_cfg *cfg)
{ return OpenOpenGLCommon(gl, width, height, true, VLC_OPENGL_ES2, cfg); };
/**
* Inject the mocked modules as a static plugin:
......@@ -182,20 +187,16 @@ vlc_module_begin()
set_capability("vout window", 1)
add_submodule()
set_callback(OpenOpenGL)
set_capability("opengl", 1)
set_callback_opengl(OpenOpenGL, 1)
add_submodule()
set_callback(OpenOpenGLES)
set_capability("opengl es2", 1)
set_callback_opengl_es2(OpenOpenGLES, 1)
add_submodule()
set_callback(OpenOpenGLOffscreen)
set_capability("opengl offscreen", 1)
set_callback_opengl_offscreen(OpenOpenGLOffscreen, 1)
add_submodule()
set_callback(OpenOpenGLESOffscreen)
set_capability("opengl es2 offscreen", 1)
set_callback_opengl_es2_offscreen(OpenOpenGLESOffscreen, 1)
vlc_module_end()
VLC_EXPORT vlc_plugin_cb vlc_static_modules[] = {
......@@ -210,7 +211,7 @@ static void test_opengl_offscreen(vlc_object_t *root, enum vlc_gl_api_type api_t
assert(device != NULL);
vlc_gl_t *gl = vlc_gl_CreateOffscreen(
root, device, 800, 600, api_type, MODULE_STRING);
root, device, 800, 600, api_type, MODULE_STRING, NULL);
assert(gl != NULL);
vlc_decoder_device_Release(device);
......@@ -237,7 +238,7 @@ static void test_opengl(vlc_object_t *root, enum vlc_gl_api_type api_type)
.display.width = wnd_cfg.width,
.display.height = wnd_cfg.height,
};
vlc_gl_t *gl = vlc_gl_Create(&cfg, api_type, MODULE_STRING);
vlc_gl_t *gl = vlc_gl_Create(&cfg, api_type, MODULE_STRING, NULL);
assert(gl != NULL);
assert(vlc_gl_MakeCurrent(gl) == VLC_SUCCESS);
......