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 (10)
  • Alexandre Janniaux's avatar
    opengl: expose orientation instead of vflip · a64afdae
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Like in the D3D11 implementation, any OpenGL implementation and
    especially those coming from the user might ask a specific rendering
    orientation to remove the need to rotate the image after it has been
    done by the renderer.
    
    In particular, the libvlc output callback allows any orientation to be
    supplied by the user, but was currently ignored in release and was
    asserting in debug because it didn't support that.
    
    This commit changes the definition and usage of the opengl (offscreen)
    providers to expose a format instead. It is now also exposed for
    on-screen implementations also.
    a64afdae
  • Alexandre Janniaux's avatar
    viewpoint: add vlc_viewpoint_from_orientation · 65f7d23b
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Add a function to initialize the viewpoint from the given orientation,
    allowing to transform it into a 4x4 orientation matrix afterwards.
    65f7d23b
  • Alexandre Janniaux's avatar
    vlc_opengl_filter: add orientation to filter meta · a7ad2897
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    The orientation represent a property of the display, ie. how the display
    has been rotated and flipped. Forwarding this property to the filters
    will allow them to rotate the frames in the opposite direction to ensure
    the rendering intent is respected in the end.
    a7ad2897
  • Alexandre Janniaux's avatar
    opengl: filters: forward orientation from gl · 679e734e
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Copy the surface orientation property from the vlc_gl_t provider and
    store it inside the opengl filters object at initialization. The
    parameter is then forwarded only for the last filter into the rendering
    metadatas, allowing this filter to enforce the final rendering of the
    frame with the correct orientation.
    679e734e
  • Alexandre Janniaux's avatar
    opengl: display: handle surface orientation · 92424de6
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Refactor the picture place function into a separate function, and
    manipulate the format when the orientation is different from
    ORIENT_NORMAL to place the picture correctly.
    92424de6
  • Alexandre Janniaux's avatar
    opengl: renderer: handle orientation in shader · ec5dcb2c
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Use the orientation parameter from the rendering metadatas to generate
    an orientation matrix and supply it to the shader. The orientation will
    be applied after everything.
    ec5dcb2c
  • Alexandre Janniaux's avatar
    vgl: forward orientation to vlc_gl_t · c3bdc43d
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Now that the whole OpenGL pipeline supports orientation, we can accept
    orientation direction that are not ORIENT_NORMAL, making the assertion
    obsolete.
    c3bdc43d
  • Alexandre Janniaux's avatar
    vgl: provide sane defaults as configuration · 15e0923f
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    Provide a sane configuration by default, in particular so that it
    doesn't assert when the vgl update callback is failing.
    15e0923f
  • Alexandre Janniaux's avatar
    vgl: handle updateCb() failure during Open() · 6cdf61b6
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    When updateCb() fails, the result was ignored and vgl continued to
    Open() as normal in release mode, and was even asserting on debug
    before.
    
    This split the Resize() function (which cannot return errors) into
    a different ResizeInternal() function with an error return value, to be
    called from the Open() instead of the .resize() callback.
    6cdf61b6
  • Alexandre Janniaux's avatar
    video_filter: opengl: early exit · 1d17c9b5
    Alexandre Janniaux authored and Steve Lhomme's avatar Steve Lhomme committed
    1d17c9b5
Showing
with 162 additions and 39 deletions
......@@ -211,6 +211,9 @@ typedef enum video_orientation_t
/** Applies 180 degree rotation to an orientation */
#define ORIENT_ROTATE_180(orient) ((orient) ^ 3)
VLC_API void
vlc_viewpoint_from_orientation(vlc_viewpoint_t *vp, video_orientation_t orient);
typedef enum video_transform_t
{
TRANSFORM_IDENTITY = ORIENT_NORMAL,
......
......@@ -24,6 +24,8 @@
#ifndef VLC_GL_H
#define VLC_GL_H 1
#include <vlc_es.h>
# ifdef __cplusplus
extern "C" {
# endif
......@@ -108,12 +110,13 @@ struct vlc_gl_t
struct { /* off-screen */
vlc_fourcc_t offscreen_chroma_out;
struct vlc_video_context *offscreen_vctx_out;
/* Flag to indicate if the OpenGL implementation produces upside-down
* pictures */
bool offscreen_vflip;
};
};
/* Orientation that signals how the content should be generated by
* the client of the OpenGL provider. */
video_orientation_t orientation;
/* Defined by the core for libvlc_opengl API loading. */
enum vlc_gl_api_type api_type;
......
......@@ -45,6 +45,7 @@ struct vlc_gl_input_meta {
vlc_tick_t pts;
unsigned plane;
const vlc_video_dovi_metadata_t *dovi_rpu;
video_orientation_t orientation;
};
typedef int
......
......@@ -437,7 +437,7 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
.close = Close,
};
gl->ops = &gl_ops;
gl->offscreen_vflip = true;
gl->orientation = ORIENT_VFLIPPED;
eglMakeCurrent(sys->display, sys->surface, sys->surface,
sys->context);
......
......@@ -127,20 +127,20 @@ LoadFilters(filter_sys_t *sys, const char *glfilters_config)
next_module = leftover;
string = next_module; /* const view of next_module */
if (name)
{
struct vlc_gl_filter *filter =
vlc_gl_filters_Append(filters, name, config);
config_ChainDestroy(config);
if (!filter)
{
msg_Err(sys->gl, "Could not load GL filter: %s", name);
free(name);
return VLC_EGENERIC;
}
if (name == NULL)
continue;
struct vlc_gl_filter *filter =
vlc_gl_filters_Append(filters, name, config);
config_ChainDestroy(config);
if (!filter)
{
msg_Err(sys->gl, "Could not load GL filter: %s", name);
free(name);
return VLC_EGENERIC;
}
free(name);
} while (string);
return VLC_SUCCESS;
......@@ -229,7 +229,7 @@ static int Open( vlc_object_t *obj )
}
sys->filters = vlc_gl_filters_New(sys->gl, api, sys->interop);
sys->filters = vlc_gl_filters_New(sys->gl, api, sys->interop, ORIENT_NORMAL);
if (!sys->filters)
{
msg_Err(obj, "Could not create filters");
......@@ -248,7 +248,7 @@ static int Open( vlc_object_t *obj )
}
free(glfilters_config);
if (sys->gl->offscreen_vflip)
if (sys->gl->orientation == ORIENT_VFLIPPED)
{
/* OpenGL renders upside-down, add a filter to get the pixels in the
* normal orientation */
......
......@@ -355,7 +355,7 @@ static void FreeCVBuffer(picture_t *picture)
.close = Close,
};
gl->ops = &gl_ops;
gl->offscreen_vflip = true;
gl->orientation = ORIENT_VFLIPPED;
gl->offscreen_vctx_out = _vctx_out;
gl->offscreen_chroma_out = VLC_CODEC_CVPX_BGRA;
......
......@@ -146,6 +146,42 @@ FlipVerticalAlign(struct vout_display_placement *dp)
dp->align.vertical = VLC_VIDEO_ALIGN_TOP;
}
static void PlacePicture(vout_display_t *vd, vout_display_place_t *place,
struct vout_display_placement dp)
{
vout_display_sys_t *sys = vd->sys;
/* Copy the initial source, sine we might rotate it to fake a rotated
* display also. */
video_format_t source;
video_format_Init(&source, 0);
video_format_Copy(&source, vd->source);
video_transform_t transform = (video_transform_t)sys->gl->orientation;
video_format_TransformBy(&source, transform_Inverse(transform));
if (ORIENT_IS_SWAP(transform)) {
unsigned width = dp.width;
dp.width = dp.height;
dp.height = width;
}
FlipVerticalAlign(&dp);
vout_display_PlacePicture(place, &source, &dp);
if (ORIENT_IS_SWAP(transform))
{
*place = (vout_display_place_t){
.x = place->y,
.y = place->x,
.width = place->height,
.height = place->width,
};
}
sys->place_changed = true;
}
/**
* Allocates a surface and an OpenGL context for video output.
*/
......@@ -190,10 +226,10 @@ static int Open(vout_display_t *vd,
free(gl_name);
if (sys->gl == NULL)
goto error;
vd->sys = sys;
struct vout_display_placement flipped_dp = vd->cfg->display;
FlipVerticalAlign(&flipped_dp);
vout_display_PlacePicture(&sys->place, vd->source, &flipped_dp);
struct vout_display_placement dp = vd->cfg->display;
PlacePicture(vd, &sys->place, dp);
sys->place_changed = true;
vlc_gl_Resize (sys->gl, vd->cfg->display.width, vd->cfg->display.height);
......@@ -219,7 +255,6 @@ static int Open(vout_display_t *vd,
vlc_viewpoint_init(&sys->viewpoint);
vd->sys = sys;
vd->info.subpicture_chromas = spu_chromas;
vd->ops = &ops;
return VLC_SUCCESS;
......@@ -228,6 +263,7 @@ error:
if (sys->gl != NULL)
vlc_gl_Delete(sys->gl);
free (sys);
vd->sys = NULL;
return VLC_EGENERIC;
}
......@@ -295,9 +331,7 @@ static int Control (vout_display_t *vd, int query)
{
struct vout_display_placement dp = vd->cfg->display;
FlipVerticalAlign(&dp);
vout_display_PlacePicture(&sys->place, vd->source, &dp);
PlacePicture(vd, &sys->place, dp);
sys->place_changed = true;
vlc_gl_Resize (sys->gl, dp.width, dp.height);
return VLC_SUCCESS;
......@@ -308,9 +342,7 @@ static int Control (vout_display_t *vd, int query)
{
struct vout_display_placement dp = vd->cfg->display;
FlipVerticalAlign(&dp);
vout_display_PlacePicture(&sys->place, vd->source, &dp);
PlacePicture(vd, &sys->place, dp);
sys->place_changed = true;
return VLC_SUCCESS;
}
......
......@@ -145,11 +145,13 @@ struct vlc_gl_filters {
bool can_blit;
GLenum draw_framebuffer_target;
video_orientation_t orientation;
};
struct vlc_gl_filters *
vlc_gl_filters_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
struct vlc_gl_interop *interop)
struct vlc_gl_interop *interop,
video_orientation_t orientation)
{
struct vlc_gl_filters *filters = malloc(sizeof(*filters));
if (!filters)
......@@ -165,6 +167,7 @@ vlc_gl_filters_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
filters->gl = gl;
filters->api = api;
filters->interop = interop;
filters->orientation = orientation;
vlc_list_init(&filters->list);
memset(&filters->viewport, 0, sizeof(filters->viewport));
......@@ -502,6 +505,10 @@ vlc_gl_filters_Draw(struct vlc_gl_filters *filters)
vt->Viewport(0, 0, priv->tex_widths[0], priv->tex_heights[0]);
meta.plane = 0;
meta.orientation = ORIENT_NORMAL;
if (vlc_list_is_last(&priv->node, &filters->list))
meta.orientation = filters->orientation;
int ret = filter->ops->draw(filter, pic, &meta);
if (ret != VLC_SUCCESS)
return ret;
......
......@@ -43,7 +43,8 @@ struct vlc_gl_filter;
*/
struct vlc_gl_filters *
vlc_gl_filters_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
struct vlc_gl_interop *interop);
struct vlc_gl_interop *interop,
video_orientation_t orientation);
/**
* Delete the OpenGL filter chain
......
......@@ -186,9 +186,10 @@ opengl_link_program(struct vlc_gl_filter *filter)
"uniform mat4 ProjectionMatrix;\n"
"uniform mat4 ZoomMatrix;\n"
"uniform mat4 ViewMatrix;\n"
"uniform mat4 OrientationMatrix;\n"
"void main() {\n"
" PicCoords = (StereoMatrix * vec3(PicCoordsIn, 1.0)).st;\n"
" gl_Position = ProjectionMatrix * ZoomMatrix * ViewMatrix\n"
" gl_Position = OrientationMatrix * ProjectionMatrix * ZoomMatrix * ViewMatrix\n"
" * vec4(VertexPosition, 1.0);\n"
"}\n";
......@@ -267,6 +268,7 @@ opengl_link_program(struct vlc_gl_filter *filter)
GET_ULOC(ProjectionMatrix, "ProjectionMatrix");
GET_ULOC(ViewMatrix, "ViewMatrix");
GET_ULOC(ZoomMatrix, "ZoomMatrix");
GET_ULOC(OrientationMatrix, "OrientationMatrix");
GET_ALOC(PicCoordsIn, "PicCoordsIn");
GET_ALOC(VertexPosition, "VertexPosition");
......@@ -733,6 +735,15 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
renderer->valid_coords = true;
}
float orientation_matrix[ARRAY_SIZE(MATRIX4_IDENTITY)];
if (meta->orientation != ORIENT_NORMAL)
{
vlc_viewpoint_t orient_vp;
vlc_viewpoint_from_orientation(&orient_vp, meta->orientation);
vlc_viewpoint_to_4x4(&orient_vp, orientation_matrix);
}
else memcpy(orientation_matrix, MATRIX4_IDENTITY, sizeof(MATRIX4_IDENTITY));
vt->BindBuffer(GL_ARRAY_BUFFER, renderer->texture_buffer_object);
assert(renderer->aloc.PicCoordsIn != -1);
vt->EnableVertexAttribArray(renderer->aloc.PicCoordsIn);
......@@ -751,6 +762,8 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
renderer->var.ViewMatrix);
vt->UniformMatrix4fv(renderer->uloc.ZoomMatrix, 1, GL_FALSE,
renderer->var.ZoomMatrix);
vt->UniformMatrix4fv(renderer->uloc.OrientationMatrix, 1, GL_FALSE,
orientation_matrix);
vt->DrawElements(GL_TRIANGLES, renderer->nb_indices, GL_UNSIGNED_SHORT, 0);
GL_ASSERT_NOERROR(vt);
......
......@@ -70,6 +70,7 @@ struct vlc_gl_renderer
GLint ProjectionMatrix;
GLint ViewMatrix;
GLint ZoomMatrix;
GLint OrientationMatrix;
} uloc;
struct {
......
......@@ -101,7 +101,7 @@ CreateFilters(vlc_gl_t *gl, const struct vlc_gl_api *api,
struct vlc_gl_interop *interop,
struct vlc_gl_renderer **out_renderer)
{
struct vlc_gl_filters *filters = vlc_gl_filters_New(gl, api, interop);
struct vlc_gl_filters *filters = vlc_gl_filters_New(gl, api, interop, gl->orientation);
if (!filters)
{
msg_Err(gl, "Could not create filters");
......
......@@ -80,11 +80,11 @@ static void VglSwapBuffers(vlc_gl_t *gl)
ReleaseCurrent(gl);
}
static void Resize(vlc_gl_t * gl, unsigned w, unsigned h)
static int ResizeInternal(vlc_gl_t * gl, unsigned w, unsigned h)
{
vout_display_sys_t *sys = gl->sys;
if( sys->width == w && sys->height == h )
return;
return VLC_SUCCESS;
MakeCurrent(gl);
libvlc_video_render_cfg_t output_cfg = {
......@@ -92,17 +92,38 @@ static void Resize(vlc_gl_t * gl, unsigned w, unsigned h)
libvlc_video_colorspace_BT709, libvlc_video_primaries_BT709,
libvlc_video_transfer_func_SRGB, NULL,
};
libvlc_video_output_cfg_t render_cfg;
sys->resizeCb(sys->opaque, &output_cfg, &render_cfg);
libvlc_video_output_cfg_t render_cfg = {
.opengl_format = GL_RGBA,
.full_range = true,
.colorspace = libvlc_video_colorspace_BT709,
.primaries = libvlc_video_primaries_BT709,
.transfer = libvlc_video_transfer_func_SRGB,
.orientation = libvlc_video_orient_top_left,
};
bool ret = sys->resizeCb(sys->opaque, &output_cfg, &render_cfg);
ReleaseCurrent(gl);
if (!ret)
return VLC_EGENERIC;
assert(render_cfg.opengl_format == GL_RGBA);
assert(render_cfg.full_range == true);
assert(render_cfg.colorspace == libvlc_video_colorspace_BT709);
assert(render_cfg.primaries == libvlc_video_primaries_BT709);
assert(render_cfg.transfer == libvlc_video_transfer_func_SRGB);
assert(render_cfg.orientation == libvlc_video_orient_top_left);
/* video_orientation_t enum is matching libvlc_video_orient_t. */
gl->orientation = (video_orientation_t)render_cfg.orientation;
sys->width = w;
sys->height = h;
return VLC_SUCCESS;
}
static void Resize(vlc_gl_t * gl, unsigned w, unsigned h)
{
ResizeInternal(gl, w, h);
}
static void Close(vlc_gl_t *gl)
......@@ -161,7 +182,12 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
return VLC_EGENERIC;
}
}
Resize(gl, width, height);
if (ResizeInternal(gl, width, height) != VLC_SUCCESS)
{
if( sys->cleanupCb )
sys->cleanupCb(sys->opaque);
return VLC_EGENERIC;
}
static const struct vlc_gl_operations gl_ops =
{
......
......@@ -1013,6 +1013,7 @@ vlc_media_tree_Find
vlc_media_tree_Preparse
vlc_media_tree_PreparseCancel
vlc_viewpoint_to_4x4
vlc_viewpoint_from_orientation
vlc_video_context_Create
vlc_video_context_Release
vlc_video_context_GetType
......
......@@ -25,6 +25,7 @@
#endif
#include <vlc_viewpoint.h>
#include <vlc_es.h>
void vlc_viewpoint_to_4x4( const vlc_viewpoint_t *vp, float *m )
{
......@@ -69,3 +70,36 @@ void vlc_viewpoint_to_4x4( const vlc_viewpoint_t *vp, float *m )
for (int l=0; l<4; ++l)
m[4*i+l] += y_rot[i][j] * x_rot[j][k] * z_rot[k][l];
}
void vlc_viewpoint_from_orientation(vlc_viewpoint_t *vp,
video_orientation_t orient)
{
switch(orient)
{
default:
case ORIENT_NORMAL:
case ORIENT_HFLIPPED:
*vp = (vlc_viewpoint_t) { .fov = vp->fov };
break;
case ORIENT_ROTATED_90:
case ORIENT_ANTI_TRANSPOSED:
*vp = (vlc_viewpoint_t) {
.roll = -90.f, .fov = vp->fov
};
break;
case ORIENT_ROTATED_180:
case ORIENT_VFLIPPED:
*vp = (vlc_viewpoint_t) {
.roll = -180.f, .fov = vp->fov
};
break;
case ORIENT_ROTATED_270:
case ORIENT_TRANSPOSED:
*vp = (vlc_viewpoint_t) {
.roll = -270.f, .fov = vp->fov
};
break;
}
}
......@@ -89,6 +89,7 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
vlc_gl_t *gl = &glpriv->gl;
gl->api_type = api_type;
gl->orientation = ORIENT_NORMAL;
gl->surface = wnd;
gl->device = NULL;
......@@ -144,9 +145,9 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
vlc_gl_t *gl = &glpriv->gl;
gl->api_type = api_type;
gl->orientation = ORIENT_NORMAL;
gl->offscreen_chroma_out = VLC_CODEC_UNKNOWN;
gl->offscreen_vflip = false;
gl->offscreen_vctx_out = NULL;
gl->surface = NULL;
......