Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 1140056044f69ce0c1a1e87c822db4c1c121c036
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

module_repo.c

Blame
  • module_sdl2.c 14,38 Kio
    #define _POSIX_C_SOURCE 200809L
    
    #define __LKT_MODULE_MAIN_SOURCE__
    #include <lektor/lktmodule.h>
    
    #include "mpv.h"
    #include "thread.h"
    
    #include <sqlite3.h>
    #include <sched.h>
    #include <string.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <stdarg.h>
    #include <SDL.h>
    #include <mpv/render_gl.h>
    #include <mpv/client.h>
    
    #define WIDTH   400
    #define HEIGHT  200
    
    static volatile Uint32 wakeup_on_mpv_render_update, wakeup_on_mpv_events;
    
    struct module_sdl2_window {
        /* Related to SDL2 */
        volatile SDL_Window *window;
        volatile SDL_GLContext glcontext;
        int is_fullscreen;
    
        /* Mpv related */
        volatile mpv_handle *mpv;
        volatile mpv_render_context *mpv_gl;
        volatile int mpv_time_pos;  /* Don't write it in the database       */
        volatile int mpv_duration;  /* Because don't need to be persistent  */
        volatile int state;
    
        /* Thread related */
        struct poller_thread self;
        volatile int launched;  /* SDL you sucks */
    
        /* Things from the server */
        struct queue *queue;
        volatile sqlite3 *db;
    };
    
    /************************
     * Function definitions *
     ************************/
    
    static bool module_sdl2_get_elapsed(struct module_sdl2_window *, int *);
    static bool module_sdl2_get_duration(struct module_sdl2_window *, int *);
    static bool module_sdl2_set_volume(struct module_sdl2_window *, int);
    static bool module_sdl2_load_file(struct module_sdl2_window *, const char *);
    static bool module_sdl2_toggle_pause(struct module_sdl2_window *);
    static void module_sdl2_free(struct module_sdl2_window *);
    static void module_sdl2_close(struct module_sdl2_window *);
    static bool module_sdl2_new(struct module_sdl2_window **, struct queue *, volatile sqlite3 *);
    
    /*********************
     * Private functions *
     *********************/
    
    static inline void *
    get_proc_address_mpv(void UNUSED *fn_ctx, const char *name)
    {
        return SDL_GL_GetProcAddress(name);
    }
    
    static inline void