45#include <condition_variable>
64#define MAX_BUFFER_SIZE 1
65#define MOD_NAME "[pano gl] "
106 auto now = std::chrono::steady_clock::now();
109 glClear(GL_COLOR_BUFFER_BIT);
116 int event_id = *
static_cast<int *
>(
param);
118 event.type = event_id;
119 SDL_PushEvent(&event);
125 bool video_framerate_over_threshold =
false,
126 bool triggered_by_frame =
false)
128 if(video_framerate_over_threshold && triggered_by_frame){
150 if(triggered_by_frame)
158 if(event->window.event == SDL_WINDOWEVENT_RESIZED){
159 glViewport(0, 0, event->window.data1, event->window.data2);
167 if(event->key.type == SDL_KEYDOWN){
168 switch(event->key.keysym.sym){
171 SDL_SetWindowFullscreen(s->
window.
sdl_window, s->
fs ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
185 std::unique_lock<std::mutex> lk(s->
lock);
224 if (!SDL_WaitEvent(&event)) {
229 case SDL_MOUSEMOTION:
230 if(event.motion.state & SDL_BUTTON_LMASK){
232 event.motion.yrel / 8.f);
241 case SDL_WINDOWEVENT:
251 if(event.type >= SDL_USEREVENT)
267 std::lock_guard<std::mutex>
lock(s->
lock);
291 std::unique_lock<std::mutex> lk(s->
lock);
295 printf(
"1 frame(s) dropped!\n");
303 event.user.data1 =
frame;
305 SDL_PushEvent(&event);
320 int rgb_shift[] = {0, 8, 16};
326 if(codecs_size <= *
len) {
336 if(
sizeof(rgb_shift) > *
len) {
339 memcpy(
val, rgb_shift,
sizeof(rgb_shift));
340 *
len =
sizeof(rgb_shift);
347 if(
sizeof(supported_il_modes) <= *
len) {
348 memcpy(
val, supported_il_modes,
sizeof(supported_il_modes));
352 *
len =
sizeof(supported_il_modes);
364 strcpy((*available_cards)[0].
dev,
"");
365 strcpy((*available_cards)[0].
name,
"Panorama Gl SW display");
366 (*available_cards)[0].repeatable =
true;
struct video_frame long long nonblock
struct video_frame * frame
const char unsigned int flags
int void(** deleter)(void *))
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
#define PITCH_DEFAULT
default pitch, i. e. respective linesize
#define VIDEO_DISPLAY_ABI_VERSION
@ DISPLAY_PROPERTY_BUF_PITCH
requested framebuffer pitch - int (bytes), may be PITCH_DEFAULT
@ DISPLAY_PROPERTY_RGB_SHIFT
red,green,blue shift - int[3] (bits)
@ DISPLAY_PROPERTY_SUPPORTED_IL_MODES
display supported interlacing modes - enum interlacing_t[]
@ DISPLAY_PROPERTY_CODECS
list of natively supported codecs - codec_t[]
@ LIBRARY_CLASS_VIDEO_DISPLAY
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
static Uint32 redraw_callback(Uint32 interval, void *param)
static void display_panogl_run(void *state)
static void display_panogl_done(void *state)
static bool display_panogl_reconfigure(void *state, struct video_desc desc)
static bool display_panogl_putf(void *state, struct video_frame *frame, long long nonblock)
static void handle_keyboard_event(state_vr *s, SDL_Event *event)
static bool display_panogl_get_property(void *state, int property, void *val, size_t *len)
static void handle_window_event(state_vr *s, SDL_Event *event)
static void redraw(state_vr *s, bool video_framerate_over_threshold=false, bool triggered_by_frame=false)
static void draw(state_vr *s)
static const struct video_display_info display_panogl_info
static struct video_frame * display_panogl_getf(void *state)
static void handle_user_event(state_vr *s, SDL_Event *event)
static void * display_panogl_init(struct module *parent, const char *fmt, unsigned int flags)
static void display_panogl_probe(struct device_info **available_cards, int *count, void(**deleter)(void *))
#define PROFILE_DETAIL(name)
void rotate(float dx, float dy)
void render(int width, int height)
void put_frame(video_frame *f, bool pbo_frame=false)
std::vector< codec_t > get_codecs()
std::chrono::steady_clock::time_point last_frame
std::queue< video_frame * > free_frame_queue
int buffered_frames_count
unsigned sdl_redraw_event
std::condition_variable frame_consumed_cv
Struct video_frame represents a video frame and contains video description.
@ PROGRESSIVE
progressive frame
This is an umbrella header for video functions.
void vf_recycle(struct video_frame *buf)
This function should be called before returning a frame back to a frame pool. Currently this is used ...
bool video_desc_eq(struct video_desc a, struct video_desc b)
Compares two video descriptions.