diff --git a/openglosd.cpp b/openglosd.cpp index ef35f18..b908064 100644 --- a/openglosd.cpp +++ b/openglosd.cpp @@ -1594,10 +1594,10 @@ bool cOglThread::InitOpenGL(void) { return false; } #endif -#if 1 + if (!GlxInitopengl()) return false; -#endif + VertexBuffers[vbText]->EnableBlending(); glDisable(GL_DEPTH_TEST); return true; @@ -1650,7 +1650,7 @@ void cOglThread::DeleteVertexBuffers(void) { void cOglThread::Cleanup(void) { esyslog("[softhddev]OglThread cleanup\n"); DeleteVertexBuffers(); - delete cOglOsd::oFb; +// delete cOglOsd::oFb; cOglOsd::oFb = NULL; DeleteShaders(); // glVDPAUFiniNV(); diff --git a/softhdcuvid.cpp b/softhdcuvid.cpp index efcea32..b4dd84e 100644 --- a/softhdcuvid.cpp +++ b/softhdcuvid.cpp @@ -3595,163 +3595,163 @@ cString cPluginSoftHdDevice::SVDRPCommand(const char *command, } } if (!strcasecmp(command, "SUSP")) { - if (cSoftHdControl::Player) { // already suspended - return "SoftHdDevice already suspended"; - } - if (SuspendMode != NOT_SUSPENDED) { - return "SoftHdDevice already detached"; - } - cControl::Launch(new cSoftHdControl); - cControl::Attach(); - Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11); - SuspendMode = SUSPEND_NORMAL; + if (cSoftHdControl::Player) { // already suspended + return "SoftHdDevice already suspended"; + } + if (SuspendMode != NOT_SUSPENDED) { + return "SoftHdDevice already detached"; + } #ifdef USE_OPENGLOSD - dsyslog("[softhddev]stopping Ogl Thread svdrp STAT"); - cSoftOsdProvider::StopOpenGlThread(); + dsyslog("[softhddev]stopping Ogl Thread svdrp STAT"); + cSoftOsdProvider::StopOpenGlThread(); #endif - return "SoftHdDevice is suspended"; + cControl::Launch(new cSoftHdControl); + cControl::Attach(); + Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11); + SuspendMode = SUSPEND_NORMAL; + return "SoftHdDevice is suspended"; } if (!strcasecmp(command, "RESU")) { - if (SuspendMode == NOT_SUSPENDED) { - return "SoftHdDevice already resumed"; - } - if (SuspendMode != SUSPEND_NORMAL) { - return "can't resume SoftHdDevice"; - } - if (ShutdownHandler.GetUserInactiveTime()) { - ShutdownHandler.SetUserInactiveTimeout(); - } - if (cSoftHdControl::Player) { // suspended - cControl::Shutdown(); // not need, if not suspended - } - Resume(); - SuspendMode = NOT_SUSPENDED; - return "SoftHdDevice is resumed"; + if (SuspendMode == NOT_SUSPENDED) { + return "SoftHdDevice already resumed"; + } + if (SuspendMode != SUSPEND_NORMAL) { + return "can't resume SoftHdDevice"; + } + if (ShutdownHandler.GetUserInactiveTime()) { + ShutdownHandler.SetUserInactiveTimeout(); + } + if (cSoftHdControl::Player) { // suspended + cControl::Shutdown(); // not need, if not suspended + } + Resume(); + SuspendMode = NOT_SUSPENDED; + return "SoftHdDevice is resumed"; } if (!strcasecmp(command, "DETA")) { - if (SuspendMode == SUSPEND_DETACHED) { - return "SoftHdDevice already detached"; - } - if (cSoftHdControl::Player) { // already suspended - return "can't suspend SoftHdDevice already suspended"; - } - cControl::Launch(new cSoftHdControl); - cControl::Attach(); - Suspend(1, 1, 0); - SuspendMode = SUSPEND_DETACHED; + if (SuspendMode == SUSPEND_DETACHED) { + return "SoftHdDevice already detached"; + } + if (cSoftHdControl::Player) { // already suspended + return "can't suspend SoftHdDevice already suspended"; + } #ifdef USE_OPENGLOSD - dsyslog("[softhddev]stopping Ogl Thread svdrp DETA"); - cSoftOsdProvider::StopOpenGlThread(); + dsyslog("[softhddev]stopping Ogl Thread svdrp DETA"); + cSoftOsdProvider::StopOpenGlThread(); #endif - return "SoftHdDevice is detached"; + cControl::Launch(new cSoftHdControl); + cControl::Attach(); + Suspend(1, 1, 0); + SuspendMode = SUSPEND_DETACHED; + return "SoftHdDevice is detached"; } if (!strcasecmp(command, "ATTA")) { - char *tmp; - char *t; - char *s; - char *o; + char *tmp; + char *t; + char *s; + char *o; - if (SuspendMode != SUSPEND_DETACHED) { - return "can't attach SoftHdDevice not detached"; - } - if (!(tmp = strdup(option))) { - return "out of memory"; - } - t = tmp; - while ((s = strsep(&t, " \t\n\r"))) { - if (!strcmp(s, "-d")) { - if (!(o = strsep(&t, " \t\n\r"))) { - free(tmp); - return "missing option argument"; + if (SuspendMode != SUSPEND_DETACHED) { + return "can't attach SoftHdDevice not detached"; } - free(ConfigX11Display); - ConfigX11Display = strdup(o); - X11DisplayName = ConfigX11Display; - } else if (!strncmp(s, "-d", 2)) { - free(ConfigX11Display); - ConfigX11Display = strdup(s + 2); - X11DisplayName = ConfigX11Display; - - } else if (!strcmp(s, "-a")) { - if (!(o = strsep(&t, " \t\n\r"))) { - free(tmp); - return "missing option argument"; + if (!(tmp = strdup(option))) { + return "out of memory"; } - free(ConfigAudioDevice); - ConfigAudioDevice = strdup(o); - AudioSetDevice(ConfigAudioDevice); - } else if (!strncmp(s, "-a", 2)) { - free(ConfigAudioDevice); - ConfigAudioDevice = strdup(s + 2); - AudioSetDevice(ConfigAudioDevice); + t = tmp; + while ((s = strsep(&t, " \t\n\r"))) { + if (!strcmp(s, "-d")) { + if (!(o = strsep(&t, " \t\n\r"))) { + free(tmp); + return "missing option argument"; + } + free(ConfigX11Display); + ConfigX11Display = strdup(o); + X11DisplayName = ConfigX11Display; + } else if (!strncmp(s, "-d", 2)) { + free(ConfigX11Display); + ConfigX11Display = strdup(s + 2); + X11DisplayName = ConfigX11Display; - } else if (!strcmp(s, "-p")) { - if (!(o = strsep(&t, " \t\n\r"))) { - free(tmp); - return "missing option argument"; + } else if (!strcmp(s, "-a")) { + if (!(o = strsep(&t, " \t\n\r"))) { + free(tmp); + return "missing option argument"; + } + free(ConfigAudioDevice); + ConfigAudioDevice = strdup(o); + AudioSetDevice(ConfigAudioDevice); + } else if (!strncmp(s, "-a", 2)) { + free(ConfigAudioDevice); + ConfigAudioDevice = strdup(s + 2); + AudioSetDevice(ConfigAudioDevice); + + } else if (!strcmp(s, "-p")) { + if (!(o = strsep(&t, " \t\n\r"))) { + free(tmp); + return "missing option argument"; + } + free(ConfigPassthroughDevice); + ConfigPassthroughDevice = strdup(o); + AudioSetPassthroughDevice(ConfigPassthroughDevice); + } else if (!strncmp(s, "-p", 2)) { + free(ConfigPassthroughDevice); + ConfigPassthroughDevice = strdup(s + 2); + AudioSetPassthroughDevice(ConfigPassthroughDevice); + + } else if (*s) { + free(tmp); + return "unsupported option"; + } } - free(ConfigPassthroughDevice); - ConfigPassthroughDevice = strdup(o); - AudioSetPassthroughDevice(ConfigPassthroughDevice); - } else if (!strncmp(s, "-p", 2)) { - free(ConfigPassthroughDevice); - ConfigPassthroughDevice = strdup(s + 2); - AudioSetPassthroughDevice(ConfigPassthroughDevice); - - } else if (*s) { free(tmp); - return "unsupported option"; - } - } - free(tmp); - if (ShutdownHandler.GetUserInactiveTime()) { - ShutdownHandler.SetUserInactiveTimeout(); - } - if (cSoftHdControl::Player) { // suspended - cControl::Shutdown(); // not need, if not suspended - } - Resume(); - SuspendMode = NOT_SUSPENDED; - return "SoftHdDevice is attached"; + if (ShutdownHandler.GetUserInactiveTime()) { + ShutdownHandler.SetUserInactiveTimeout(); + } + if (cSoftHdControl::Player) { // suspended + cControl::Shutdown(); // not need, if not suspended + } + Resume(); + SuspendMode = NOT_SUSPENDED; + return "SoftHdDevice is attached"; } if (!strcasecmp(command, "HOTK")) { - int hotk; + int hotk; - hotk = strtol(option, NULL, 0); - HandleHotkey(hotk); - return "hot-key executed"; + hotk = strtol(option, NULL, 0); + HandleHotkey(hotk); + return "hot-key executed"; } if (!strcasecmp(command, "PRIM")) { - int primary; + int primary; - primary = strtol(option, NULL, 0); - if (!primary && MyDevice) { - primary = MyDevice->DeviceNumber() + 1; - } - dsyslog("[softhddev] switching primary device to %d\n", primary); - DoMakePrimary = primary; - return "switching primary device requested"; + primary = strtol(option, NULL, 0); + if (!primary && MyDevice) { + primary = MyDevice->DeviceNumber() + 1; + } + dsyslog("[softhddev] switching primary device to %d\n", primary); + DoMakePrimary = primary; + return "switching primary device requested"; } if (!strcasecmp(command, "3DOF")) { - VideoSetOsd3DMode(0); - return "3d off"; + VideoSetOsd3DMode(0); + return "3d off"; } if (!strcasecmp(command, "3DSB")) { - VideoSetOsd3DMode(1); - return "3d sbs"; + VideoSetOsd3DMode(1); + return "3d sbs"; } if (!strcasecmp(command, "3DTB")) { - VideoSetOsd3DMode(2); - return "3d tb"; + VideoSetOsd3DMode(2); + return "3d tb"; } if (!strcasecmp(command, "RAIS")) { - if (!ConfigStartX11Server) { - VideoRaiseWindow(); - } else { - return "Raise not possible"; - } - return "Window raised"; + if (!ConfigStartX11Server) { + VideoRaiseWindow(); + } else { + return "Raise not possible"; + } + return "Window raised"; } return NULL; diff --git a/video.c b/video.c index abcd600..e8f8e57 100644 --- a/video.c +++ b/video.c @@ -633,8 +633,8 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, normal: *output_x = video_x; *output_y = video_y; - *output_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den ) / display_aspect_ratio.den; - *output_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num ) / display_aspect_ratio.num; + *output_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den -1 ) / display_aspect_ratio.den; + *output_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num -1 ) / display_aspect_ratio.num; // JOJO hier stimmt was nicht #if DEBUG *output_width = video_width; @@ -866,6 +866,7 @@ static void GlxUploadOsdTexture(int x, int y, int width, int height, glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); + } /// @@ -886,12 +887,12 @@ static void GlxOsdInit(int width, int height) #endif Debug(3, "video/glx: osd init context %p <-> %p\n", glXGetCurrentContext(), GlxContext); - + +#ifndef USE_OPENGLOSD // // create a RGBA texture. // glEnable(GL_TEXTURE_2D); // create 2d texture(s) - glGenTextures(2, OsdGlTextures); for (i = 0; i < 2; ++i) { glBindTexture(GL_TEXTURE_2D, OsdGlTextures[i]); @@ -901,11 +902,12 @@ static void GlxOsdInit(int width, int height) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); - } - glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); +#else + OsdGlTextures[0] = 0; +#endif } /// @@ -914,6 +916,7 @@ static void GlxOsdInit(int width, int height) static void GlxOsdExit(void) { if (OsdGlTextures[0]) { + glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext ); glDeleteTextures(2, OsdGlTextures); OsdGlTextures[0] = 0; OsdGlTextures[1] = 0; @@ -4878,18 +4881,14 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual, #endif // FIXME: size hints - +#if 0 // register interest in the delete window message if ((reply = - xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, - sizeof("WM_DELETE_WINDOW") - 1, "WM_DELETE_WINDOW"), - NULL))) { + xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, sizeof("WM_DELETE_WINDOW") - 1, "WM_DELETE_WINDOW"),NULL))) { WmDeleteWindowAtom = reply->atom; free(reply); if ((reply = - xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, - 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS"), - NULL))) { + xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection,0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS"),NULL))) { #ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS xcb_icccm_set_wm_protocols(Connection, VideoWindow, reply->atom, 1,&WmDeleteWindowAtom); #endif @@ -4899,6 +4898,7 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual, free(reply); } } +#endif // // prepare fullscreen. // @@ -5439,7 +5439,11 @@ void VideoInit(const char *display_name) Debug(3, "video: x11 already setup\n"); return; } - +#ifdef USE_GLX + if (!XInitThreads()) { + Error(_("video: Can't initialize X11 thread support on '%s'\n"),display_name); + } +#endif // Open the connection to the X server. // use the DISPLAY environment variable as the default display name if (!display_name && !(display_name = getenv("DISPLAY"))) { @@ -5451,11 +5455,7 @@ void VideoInit(const char *display_name) // FIXME: we need to retry connection return; } -#ifdef USE_GLX - if (!XInitThreads()) { - Error(_("video: Can't initialize X11 thread support on '%s'\n"),display_name); - } -#endif + // Register error handler XSetIOErrorHandler(VideoIOErrorHandler);