diff options
-rw-r--r-- | include/xine.h.tmpl.in | 24 | ||||
-rw-r--r-- | po/POTFILES.in | 9 | ||||
-rw-r--r-- | src/xine-engine/tvmode.c | 118 |
3 files changed, 103 insertions, 48 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in index c059e6b1b..3a330aba7 100644 --- a/include/xine.h.tmpl.in +++ b/include/xine.h.tmpl.in @@ -28,7 +28,7 @@ \endverbatim */ /* - * $Id: xine.h.tmpl.in,v 1.101 2002/06/23 19:34:36 guenter Exp $ + * $Id: xine.h.tmpl.in,v 1.102 2002/07/09 12:45:17 f1rmb Exp $ * */ @@ -1999,22 +1999,23 @@ char *xine_set_locale(void); * @{ */ /** - * \fn void xine_tvmode_init (); + * \fn void xine_tvmode_init (xine_t *self); * \brief connect to nvtvd server and save current TV and X settings - * \param none + * \param self xine object. */ -void xine_tvmode_init (void); +void xine_tvmode_init (xine_t *self); /** - * \fn void xine_tvmode_exit (); + * \fn void xine_tvmode_exit (xine_t *self); * \brief restore old TV and X settings and close nvtvd connection - * \param none + * \param self xine object. */ -void xine_tvmode_exit (void); +void xine_tvmode_exit (xine_t *self); /** - * \fn int xine_tvmode_switch (int type, int width, int height, double fps); + * \fn int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps); * \brief try to change TV state if enabled + * \param self xine object. * \param type select 'regular' (0) or 'TV' (1) state * \param width frame width the mode should match best or 0 if unknown * \param height frame height the mode should match best or 0 if unknown @@ -2022,17 +2023,18 @@ void xine_tvmode_exit (void); * \return finally selected state * \sa xine_tvmode_init(), xine_tvmode_exit(), xine_tvmode_size() */ -int xine_tvmode_switch (int type, int width, int height, double fps); +int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps); /** - * \fn void xine_tvmode_size (int *width, int *height, double *pixelaspect, double *fps); + * \fn void xine_tvmode_size (xine_t *self, int *width, int *height, double *pixelaspect, double *fps); * \brief addapt (maximum) output size to visible area if necessary and return pixel aspect and real frame rate if available + * \param self xine object. * \param width output width to be adapted or NULL * \param height output height to be adapted or NULL * \param pixelaspect pixel aspect to be adapted or NULL * \param frame rate of current TV mode to be adapted or NULL */ -void xine_tvmode_size (int *width, int *height, double *pixelaspect, double *fps); +void xine_tvmode_size (xine_t *self, int *width, int *height, double *pixelaspect, double *fps); /** @} end of xine_tvmode */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 0c5f44ff7..4729db1f5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -20,6 +20,10 @@ src/demuxers/demux_cda.c src/demuxers/demux_film.c src/demuxers/demux_mpeg_block.c src/demuxers/demux_roq.c +src/demuxers/demux_fli.c +src/demuxers/demux_idcin.c +src/demuxers/demux_smjpeg.c +src/demuxers/demux_wav.c src/input/input_net.c src/input/input_rtp.c src/input/input_stdin_fifo.c @@ -41,6 +45,7 @@ src/video_out/video_out_sdl.c src/video_out/video_out_opengl.c src/video_out/video_out_directfb.c src/video_out/video_out_vidix.c +src/xine-engine/tvmode.c src/xine-engine/video_out.c src/xine-engine/xine.c src/xine-engine/audio_out.c @@ -48,12 +53,12 @@ src/xine-engine/osd.c src/xine-engine/load_plugins.c src/liblpcm/xine_decoder.c src/libffmpeg/xine_decoder.c +src/dxr3/video_out_dxr3.c src/dxr3/dxr3.h src/dxr3/dxr3_decode_spu.c src/dxr3/dxr3_decode_video.c -src/dxr3/dxr3_mpeg_encoders.c src/dxr3/dxr3_scr.c -src/dxr3/video_out_dxr3.c +src/dxr3/dxr3_mpeg_encoders.c src/libmad/xine_decoder.c src/liba52/xine_decoder.c src/libdts/xine_decoder.c diff --git a/src/xine-engine/tvmode.c b/src/xine-engine/tvmode.c index 653b1eba9..e0434523f 100644 --- a/src/xine-engine/tvmode.c +++ b/src/xine-engine/tvmode.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: tvmode.c,v 1.3 2002/06/25 14:42:58 mroi Exp $ + * $Id: tvmode.c,v 1.4 2002/07/09 12:45:18 f1rmb Exp $ * * tvmode - TV output selection * @@ -35,6 +35,8 @@ #include "nvtvd.h" /* FIXME: how to include that? */ /*#include "xine.h" */ +#include "xine_internal.h" +#include "xineutils.h" /* @@ -51,6 +53,9 @@ static double current_fps; static TVCrtRegs old_crt; static TVRegs old_tv; +static int tvmode_enabled; +static int was_enabled = 0; + /* TODO: config, and better */ static TVSystem opt_system = TV_SYSTEM_PAL; @@ -81,10 +86,25 @@ static int opt_flicker = -1; static double opt_aspect = 4.0 / 3.0; /* Just turn off warnings */ -void xine_tvmode_exit (void); +static void _tvmode_init(xine_t *this); +void xine_tvmode_exit (xine_t *this); + +/* + * Config callback for tvmode enability. + */ +static void nvtvmode_enable_cb(void *this_gen, cfg_entry_t *entry) { + xine_t *this = (xine_t *) this_gen; + + tvmode_enabled = entry->num_value; + + if(!tvmode_enabled && was_enabled) { + xine_tvmode_exit(this); + was_enabled = 0; + } +} /* Try to connect to nvtvd server */ -static void tvmode_connect () { +static void tvmode_connect(xine_t *this) { CardInfo *card = 0; @@ -98,35 +118,37 @@ static void tvmode_connect () { back_card = 0; } - if (back_card) - back_card->openCard (card); + if (back_card) { + back_card->openCard (card); + was_enabled = 1; + } else - printf("tvmode: cannot connect to nvtvd - no TV mode switching available\n"); + printf("tvmode: cannot connect to nvtvd - no TV mode switching available\n"); } /* Disconnect from server */ -static void tvmode_disconnect () { +static void tvmode_disconnect (xine_t *this) { back_card->closeCard (); back_card = 0; } /* Save current CRT and TV register configuration */ -static void tvmode_savestate () { +static void tvmode_savestate (xine_t *this) { back_card->getMode (&old_crt, &old_tv); } /* Restore CRT and TV register configuration */ -static void tvmode_restorestate () { +static void tvmode_restorestate (xine_t *this) { back_card->setMode (0, &old_crt, &old_tv); current_type = 0; } /* Set CRT and TV registers to given TV-Out configuration */ -static void tvmode_settvstate (int width, int height, double fps) { +static void tvmode_settvstate (xine_t *this, int width, int height, double fps) { TVSettings settings; TVMode mode; @@ -169,7 +191,7 @@ static void tvmode_settvstate (int width, int height, double fps) { current_type = 1; } else { printf("tvmode: cannot find any valid TV mode - TV output disabled\n"); - xine_tvmode_exit (); + xine_tvmode_exit (this); } } @@ -179,59 +201,85 @@ static void tvmode_settvstate (int width, int height, double fps) { */ /* Set to 'regular'(0) or 'tv'(1) state, that is if it is enabled */ -int xine_tvmode_switch (int type, int width, int height, double fps) { - +int xine_tvmode_switch (xine_t *this, int type, int width, int height, double fps) { + + if(tvmode_enabled) { + + /* + * Wasn't initialized + */ + if(!was_enabled) + _tvmode_init(this); + if (back_card) { printf("tvmode: switching to %s\n", type ? "TV" : "default"); switch (type) { case 0: - tvmode_restorestate (); - break; + tvmode_restorestate (this); + break; case 1: - tvmode_settvstate (width, height, fps); + tvmode_settvstate (this, width, height, fps); break; default: printf("tvmode: illegal type for switching\n"); - tvmode_restorestate (); + tvmode_restorestate (this); } } else { printf("tvmode: not connected to nvtvd for switching\n"); } - return current_type; + + } + + return current_type; } /* Addapt (maximum) output size to visible area and set pixel aspect and fps */ -void xine_tvmode_size (int *width, int *height, +void xine_tvmode_size (xine_t *this, int *width, int *height, double *pixelratio, double *fps) { + if(tvmode_enabled) { + switch (current_type) { case 1: - if (width && *width > current_width) - *width = current_width; - if (height && *height > current_height) - *height = current_height; - if (pixelratio) - *pixelratio = ((double) current_width / current_height) / opt_aspect; - if (fps) - *fps = current_fps; - break; + if (width && *width > current_width) + *width = current_width; + if (height && *height > current_height) + *height = current_height; + if (pixelratio) + *pixelratio = ((double) current_width / current_height) / opt_aspect; + if (fps) + *fps = current_fps; + break; } + + } } /* Connect to nvtvd server if possible and fetch settings */ -void xine_tvmode_init () { - tvmode_connect (); +static void _tvmode_init(xine_t *this) { + if(tvmode_enabled) { + tvmode_connect (this); if (back_card) - tvmode_savestate (); + tvmode_savestate (this); + } +} +void xine_tvmode_init (xine_t *this) { + + tvmode_enabled = this->config->register_bool(this->config, "misc.nv_tvmode", 0, + _("Show status on play, pause, ff, ..."), NULL, + nvtvmode_enable_cb, this); + _tvmode_init(this); } - /* Restore old CRT and TV registers and close nvtvd connection */ -void xine_tvmode_exit () { +void xine_tvmode_exit (xine_t *this) { + + if(tvmode_enabled || was_enabled) { if (back_card) { - tvmode_restorestate (); - tvmode_disconnect (); + tvmode_restorestate (this); + tvmode_disconnect (this); } + } } |