Add support for fullscreen mode.

This commit is contained in:
Johns 2012-01-13 16:31:29 +01:00
parent 92bb00c410
commit 7f7de8678f
6 changed files with 91 additions and 19 deletions

View File

@ -1,6 +1,7 @@
User johns
Date:
Add support for fullscreen and fullscreen toogle.
Instant update deinterlace configuration changes.
Fix subtitle position.
Add SVDRP support.

View File

@ -33,7 +33,7 @@ A software and GPU emulated HD output device plugin for VDR.
o Audio FFMpeg/Alsa/Analog
o Audio FFMpeg/Alsa/Digital
o Audio FFMpeg/OSS/Analog
o planned: Alsa HDMI/SPDIF Passthrough
o Alsa HDMI/SPDIF Passthrough
o planned: OSS HDMI/SPDIF Passthrough
To compile you must have the 'requires' installed.
@ -149,6 +149,9 @@ Commandline:
Running:
--------
Click into video window to toggle fullscreen/window mode, only if you
have a window manager running.
Warning:
--------
libav is not supported, expect many bugs with it.

21
Todo
View File

@ -19,14 +19,9 @@ GNU Affero General Public License for more details.
$Id: $
missing:
video out with xv
video out with opengl
software decoder for xv / opengl
software deinterlace
auto crop
atmolight
zoom/fit-zoom 4:3 (SetVideoDisplayFormat, SetVideoFormat?)
multistream handling
ITU BT601, ITU BT709 (HD), RGB studio levels (16-235)?
suspend output / energie saver: stop audio, stop video, configurable
Option deinterlace off / deinterlace force!
@ -59,9 +54,6 @@ libva-vdpau-driver:
libva-xvba-driver:
x11:
support resize of x11 window
support fullscreen window
support fullscreen / window toggle
disable screensaver
audio/alsa:
@ -98,6 +90,17 @@ setup:
Setup of output type.
Setup of display type.
Setup 4:3 zoom type
Setup parameters are not used until restart.
Some setup parameters are not used until restart.
Can a notice be added to the setup menu?
576i, 720p, fake 1080i, 1080i
future features (not planed for 1.0 - 1.5)
video out with xv
video out with opengl
video out with xvba
software decoder for xv / opengl
atmolight support
multistream handling
upmix stereo to AC-3

View File

@ -57,10 +57,11 @@ static char ConfigVdpauDecoder = 1; ///< use vdpau decoder, if possible
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
#endif
static char ConfigFullscreen; ///< fullscreen modus
static char ConfigSuspendClose = 1; ///< suspend should close devices
static char ConfigSuspendX11 = 1; ///< suspend should stop x11
static pthread_mutex_t SuspendLockMutex;///< suspend lock mutex
static pthread_mutex_t SuspendLockMutex; ///< suspend lock mutex
static volatile char VideoFreezed; ///< video freezed
@ -580,11 +581,15 @@ int VideoDecode(void)
/**
** Try video start.
**
** Could be called, when already started.
** NOT TRUE: Could be called, when already started.
*/
static void StartVideo(void)
{
VideoInit(X11DisplayName);
if (ConfigFullscreen) {
// FIXME: not good looking, mapped and then resized.
VideoSetFullscreen(1);
}
VideoOsdInit();
if (!MyVideoDecoder) {
VideoHwDecoder *hw_decoder;
@ -946,6 +951,7 @@ const char *CommandLineHelp(void)
{
return " -a device\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
" -d display\tdisplay of x11 server (fe. :0.0)\n"
" -f\t\tstart with fullscreen window (only with window manager)\n"
" -g geometry\tx11 window geometry wxh+x+y\n"
" -x\t\tstart x11 server\n";
}
@ -962,13 +968,16 @@ int ProcessArgs(int argc, char *const argv[])
// Parse arguments.
//
for (;;) {
switch (getopt(argc, argv, "-a:d:g:x")) {
switch (getopt(argc, argv, "-a:d:fg:x")) {
case 'a': // audio device
AudioSetDevice(optarg);
continue;
case 'd': // x11 display name
X11DisplayName = optarg;
continue;
case 'f': // fullscreen mode
ConfigFullscreen = 1;
continue;
case 'g': // geometry
if (VideoSetGeometry(optarg) < 0) {
fprintf(stderr,
@ -1175,7 +1184,7 @@ void MainThreadHook(void)
void Suspend(void)
{
pthread_mutex_lock(&SuspendLockMutex);
if( SkipVideo && SkipAudio ) { // already suspended
if (SkipVideo && SkipAudio) { // already suspended
pthread_mutex_unlock(&SuspendLockMutex);
return;
}
@ -1186,13 +1195,13 @@ void Suspend(void)
SkipAudio = 1;
pthread_mutex_unlock(&SuspendLockMutex);
if ( ConfigSuspendClose ) {
if (ConfigSuspendClose) {
pthread_mutex_lock(&SuspendLockMutex);
// FIXME: close audio
// FIXME: close video
pthread_mutex_unlock(&SuspendLockMutex);
}
if ( ConfigSuspendX11 ) {
if (ConfigSuspendX11) {
// FIXME: stop x11, if started
}
}
@ -1202,15 +1211,15 @@ void Suspend(void)
*/
void Resume(void)
{
if (!SkipVideo && !SkipAudio) { // we are not suspended
if (!SkipVideo && !SkipAudio) { // we are not suspended
return;
}
Debug(3, "[softhddev]%s:\n", __FUNCTION__);
if ( ConfigSuspendX11 ) {
if (ConfigSuspendX11) {
}
if ( ConfigSuspendClose ) {
if (ConfigSuspendClose) {
pthread_mutex_lock(&SuspendLockMutex);
pthread_mutex_unlock(&SuspendLockMutex);
}

53
video.c
View File

@ -93,6 +93,7 @@
#include <xcb/xcb_image.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_keysyms.h>
#endif
@ -242,6 +243,8 @@ static VideoZoomModes Video4to3ZoomMode;
static char Video60HzMode; ///< handle 60hz displays
static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message
static xcb_atom_t NetWmState; ///< wm-state message atom
static xcb_atom_t NetWmStateFullscreen; ///< fullscreen wm-state message atom
extern uint32_t VideoSwitch; ///< ticks for channel switch
@ -6119,6 +6122,9 @@ static void VideoEvent(void)
VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y,
event.xconfigure.width, event.xconfigure.height);
break;
case ButtonPress:
VideoSetFullscreen(-1);
break;
case KeyPress:
keysym = XLookupKeysym(&event.xkey, 0);
#if 0
@ -6690,6 +6696,22 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual,
free(reply);
}
}
//
// prepare fullscreen.
//
if ((reply =
xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0,
sizeof("_NET_WM_STATE") - 1, "_NET_WM_STATE"), NULL))) {
NetWmState = reply->atom;
free(reply);
}
if ((reply =
xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0,
sizeof("_NET_WM_STATE_FULLSCREEN") - 1,
"_NET_WM_STATE_FULLSCREEN"), NULL))) {
NetWmStateFullscreen = reply->atom;
free(reply);
}
xcb_map_window(Connection, VideoWindow);
@ -6792,6 +6814,37 @@ void VideoSetVideoMode(int x, int y, int width, int height)
#endif
}
///
/// Send fullscreen message to window.
///
/// @param onoff -1 toggle, true turn on, false turn off
///
void VideoSetFullscreen(int onoff)
{
xcb_client_message_event_t event;
memset(&event, 0, sizeof(event));
event.response_type = XCB_CLIENT_MESSAGE;
event.format = 32;
event.window = VideoWindow;
event.type = NetWmState;
if (onoff < 0) {
event.data.data32[0] = XCB_EWMH_WM_STATE_TOGGLE;
} else if (onoff) {
event.data.data32[0] = XCB_EWMH_WM_STATE_ADD;
} else {
event.data.data32[0] = XCB_EWMH_WM_STATE_REMOVE;
}
event.data.data32[1] = NetWmStateFullscreen;
xcb_send_event(Connection, XCB_SEND_EVENT_DEST_POINTER_WINDOW,
DefaultRootWindow(XlibDisplay),
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (void *)&event);
Debug(3, "video/x11: send fullscreen message %x %x\n",
event.data.data32[0], event.data.data32[1]);
}
///
/// Set deinterlace mode.
///

View File

@ -76,6 +76,9 @@ extern void VideoSetOutputPosition(int, int, int, int);
/// Set video mode.
extern void VideoSetVideoMode(int, int, int, int);
/// Set video fullscreen mode.
extern void VideoSetFullscreen(int);
/// Set deinterlace.
extern void VideoSetDeinterlace(int[]);