X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Ffb.c;h=d09f1c49893be9d571deb71cf74c33d408da721a;hb=ec04db28586c567287f5b5350153042d65a6fd19;hp=df8eba189e575607f241e81a7b17f0fd71a3cebe;hpb=ed5e0de6a200f565724428ac2c548b00d34c6092;p=vlc diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c index df8eba189e..d09f1c4989 100644 --- a/modules/video_output/fb.c +++ b/modules/video_output/fb.c @@ -1,25 +1,25 @@ /***************************************************************************** * fb.c : framebuffer plugin for vlc ***************************************************************************** - * Copyright (C) 2000-2009 the VideoLAN team + * Copyright (C) 2000-2009 VLC authors and VideoLAN * $Id$ * * Authors: Samuel Hocevar * Jean-Paul Saman * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -30,7 +30,6 @@ # include "config.h" #endif -#include /* ENOMEM */ #include /* SIGUSR1, SIGUSR2 */ #include /* open() */ #include /* close() */ @@ -47,7 +46,7 @@ #include #include #include -#include +#include /***************************************************************************** * Module descriptor @@ -58,23 +57,23 @@ #define DEVICE_LONGTEXT N_(\ "Framebuffer device to use for rendering (usually /dev/fb0).") -#define TTY_TEXT N_("Run fb on current tty.") +#define TTY_TEXT N_("Run fb on current tty") #define TTY_LONGTEXT N_(\ "Run framebuffer on current TTY device (default enabled). " \ "(disable tty handling with caution)") -#define FB_MODE_TEXT N_("Framebuffer resolution to use.") +#define FB_MODE_TEXT N_("Framebuffer resolution to use") #define FB_MODE_LONGTEXT N_(\ "Select the resolution for the framebuffer. Currently it supports " \ "the values 0=QCIF 1=CIF 2=NTSC 3=PAL, 4=auto (default 4=auto)") -#define HW_ACCEL_TEXT N_("Framebuffer uses hw acceleration.") +#define HW_ACCEL_TEXT N_("Framebuffer uses hw acceleration") #define HW_ACCEL_LONGTEXT N_(\ "If your framebuffer supports hardware acceleration or does double buffering " \ "in hardware then you must disable this option. It then does double buffering " \ "in software.") -#define CHROMA_TEXT N_("Image format (default RGB).") +#define CHROMA_TEXT N_("Image format (default RGB)") #define CHROMA_LONGTEXT N_("Chroma fourcc used by the framebuffer. Default is RGB since the fb device has no way to report its chroma.") static int Open (vlc_object_t *); @@ -84,14 +83,14 @@ vlc_module_begin () set_shortname("Framebuffer") set_category(CAT_VIDEO) set_subcategory(SUBCAT_VIDEO_VOUT) - add_file(FB_DEV_VAR, "/dev/fb0", NULL, DEVICE_TEXT, DEVICE_LONGTEXT, - false) - add_bool("fb-tty", true, NULL, TTY_TEXT, TTY_LONGTEXT, true) - add_string( "fb-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true ) + add_loadfile(FB_DEV_VAR, "/dev/fb0", DEVICE_TEXT, DEVICE_LONGTEXT, + false) + add_bool("fb-tty", true, TTY_TEXT, TTY_LONGTEXT, true) + add_string( "fb-chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true ) add_obsolete_string("fb-aspect-ratio") - add_integer("fb-mode", 4, NULL, FB_MODE_TEXT, FB_MODE_LONGTEXT, + add_integer("fb-mode", 4, FB_MODE_TEXT, FB_MODE_LONGTEXT, true) - add_bool("fb-hw-accel", true, NULL, HW_ACCEL_TEXT, HW_ACCEL_LONGTEXT, + add_bool("fb-hw-accel", true, HW_ACCEL_TEXT, HW_ACCEL_LONGTEXT, true) set_description(N_("GNU/Linux framebuffer video output")) set_capability("vout display", 30) @@ -102,14 +101,15 @@ vlc_module_end () * Local prototypes *****************************************************************************/ static picture_pool_t *Pool (vout_display_t *, unsigned); -static void Display(vout_display_t *, picture_t *); +static void Display(vout_display_t *, picture_t *, subpicture_t *); static int Control(vout_display_t *, int, va_list); -static void Manage (vout_display_t *); /* */ static int OpenDisplay (vout_display_t *, bool force_resolution); static void CloseDisplay (vout_display_t *); +#if 0 static void SwitchDisplay(int i_signal); +#endif static void TextMode (int tty); static void GfxMode (int tty); @@ -124,8 +124,10 @@ struct vout_display_sys_t { struct termios old_termios; /* Original configuration information */ +#if 0 struct sigaction sig_usr1; /* USR1 previous handler */ struct sigaction sig_usr2; /* USR2 previous handler */ +#endif struct vt_mode vt_mode; /* previous VT mode */ /* Framebuffer information */ @@ -145,7 +147,7 @@ struct vout_display_sys_t { int bytes_per_pixel; /* Video memory */ - uint8_t *video_ptr; /* base adress */ + uint8_t *video_ptr; /* base address */ size_t video_size; /* page size */ picture_t *picture; @@ -183,23 +185,23 @@ static int Open(vlc_object_t *object) return VLC_ENOMEM; /* Does the framebuffer uses hw acceleration? */ - sys->is_hw_accel = var_CreateGetBool(vd, "fb-hw-accel"); + sys->is_hw_accel = var_InheritBool(vd, "fb-hw-accel"); /* Set tty and fb devices */ sys->tty = 0; /* 0 == /dev/tty0 == current console */ - sys->is_tty = var_CreateGetBool(vd, "fb-tty"); -#if !defined(WIN32) && defined(HAVE_ISATTY) + sys->is_tty = var_InheritBool(vd, "fb-tty"); +#if !defined(_WIN32) && defined(HAVE_ISATTY) /* Check that stdin is a TTY */ if (sys->is_tty && !isatty(0)) { - msg_Warn(vd, "fd 0 is not a TTY"); + msg_Warn(vd, "standard input is not a TTY"); free(sys); return VLC_EGENERIC; } - msg_Warn(vd, "disabling tty handling, use with caution because " - "there is no way to return to the tty."); + msg_Warn(vd, "disabling TTY handling, use with caution because " + "there is no way to return to the TTY"); #endif - const int mode = var_CreateGetInteger(vd, "fb-mode"); + const int mode = var_InheritInteger(vd, "fb-mode"); bool force_resolution = true; switch (mode) { case 0: /* QCIF */ @@ -224,7 +226,7 @@ static int Open(vlc_object_t *object) break; } - char *chroma = var_CreateGetNonEmptyString(vd, "fb-chroma"); + char *chroma = var_InheritString(vd, "fb-chroma"); if (chroma) { sys->chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma); @@ -234,8 +236,7 @@ static int Open(vlc_object_t *object) msg_Warn(vd, "chroma %s invalid, using default", chroma); free(chroma); - } - else + } else sys->chroma = 0; /* tty handling */ @@ -253,14 +254,14 @@ static int Open(vlc_object_t *object) Close(VLC_OBJECT(vd)); return VLC_EGENERIC; } + vout_display_DeleteWindow(vd, NULL); /* */ video_format_t fmt = vd->fmt; if (sys->chroma) { fmt.i_chroma = sys->chroma; - } - else { + } else { /* Assume RGB */ msg_Dbg(vd, "%d bppd", sys->var_info.bits_per_pixel); @@ -309,7 +310,7 @@ static int Open(vlc_object_t *object) vd->prepare = NULL; vd->display = Display; vd->control = Control; - vd->manage = Manage; + vd->manage = NULL; /* */ vout_display_SendEventFullscreen(vd, true); @@ -364,7 +365,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count) } return sys->pool; } -static void Display(vout_display_t *vd, picture_t *picture) +static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture) { vout_display_sys_t *sys = vd->sys; @@ -389,6 +390,7 @@ static void Display(vout_display_t *vd, picture_t *picture) picture_Copy(sys->picture, picture); picture_Release(picture); + VLC_UNUSED(subpicture); } static int Control(vout_display_t *vd, int query, va_list args) { @@ -407,24 +409,6 @@ static int Control(vout_display_t *vd, int query, va_list args) return VLC_EGENERIC; } } -static void Manage (vout_display_t *vd) -{ - VLC_UNUSED(vd); -#if 0 - /* - * Size change - */ - if (vd->i_changes & VOUT_SIZE_CHANGE) - { - msg_Dbg(vd, "reinitializing framebuffer screen"); - vd->i_changes &= ~VOUT_SIZE_CHANGE; - - vout_display_SendEventDisplaySize(); - - ClearScreen(vd->sys); - } -#endif -} /* following functions are local */ static int TtyInit(vout_display_t *vd) @@ -458,6 +442,7 @@ static int TtyInit(vout_display_t *vd) ioctl(sys->tty, VT_RELDISP, VT_ACKACQ); +#if 0 /* Set-up tty signal handler to be aware of tty changes */ struct sigaction sig_tty; memset(&sig_tty, 0, sizeof(sig_tty)); @@ -469,6 +454,7 @@ static int TtyInit(vout_display_t *vd) /* FIXME SIGUSR1 could have succeed */ goto error_signal; } +#endif /* Set-up tty according to new signal handler */ if (-1 == ioctl(sys->tty, VT_GETMODE, &sys->vt_mode)) { @@ -488,9 +474,11 @@ static int TtyInit(vout_display_t *vd) return VLC_SUCCESS; error: +#if 0 sigaction(SIGUSR1, &sys->sig_usr1, NULL); sigaction(SIGUSR2, &sys->sig_usr2, NULL); error_signal: +#endif tcsetattr(0, 0, &sys->old_termios); TextMode(sys->tty); return VLC_EGENERIC; @@ -502,9 +490,11 @@ static void TtyExit(vout_display_t *vd) /* Reset the terminal */ ioctl(sys->tty, VT_SETMODE, &sys->vt_mode); +#if 0 /* Remove signal handlers */ sigaction(SIGUSR1, &sys->sig_usr1, NULL); sigaction(SIGUSR2, &sys->sig_usr2, NULL); +#endif /* Reset the keyboard state */ tcsetattr(0, 0, &sys->old_termios); @@ -522,12 +512,12 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution) char *psz_device; /* framebuffer device path */ /* Open framebuffer device */ - if (!(psz_device = config_GetPsz(vd, FB_DEV_VAR))) { + if (!(psz_device = var_InheritString(vd, FB_DEV_VAR))) { msg_Err(vd, "don't know which fb device to open"); return VLC_EGENERIC; } - sys->fd = utf8_open(psz_device, O_RDWR); + sys->fd = vlc_open(psz_device, O_RDWR); if (sys->fd == -1) { msg_Err(vd, "cannot open %s (%m)", psz_device); free(psz_device); @@ -703,6 +693,7 @@ static void CloseDisplay(vout_display_t *vd) } } +#if 0 /***************************************************************************** * SwitchDisplay: VT change signal handler ***************************************************************************** @@ -711,8 +702,6 @@ static void CloseDisplay(vout_display_t *vd) *****************************************************************************/ static void SwitchDisplay(int i_signal) { - VLC_UNUSED(i_signal); -#if 0 vout_display_t *vd; vlc_mutex_lock(&p_vout_bank->lock); @@ -740,8 +729,8 @@ static void SwitchDisplay(int i_signal) } vlc_mutex_unlock(&p_vout_bank->lock); -#endif } +#endif /***************************************************************************** * TextMode and GfxMode : switch tty to text/graphic mode