include/modules_inner.h \
include/mtime.h \
include/network.h \
- include/osd.h \
include/os_specific.h \
include/snapshot.h \
include/stream_output.h \
src/stream_output/acl.c \
src/osd/osd.c \
src/osd/osd_parser.c \
+ src/osd/osd_text.c \
+ src/osd/osd_widgets.c \
src/misc/charset.c \
src/misc/httpd.c \
src/misc/tls.c \
+++ /dev/null
-/*****************************************************************************
- * osd.h : Constants for use with osd modules
- *****************************************************************************
- * Copyright (C) 2003 the VideoLAN team
- * $Id$
- *
- * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
- *
- * 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
- * (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.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-/**
- * \file
- * Stucts and function prototypes to place text on the video
- */
-
-#define OSD_ALIGN_LEFT 0x1
-#define OSD_ALIGN_RIGHT 0x2
-#define OSD_ALIGN_TOP 0x4
-#define OSD_ALIGN_BOTTOM 0x8
-
-#define OSD_HOR_SLIDER 1
-#define OSD_VERT_SLIDER 2
-
-#define OSD_PLAY_ICON 1
-#define OSD_PAUSE_ICON 2
-#define OSD_SPEAKER_ICON 3
-#define OSD_MUTE_ICON 4
-
-/**
- * Text style information.
- * This struct is currently ignored
- */
-struct text_style_t
-{
- int i_size;
- uint32_t i_color;
- vlc_bool_t b_italic;
- vlc_bool_t b_bold;
- vlc_bool_t b_underline;
-};
-static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE };
-
-VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
-VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
-VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
-/**
- * Same as __vlc_OSDMessage() but with automatic casting
- */
-#if defined(HAVE_VARIADIC_MACROS)
-# define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args )
-#else
-# define vout_OSDMessage __vout_OSDMessage
-#endif
-VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
-VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) );
/*****************************************************************************\r
- * osd.h - OSD menu definitions and function prototypes\r
+ * vlc_osd.h - OSD menu definitions and function prototypes\r
*****************************************************************************\r
* Copyright (C) 2004-2005 M2X\r
- * $Id: osd.h 9451 2004-12-01 01:07:08Z jpsaman $\r
+ * $Id: vlc_osd.h 9451 2004-12-01 01:07:08Z jpsaman $\r
*\r
* Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl>\r
*\r
+ * Added code from include/osd.h written by:\r
+ * Copyright (C) 2003-2005 the VideoLAN team\r
+ * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>\r
+ *\r
* This program is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
* the Free Software Foundation; either version 2 of the License, or\r
# endif\r
\r
/**\r
- * The OSD Menu configuration file format.\r
+ * \brief The OSD Menu configuration file format.\r
*\r
* The configuration file syntax is very basic and so is its parser. See the\r
* BNF formal representation below:\r
*\r
*/ \r
\r
+/**\r
+ * OSD menu position and picture type defines\r
+ */\r
+\r
+#define OSD_ALIGN_LEFT 0x1\r
+#define OSD_ALIGN_RIGHT 0x2\r
+#define OSD_ALIGN_TOP 0x4\r
+#define OSD_ALIGN_BOTTOM 0x8\r
+\r
+#define OSD_HOR_SLIDER 1\r
+#define OSD_VERT_SLIDER 2\r
+\r
+#define OSD_PLAY_ICON 1\r
+#define OSD_PAUSE_ICON 2\r
+#define OSD_SPEAKER_ICON 3\r
+#define OSD_MUTE_ICON 4\r
+\r
+/**\r
+ * Text style information.\r
+ * This struct is currently ignored\r
+ */\r
+struct text_style_t\r
+{\r
+ int i_size;\r
+ uint32_t i_color;\r
+ vlc_bool_t b_italic;\r
+ vlc_bool_t b_bold;\r
+ vlc_bool_t b_underline;\r
+};\r
+static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE };\r
+ \r
/**\r
* OSD menu button states\r
*\r
var_Set( p_osd, "osd-menu-update", val );\r
} \r
\r
+/**\r
+ * Textual feedback\r
+ *\r
+ * Functions that provide the textual feedback on the OSD. They are shown on hotkey commands. The feedback\r
+ * is also part of the osd_button_t object. The types are declared in the include file\r
+ * include/vlc_osd.h\r
+ * @see vlc_osd.h \r
+ */\r
+VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );\r
+VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );\r
+VLC_EXPORT( void,osd_Message, ( spu_t *, int, char *, ... ) );\r
+\r
+/**\r
+ * Default feedback images\r
+ *\r
+ * Functions that provide the default OSD feedback images on hotkey commands. These feedback\r
+ * images are also part of the osd_button_t object. The types are declared in the include file\r
+ * include/vlc_osd.h\r
+ * @see vlc_osd.h \r
+ */\r
+VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, short ) );\r
+VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, short ) );\r
+\r
/**\r
* Loading and parse the OSD Configuration file\r
*\r
osd_state_t * __osd_StateChange (osd_state_t *, const int);
int vlm_ScheduleSetup (vlm_schedule_t *, char *, char *);
vlc_acl_t * __ACL_Duplicate (vlc_object_t *p_this, const vlc_acl_t *p_acl);
+int osd_Slider (vlc_object_t *, spu_t *, int, int, int, int, short);
int playlist_ServicesDiscoveryRemove (playlist_t *, const char *);
int playlist_NodeDelete (playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t);
void vlm_MediaDelete (vlm_t *, vlm_media_t *, char *);
playlist_item_t * playlist_NodeCreate (playlist_t *,int,char *, playlist_item_t * p_parent);
void * vlc_readdir (void *);
int sout_AnnounceRegister (sout_instance_t *,session_descriptor_t*, announce_method_t*);
+int osd_ShowTextRelative (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t);
void * __vlc_object_get (vlc_object_t *, int);
void vout_SynchroTrash (vout_synchro_t *);
picture_t * vout_CreatePicture (vout_thread_t *, vlc_bool_t, vlc_bool_t, unsigned int);
vlm_media_t * vlm_MediaNew (vlm_t *, char *, int);
int playlist_LockItemToNode (playlist_t *,playlist_item_t *);
void spu_Destroy (spu_t *);
+int osd_Icon (vlc_object_t *, spu_t *, int, int, int, short);
char* httpd_ServerIP (httpd_client_t *cl, char *psz_ip);
int spu_Init (spu_t *);
void httpd_HostDelete (httpd_host_t *);
tls_server_t * tls_ServerCreate (vlc_object_t *, const char *, const char *);
int vlm_MediaSetup (vlm_t *, vlm_media_t *, char *, char *);
void sout_StreamDelete (sout_stream_t *);
-void __osd_MenuDelete (vlc_object_t *, osd_menu_t *);
int vout_ShowTextAbsolute (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t);
+void __osd_MenuDelete (vlc_object_t *, osd_menu_t *);
int sout_AnnounceUnRegister (sout_instance_t *,session_descriptor_t*);
vlc_bool_t vlc_ureduce (unsigned *, unsigned *, uint64_t, uint64_t, uint64_t);
httpd_host_t * httpd_HostNew (vlc_object_t *, const char *psz_host, int i_port);
playlist_item_t* __playlist_ItemCopy (vlc_object_t *,playlist_item_t*);
char * vlc_strdup (const char *s);
playlist_item_t* __playlist_ItemNew (vlc_object_t *,const char *,const char *);
-int __var_Get (vlc_object_t *, const char *, vlc_value_t *);
int __net_OpenTCP (vlc_object_t *p_this, const char *psz_host, int i_port);
+int __var_Get (vlc_object_t *, const char *, vlc_value_t *);
void tls_ServerDelete (tls_server_t *);
unsigned int aout_FormatNbChannels (const audio_sample_format_t * p_format);
int __vlc_mutex_destroy (char *, int, vlc_mutex_t *);
char * __config_GetPsz (vlc_object_t *, const char *);
void httpd_StreamDelete (httpd_stream_t *);
image_handler_t * __image_HandlerCreate (vlc_object_t *);
-aout_buffer_t * aout_DecNewBuffer (aout_instance_t *, aout_input_t *, size_t);
void vout_OSDSlider (vlc_object_t *, int, int , short);
+aout_buffer_t * aout_DecNewBuffer (aout_instance_t *, aout_input_t *, size_t);
int vout_ChromaCmp (uint32_t, uint32_t);
int sout_InputDelete (sout_packetizer_input_t *);
int playlist_Import (playlist_t *, const char *);
int __intf_Eject (vlc_object_t *, const char *);
int input_Control (input_thread_t *, int i_query, ...);
int __aout_VolumeUp (vlc_object_t *, int, audio_volume_t *);
+void osd_Message (spu_t *, int, char *, ...);
vout_thread_t * __vout_Request (vlc_object_t *, vout_thread_t *, video_format_t *);
void __osd_MenuUp (vlc_object_t *);
int __aout_VolumeDown (vlc_object_t *, int, audio_volume_t *);
playlist_item_t* playlist_ItemNewWithType (vlc_object_t *,const char *,const char *, int);
void __config_PutPsz (vlc_object_t *, const char *, const char *);
vlm_schedule_t * vlm_ScheduleNew (vlm_t *, char *);
+int osd_ShowTextAbsolute (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t);
void net_Close (int fd);
int __vlc_threads_init (vlc_object_t *);
void __vout_CopyPicture (vlc_object_t *p_this, picture_t *p_dst, picture_t *p_src);
int (*vlc_scandir_inner) (const char *name, struct dirent ***namelist, int (*filter) ( const struct dirent * ), int (*compar) ( const struct dirent **, const struct dirent ** ));
int (*vlc_alphasort_inner) (const struct dirent **a, const struct dirent **b);
osd_state_t * (*__osd_StateChange_inner) (osd_state_t *, const int);
- void *osd_Slider_deprecated;
+ int (*osd_Slider_inner) (vlc_object_t *, spu_t *, int, int, int, int, short);
void (*osd_ConfigUnload_inner) (vlc_object_t *, osd_menu_t **);
void (*__osd_MenuShow_inner) (vlc_object_t *);
- void *osd_Icon_deprecated;
+ int (*osd_Icon_inner) (vlc_object_t *, spu_t *, int, int, int, short);
void *__osd_VolumeDown_deprecated;
void (*__osd_MenuNext_inner) (vlc_object_t *);
void (*__osd_MenuDelete_inner) (vlc_object_t *, osd_menu_t *);
void (*httpd_HandlerDelete_inner) (httpd_handler_t *);
int (*__vlc_execve_inner) (vlc_object_t *p_object, int i_argc, char **pp_argv, char **pp_env, char *psz_cwd, char *p_in, int i_in, char **pp_data, int *pi_data);
httpd_handler_t * (*httpd_HandlerNew_inner) (httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_handler_callback_t pf_fill, httpd_handler_sys_t *);
+ int (*osd_ShowTextRelative_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t);
+ void (*osd_Message_inner) (spu_t *, int, char *, ...);
+ int (*osd_ShowTextAbsolute_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
# define vlc_scandir (p_symbols)->vlc_scandir_inner
# define vlc_alphasort (p_symbols)->vlc_alphasort_inner
# define __osd_StateChange (p_symbols)->__osd_StateChange_inner
+# define osd_Slider (p_symbols)->osd_Slider_inner
# define osd_ConfigUnload (p_symbols)->osd_ConfigUnload_inner
# define __osd_MenuShow (p_symbols)->__osd_MenuShow_inner
+# define osd_Icon (p_symbols)->osd_Icon_inner
# define __osd_MenuNext (p_symbols)->__osd_MenuNext_inner
# define __osd_MenuDelete (p_symbols)->__osd_MenuDelete_inner
# define __osd_MenuHide (p_symbols)->__osd_MenuHide_inner
# define httpd_HandlerDelete (p_symbols)->httpd_HandlerDelete_inner
# define __vlc_execve (p_symbols)->__vlc_execve_inner
# define httpd_HandlerNew (p_symbols)->httpd_HandlerNew_inner
+# define osd_ShowTextRelative (p_symbols)->osd_ShowTextRelative_inner
+# define osd_Message (p_symbols)->osd_Message_inner
+# define osd_ShowTextAbsolute (p_symbols)->osd_ShowTextAbsolute_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
((p_symbols)->vlc_scandir_inner) = vlc_scandir; \
((p_symbols)->vlc_alphasort_inner) = vlc_alphasort; \
((p_symbols)->__osd_StateChange_inner) = __osd_StateChange; \
+ ((p_symbols)->osd_Slider_inner) = osd_Slider; \
((p_symbols)->osd_ConfigUnload_inner) = osd_ConfigUnload; \
((p_symbols)->__osd_MenuShow_inner) = __osd_MenuShow; \
+ ((p_symbols)->osd_Icon_inner) = osd_Icon; \
((p_symbols)->__osd_MenuNext_inner) = __osd_MenuNext; \
((p_symbols)->__osd_MenuDelete_inner) = __osd_MenuDelete; \
((p_symbols)->__osd_MenuHide_inner) = __osd_MenuHide; \
((p_symbols)->httpd_HandlerDelete_inner) = httpd_HandlerDelete; \
((p_symbols)->__vlc_execve_inner) = __vlc_execve; \
((p_symbols)->httpd_HandlerNew_inner) = httpd_HandlerNew; \
+ ((p_symbols)->osd_ShowTextRelative_inner) = osd_ShowTextRelative; \
+ ((p_symbols)->osd_Message_inner) = osd_Message; \
+ ((p_symbols)->osd_ShowTextAbsolute_inner) = osd_ShowTextAbsolute; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \
- (p_symbols)->osd_Slider_deprecated = NULL; \
- (p_symbols)->osd_Icon_deprecated = NULL; \
(p_symbols)->__osd_VolumeDown_deprecated = NULL; \
(p_symbols)->__osd_VolumeUp_deprecated = NULL; \
(p_symbols)->VLC_CompileTime_deprecated = NULL; \
__vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f)
VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
+/**
+ * vout_ShowTextRelative
+ *
+ * Show text on the video for some time
+ * \param p_vout pointer to the vout the text is to be showed on
+ * \param i_channel Subpicture channel
+ * \param psz_string The text to be shown
+ * \param p_style Pointer to a struct with text style info
+ * \param i_flags flags for alignment and such
+ * \param i_hmargin horizontal margin in pixels
+ * \param i_vmargin vertical margin in pixels
+ * \param i_duration Amount of time the text is to be shown.
+ */
+VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
+
+/**
+ * vout_ShowTextAbsolute
+ *
+ * Show text on the video from a given start date to a given end date
+ * \param p_vout pointer to the vout the text is to be showed on
+ * \param i_channel Subpicture channel
+ * \param psz_string The text to be shown
+ * \param p_style Pointer to a struct with text style info
+ * \param i_flags flags for alignment and such
+ * \param i_hmargin horizontal margin in pixels
+ * \param i_vmargin vertical margin in pixels
+ * \param i_start the time when this string is to appear on the video
+ * \param i_stop the time when this string should stop to be displayed
+ * if this is 0 the string will be shown untill the next string
+ * is about to be shown
+ */
+VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
+
+/**
+ * vout_OSDMessage
+ *
+ * Write an informative message at the default location,
+ * for the default duration and only if the OSD option is enabled.
+ * \param p_caller The object that called the function.
+ * \param i_channel Subpicture channel
+ * \param psz_format printf style formatting
+ **/
+VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
+
+/**
+ * Same as __vlc_OSDMessage() but with automatic casting
+ */
+#if defined(HAVE_VARIADIC_MACROS)
+# define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args )
+#else
+# define vout_OSDMessage __vout_OSDMessage
+#endif
+
+/**
+ * vout_OSDSlider
+ *
+ * Display a slider on the video output.
+ * \param p_this The object that called the function.
+ * \param i_channel Subpicture channel
+ * \param i_postion Current position in the slider
+ * \param i_type Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
+ * @see vlc_osd.h
+ */
+VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
+
+/**
+ * vout_OSDIcon
+ *
+ * Display an Icon on the video output.
+ * \param p_this The object that called the function.
+ * \param i_channel Subpicture channel
+ * \param i_type Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
+ * @see vlc_osd.h
+ */
+VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) );
+
/**@}*/
#endif /* _VLC_VIDEO_H */
#include <vlc/vout.h>
#include "vlc_keys.h"
-#include <osd.h>
+#include <vlc_osd.h>
#include <errno.h>
#include <time.h>
#include <vlc/decoder.h>
#include <vlc/intf.h>
-#include <osd.h>
+#include <vlc_osd.h>
#include "charset.h"
#include <vlc/intf.h>
#include <vlc/vout.h>
-#include <osd.h>
+#include <vlc_osd.h>
#include "vlc_keys.h"
#include <vlc/vout.h>
#include <vlc/decoder.h>
-#include "osd.h"
+#include "vlc_osd.h"
#include "vlc_filter.h"
#include "charset.h"
#include <vlc/aout.h>
#include <vlc_demux.h>
-#include <osd.h>
+#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
#include <vlc/input.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
-#include <osd.h>
+#include <vlc_osd.h>
#include "vlc_keys.h"
{
if( p_hotkeys[i].i_key == i_key )
{
- i_action = p_hotkeys[i].i_action;
- i_times = p_hotkeys[i].i_times; /* times key pressed within max. delta time */
- p_hotkeys[i].i_times = 0;
+ i_action = p_hotkeys[i].i_action;
+ i_times = p_hotkeys[i].i_times; /* times key pressed within max. delta time */
+ p_hotkeys[i].i_times = 0;
}
}
#include "vout.h"
#include "open.h"
#include "controls.h"
-#include <osd.h>
+#include <vlc_osd.h>
/*****************************************************************************
* VLCControls implementation
#import "bookmarks.h"
#include "playlist.h"
#include "controls.h"
-#include "osd.h"
+#include "vlc_osd.h"
#include "misc.h"
/*****************************************************************************
}
#endif
/* We add the "VLCPlaylistItemPboardType" type to be able to recognize
- a Drop operation comçing from the playlist.
+ a Drop operation com�ng from the playlist.
We need to add NSFilenamesPboardType otherwise the outlineview refuses
to the drop. */
#include <vlc/vlc.h>
#include <vlc/vout.h>
-#include "osd.h"
+#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
#include <vlc/vlc.h>
#include <vlc/vout.h>
-#include "osd.h"
+#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
#include <vlc/vlc.h>
#include <vlc/vout.h>
-#include "osd.h"
+#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
#include <vlc/vout.h>
#include <vlc/decoder.h>
#include "vlc_filter.h"
-#include "osd.h"
+#include "vlc_osd.h"
#define MASTER_SYNC_MAX_DRIFT 100000
#include "vlc_filter.h"
#include "filter_common.h"
#include "vlc_image.h"
-#include "osd.h"
+#include "vlc_osd.h"
#ifdef LoadImage
# undef LoadImage
#include "vlc_filter.h"
#include "vlc_block.h"
-#include "osd.h"
+#include "vlc_osd.h"
/*****************************************************************************
* Local prototypes
#include <vlc_filter.h>
#include <vlc_video.h>
-#include <osd.h>
#include <vlc_osd.h>
/*****************************************************************************
#include "vlc_filter.h"
#include "vlc_block.h"
-#include "osd.h"
+#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_stream.h"
#include "vlc_filter.h"
#include "vlc_block.h"
-#include "osd.h"
+#include "vlc_osd.h"
/*****************************************************************************
* Local prototypes
#include <vlc/aout.h>
#include <vlc_demux.h>
-#include <osd.h>
+#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
#include <vlc/aout.h>
#include <vlc_demux.h>
-#include <osd.h>
+#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
#include <vlc/aout.h>
#include <vlc_demux.h>
-#include <osd.h>
+#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
#include "aout_internal.h"
#include "stream_output.h"
-#include "osd.h"
#include "vlc_httpd.h"
#include "vlc_acl.h"
#include "vlc_tls.h"
--- /dev/null
+/*****************************************************************************
+ * osd_text.c : text manipulation functions
+ *****************************************************************************
+ * Copyright (C) 1999-2005 the VideoLAN team
+ * $Id$
+ *
+ * Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
+ *
+ * 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
+ * (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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#include <vlc/vout.h>
+#include <vlc_block.h>
+#include <vlc_filter.h>
+#include <vlc_osd.h>
+
+/**
+ * \brief Show text on the video for some time
+ * \param p_spu pointer to the subpicture queue the text is to be showed on
+ * \param i_channel Subpicture channel
+ * \param psz_string The text to be shown
+ * \param p_style Pointer to a struct with text style info
+ * \param i_flags flags for alignment and such
+ * \param i_hmargin horizontal margin in pixels
+ * \param i_vmargin vertical margin in pixels
+ * \param i_duration Amount of time the text is to be shown.
+ */
+int osd_ShowTextRelative( spu_t *p_spu, int i_channel,
+ char *psz_string, text_style_t *p_style,
+ int i_flags, int i_hmargin, int i_vmargin,
+ mtime_t i_duration )
+{
+ mtime_t i_now = mdate();
+
+ return osd_ShowTextAbsolute( p_spu, i_channel, psz_string,
+ p_style, i_flags, i_hmargin, i_vmargin,
+ i_now, i_now + i_duration );
+}
+
+/**
+ * \brief Show text on the video from a given start date to a given end date
+ * \param p_spu pointer to the subpicture queue the text is to be showed on
+ * \param i_channel Subpicture channel
+ * \param psz_string The text to be shown
+ * \param p_style Pointer to a struct with text style info
+ * \param i_flags flags for alignment and such
+ * \param i_hmargin horizontal margin in pixels
+ * \param i_vmargin vertical margin in pixels
+ * \param i_start the time when this string is to appear on the video
+ * \param i_stop the time when this string should stop to be displayed
+ * if this is 0 the string will be shown untill the next string
+ * is about to be shown
+ */
+int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
+ char *psz_string, text_style_t *p_style,
+ int i_flags, int i_hmargin, int i_vmargin,
+ mtime_t i_start, mtime_t i_stop )
+{
+ subpicture_t *p_spu;
+ video_format_t fmt;
+
+ if( !psz_string ) return VLC_EGENERIC;
+
+ p_spu = spu_CreateSubpicture( p_spu_channel );
+ if( !p_spu ) return VLC_EGENERIC;
+
+ /* Create a new subpicture region */
+ memset( &fmt, 0, sizeof(video_format_t) );
+ fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+ fmt.i_aspect = 0;
+ fmt.i_width = fmt.i_height = 0;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_spu_channel), &fmt );
+ if( !p_spu->p_region )
+ {
+ msg_Err( p_spu_channel, "cannot allocate SPU region" );
+ spu_DestroySubpicture( p_spu_channel, p_spu );
+ return VLC_EGENERIC;
+ }
+
+ p_spu->p_region->psz_text = strdup( psz_string );
+ p_spu->i_start = i_start;
+ p_spu->i_stop = i_stop;
+ p_spu->b_ephemer = VLC_TRUE;
+ p_spu->b_absolute = VLC_FALSE;
+
+ p_spu->i_x = i_hmargin;
+ p_spu->i_y = i_vmargin;
+ p_spu->i_flags = i_flags;
+ p_spu->i_channel = i_channel;
+
+ spu_DisplaySubpicture( p_spu_channel, p_spu );
+
+ return VLC_SUCCESS;
+}
+
+
+/**
+ * \brief Write an informative message at the default location,
+ * for the default duration and only if the OSD option is enabled.
+ * \param p_caller The object that called the function.
+ * \param i_channel Subpicture channel
+ * \param psz_format printf style formatting
+ **/
+void osd_Message( spu_t *p_spu, int i_channel,
+ char *psz_format, ... )
+{
+ char *psz_string;
+ va_list args;
+
+ if( p_spu )
+ {
+ va_start( args, psz_format );
+ vasprintf( &psz_string, psz_format, args );
+
+ osd_ShowTextRelative( p_spu, i_channel, psz_string, NULL,
+ OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
+
+ free( psz_string );
+ va_end( args );
+ }
+}
--- /dev/null
+/*****************************************************************************
+ * osd_widgets.c : OSD widgets manipulation functions
+ *****************************************************************************
+ * Copyright (C) 2004-2005 the VideoLAN team
+ * $Id$
+ *
+ * Author: Yoann Peronneau <yoann@videolan.org>
+ *
+ * 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
+ * (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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include <stdlib.h> /* free() */
+#include <vlc/vout.h>
+#include <vlc_osd.h>
+
+#include <vlc_video.h>
+#include <vlc_filter.h>
+
+#define STYLE_EMPTY 0
+#define STYLE_FILLED 1
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static void DrawRect( subpicture_t *, int, int, int, int, short );
+static void DrawTriangle( subpicture_t *, int, int, int, int, short );
+static int CreatePicture( spu_t *, subpicture_t *, int, int, int, int );
+static subpicture_t *osd_CreateWidget( spu_t *, int );
+
+/*****************************************************************************
+ * Draws a rectangle at the given position in the subpic.
+ * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
+ *****************************************************************************/
+static void DrawRect( subpicture_t *p_subpic, int i_x1, int i_y1,
+ int i_x2, int i_y2, short fill )
+{
+ int x, y;
+ uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
+ int i_pitch = p_subpic->p_region->picture.Y_PITCH;
+
+ if( fill == STYLE_FILLED )
+ {
+ for( y = i_y1; y <= i_y2; y++ )
+ {
+ for( x = i_x1; x <= i_x2; x++ )
+ {
+ p_a[ x + i_pitch * y ] = 0xff;
+ }
+ }
+ }
+ else
+ {
+ for( y = i_y1; y <= i_y2; y++ )
+ {
+ p_a[ i_x1 + i_pitch * y ] = 0xff;
+ p_a[ i_x2 + i_pitch * y ] = 0xff;
+ }
+ for( x = i_x1; x <= i_x2; x++ )
+ {
+ p_a[ x + i_pitch * i_y1 ] = 0xff;
+ p_a[ x + i_pitch * i_y2 ] = 0xff;
+ }
+ }
+}
+
+/*****************************************************************************
+ * Draws a triangle at the given position in the subpic.
+ * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
+ *****************************************************************************/
+static void DrawTriangle( subpicture_t *p_subpic, int i_x1, int i_y1,
+ int i_x2, int i_y2, short fill )
+{
+ int x, y, i_mid, h;
+ uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
+ int i_pitch = p_subpic->p_region->picture.Y_PITCH;
+
+ i_mid = i_y1 + ( ( i_y2 - i_y1 ) >> 1 );
+
+ if( i_x2 >= i_x1 )
+ {
+ if( fill == STYLE_FILLED )
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ for( x = i_x1; x <= i_x1 + h && x <= i_x2; x++ )
+ {
+ p_a[ x + i_pitch * y ] = 0xff;
+ p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;
+ }
+ }
+ }
+ else
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ p_a[ i_x1 + i_pitch * y ] = 0xff;
+ p_a[ i_x1 + h + i_pitch * y ] = 0xff;
+ p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;
+ p_a[ i_x1 + h + i_pitch * ( i_y2 - h ) ] = 0xff;
+ }
+ }
+ }
+ else
+ {
+ if( fill == STYLE_FILLED )
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ for( x = i_x1; x >= i_x1 - h && x >= i_x2; x-- )
+ {
+ p_a[ x + i_pitch * y ] = 0xff;
+ p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;
+ }
+ }
+ }
+ else
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ p_a[ i_x1 + i_pitch * y ] = 0xff;
+ p_a[ i_x1 - h + i_pitch * y ] = 0xff;
+ p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;
+ p_a[ i_x1 - h + i_pitch * ( i_y2 - h ) ] = 0xff;
+ }
+ }
+ }
+}
+
+/*****************************************************************************
+ * Create Picture: creates subpicture region and picture
+ *****************************************************************************/
+static int CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,
+ int i_x, int i_y, int i_width, int i_height )
+{
+ uint8_t *p_y, *p_u, *p_v, *p_a;
+ video_format_t fmt;
+ int i_pitch;
+
+ /* Create a new subpicture region */
+ memset( &fmt, 0, sizeof(video_format_t) );
+ fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+ fmt.i_aspect = 0;
+ fmt.i_width = fmt.i_visible_width = i_width;
+ fmt.i_height = fmt.i_visible_height = i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ p_subpic->p_region = p_subpic->pf_create_region( VLC_OBJECT(p_spu), &fmt );
+ if( !p_subpic->p_region )
+ {
+ msg_Err( p_spu, "cannot allocate SPU region" );
+ return VLC_EGENERIC;
+ }
+
+ p_subpic->p_region->i_x = i_x;
+ p_subpic->p_region->i_y = i_y;
+ p_y = p_subpic->p_region->picture.Y_PIXELS;
+ p_u = p_subpic->p_region->picture.U_PIXELS;
+ p_v = p_subpic->p_region->picture.V_PIXELS;
+ p_a = p_subpic->p_region->picture.A_PIXELS;
+ i_pitch = p_subpic->p_region->picture.Y_PITCH;
+
+ /* Initialize the region pixels (only the alpha will be changed later) */
+ memset( p_y, 0xff, i_pitch * p_subpic->p_region->fmt.i_height );
+ memset( p_u, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );
+ memset( p_v, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );
+ memset( p_a, 0x00, i_pitch * p_subpic->p_region->fmt.i_height );
+
+ return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * Creates and initializes an OSD widget.
+ *****************************************************************************/
+subpicture_t *osd_CreateWidget( spu_t *p_spu, int i_channel )
+{
+ subpicture_t *p_subpic;
+ mtime_t i_now = mdate();
+
+ /* Create and initialize a subpicture */
+ p_subpic = spu_CreateSubpicture( p_spu );
+ if( p_subpic == NULL ) return NULL;
+
+ p_subpic->i_channel = i_channel;
+ p_subpic->i_start = i_now;
+ p_subpic->i_stop = i_now + 1200000;
+ p_subpic->b_ephemer = VLC_TRUE;
+ p_subpic->b_fade = VLC_TRUE;
+
+ return p_subpic;
+}
+
+/*****************************************************************************
+ * Displays an OSD slider.
+ * Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
+ *****************************************************************************/
+int osd_Slider( vlc_object_t *p_this, spu_t *p_spu,
+ int i_render_width, int i_render_height,
+ int i_channel, int i_position, short i_type )
+{
+ subpicture_t *p_subpic;
+ int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height;
+
+ p_subpic = osd_CreateWidget( p_spu, i_channel );
+ if( p_subpic == NULL )
+ {
+ return VLC_EGENERIC;
+ }
+
+ i_y_margin = i_render_height / 10;
+ i_x_margin = i_y_margin;
+ if( i_type == OSD_HOR_SLIDER )
+ {
+ i_width = i_render_width - 2 * i_x_margin;
+ i_height = i_render_height / 20;
+ i_x = i_x_margin;
+ i_y = i_render_height - i_y_margin - i_height;
+ }
+ else
+ {
+ i_width = i_render_width / 40;
+ i_height = i_render_height - 2 * i_y_margin;
+ i_x = i_render_width - i_x_margin - i_width;
+ i_y = i_y_margin;
+ }
+
+ /* Create subpicture region and picture */
+ CreatePicture( p_spu, p_subpic, i_x, i_y, i_width, i_height );
+
+ if( i_type == OSD_HOR_SLIDER )
+ {
+ int i_x_pos = ( i_width - 2 ) * i_position / 100;
+ DrawRect( p_subpic, i_x_pos - 1, 2, i_x_pos + 1,
+ i_height - 3, STYLE_FILLED );
+ DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );
+ }
+ else if( i_type == OSD_VERT_SLIDER )
+ {
+ int i_y_pos = i_height / 2;
+ DrawRect( p_subpic, 2, i_height - ( i_height - 2 ) * i_position / 100,
+ i_width - 3, i_height - 3, STYLE_FILLED );
+ DrawRect( p_subpic, 1, i_y_pos, 1, i_y_pos, STYLE_FILLED );
+ DrawRect( p_subpic, i_width - 2, i_y_pos,
+ i_width - 2, i_y_pos, STYLE_FILLED );
+ DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );
+ }
+
+ spu_DisplaySubpicture( p_spu, p_subpic );
+
+ return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * Displays an OSD icon.
+ * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
+ *****************************************************************************/
+int osd_Icon( vlc_object_t *p_this, spu_t *p_spu,
+ int i_render_width, int i_render_height, int i_channel, short i_type )
+{
+ subpicture_t *p_subpic;
+ int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height;
+
+ p_subpic = osd_CreateWidget( p_spu, i_channel );
+ if( p_subpic == NULL )
+ {
+ return VLC_EGENERIC;
+ }
+
+ i_y_margin = i_render_height / 15;
+ i_x_margin = i_y_margin;
+ i_width = i_render_width / 20;
+ i_height = i_width;
+ i_x = i_render_width - i_x_margin - i_width;
+ i_y = i_y_margin;
+
+ /* Create subpicture region and picture */
+ CreatePicture( p_spu, p_subpic, i_x, i_y, i_width, i_height );
+
+ if( i_type == OSD_PAUSE_ICON )
+ {
+ int i_bar_width = i_width / 3;
+ DrawRect( p_subpic, 0, 0, i_bar_width - 1, i_height -1, STYLE_FILLED );
+ DrawRect( p_subpic, i_width - i_bar_width, 0,
+ i_width - 1, i_height - 1, STYLE_FILLED );
+ }
+ else if( i_type == OSD_PLAY_ICON )
+ {
+ int i_mid = i_height >> 1;
+ int i_delta = ( i_width - i_mid ) >> 1;
+ int i_y2 = ( ( i_height - 1 ) >> 1 ) * 2;
+ DrawTriangle( p_subpic, i_delta, 0, i_width - i_delta, i_y2,
+ STYLE_FILLED );
+ }
+ else if( i_type == OSD_SPEAKER_ICON || i_type == OSD_MUTE_ICON )
+ {
+ int i_mid = i_height >> 1;
+ int i_delta = ( i_width - i_mid ) >> 1;
+ int i_y2 = ( ( i_height - 1 ) >> 1 ) * 2;
+ DrawRect( p_subpic, i_delta, i_mid / 2, i_width - i_delta,
+ i_height - 1 - i_mid / 2, STYLE_FILLED );
+ DrawTriangle( p_subpic, i_width - i_delta, 0, i_delta, i_y2,
+ STYLE_FILLED );
+ if( i_type == OSD_MUTE_ICON )
+ {
+ uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
+ int i_pitch = p_subpic->p_region->picture.Y_PITCH;
+ int i;
+ for( i = 1; i < i_pitch; i++ )
+ {
+ int k = i + ( i_height - i - 1 ) * i_pitch;
+ p_a[ k ] = 0xff - p_a[ k ];
+ }
+ }
+ }
+
+ spu_DisplaySubpicture( p_spu, p_subpic );
+
+ return VLC_SUCCESS;
+}
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc/vout.h>
-#include "vlc_block.h"
-#include "vlc_filter.h"
-#include "osd.h"
+#include <vlc_block.h>
+#include <vlc_filter.h>
+#include <vlc_osd.h>
/**
* \brief Show text on the video for some time
if( !config_GetInt( p_caller, "osd" ) ) return;
p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE );
-
if( p_vout )
{
va_start( args, psz_format );
/*****************************************************************************
* video_widgets.c : OSD widgets manipulation functions
*****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
+ * Copyright (C) 2004-2005 the VideoLAN team
* $Id$
*
* Author: Yoann Peronneau <yoann@videolan.org>
*****************************************************************************/
#include <stdlib.h> /* free() */
#include <vlc/vout.h>
-#include <osd.h>
+#include <vlc_osd.h>
#include "vlc_video.h"
#include "vlc_filter.h"
-#define STYLE_EMPTY 0
-#define STYLE_FILLED 1
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static void DrawRect( subpicture_t *, int, int, int, int, short );
-static void DrawTriangle( subpicture_t *, int, int, int, int, short );
-static void CreatePicture( spu_t *, subpicture_t *, int, int, int, int );
-static subpicture_t *vout_CreateWidget( spu_t *, int );
-
-/*****************************************************************************
- * Draws a rectangle at the given position in the subpic.
- * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
- *****************************************************************************/
-static void DrawRect( subpicture_t *p_subpic, int i_x1, int i_y1,
- int i_x2, int i_y2, short fill )
-{
- int x, y;
- uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
- int i_pitch = p_subpic->p_region->picture.Y_PITCH;
-
- if( fill == STYLE_FILLED )
- {
- for( y = i_y1; y <= i_y2; y++ )
- {
- for( x = i_x1; x <= i_x2; x++ )
- {
- p_a[ x + i_pitch * y ] = 0xff;
- }
- }
- }
- else
- {
- for( y = i_y1; y <= i_y2; y++ )
- {
- p_a[ i_x1 + i_pitch * y ] = 0xff;
- p_a[ i_x2 + i_pitch * y ] = 0xff;
- }
- for( x = i_x1; x <= i_x2; x++ )
- {
- p_a[ x + i_pitch * i_y1 ] = 0xff;
- p_a[ x + i_pitch * i_y2 ] = 0xff;
- }
- }
-}
-
-/*****************************************************************************
- * Draws a triangle at the given position in the subpic.
- * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
- *****************************************************************************/
-static void DrawTriangle( subpicture_t *p_subpic, int i_x1, int i_y1,
- int i_x2, int i_y2, short fill )
-{
- int x, y, i_mid, h;
- uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
- int i_pitch = p_subpic->p_region->picture.Y_PITCH;
-
- i_mid = i_y1 + ( ( i_y2 - i_y1 ) >> 1 );
-
- if( i_x2 >= i_x1 )
- {
- if( fill == STYLE_FILLED )
- {
- for( y = i_y1; y <= i_mid; y++ )
- {
- h = y - i_y1;
- for( x = i_x1; x <= i_x1 + h && x <= i_x2; x++ )
- {
- p_a[ x + i_pitch * y ] = 0xff;
- p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;
- }
- }
- }
- else
- {
- for( y = i_y1; y <= i_mid; y++ )
- {
- h = y - i_y1;
- p_a[ i_x1 + i_pitch * y ] = 0xff;
- p_a[ i_x1 + h + i_pitch * y ] = 0xff;
- p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;
- p_a[ i_x1 + h + i_pitch * ( i_y2 - h ) ] = 0xff;
- }
- }
- }
- else
- {
- if( fill == STYLE_FILLED )
- {
- for( y = i_y1; y <= i_mid; y++ )
- {
- h = y - i_y1;
- for( x = i_x1; x >= i_x1 - h && x >= i_x2; x-- )
- {
- p_a[ x + i_pitch * y ] = 0xff;
- p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;
- }
- }
- }
- else
- {
- for( y = i_y1; y <= i_mid; y++ )
- {
- h = y - i_y1;
- p_a[ i_x1 + i_pitch * y ] = 0xff;
- p_a[ i_x1 - h + i_pitch * y ] = 0xff;
- p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;
- p_a[ i_x1 - h + i_pitch * ( i_y2 - h ) ] = 0xff;
- }
- }
- }
-}
-
-/*****************************************************************************
- * Create Picture: creates subpicture region and picture
- *****************************************************************************/
-static void CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,
- int i_x, int i_y, int i_width, int i_height )
-{
- uint8_t *p_y, *p_u, *p_v, *p_a;
- video_format_t fmt;
- int i_pitch;
-
- /* Create a new subpicture region */
- memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
- fmt.i_aspect = 0;
- fmt.i_width = fmt.i_visible_width = i_width;
- fmt.i_height = fmt.i_visible_height = i_height;
- fmt.i_x_offset = fmt.i_y_offset = 0;
- p_subpic->p_region = p_subpic->pf_create_region( VLC_OBJECT(p_spu), &fmt );
- if( !p_subpic->p_region )
- {
- msg_Err( p_spu, "cannot allocate SPU region" );
- return;
- }
-
- p_subpic->p_region->i_x = i_x;
- p_subpic->p_region->i_y = i_y;
- p_y = p_subpic->p_region->picture.Y_PIXELS;
- p_u = p_subpic->p_region->picture.U_PIXELS;
- p_v = p_subpic->p_region->picture.V_PIXELS;
- p_a = p_subpic->p_region->picture.A_PIXELS;
- i_pitch = p_subpic->p_region->picture.Y_PITCH;
-
- /* Initialize the region pixels (only the alpha will be changed later) */
- memset( p_y, 0xff, i_pitch * p_subpic->p_region->fmt.i_height );
- memset( p_u, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );
- memset( p_v, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );
- memset( p_a, 0x00, i_pitch * p_subpic->p_region->fmt.i_height );
-}
-
-/*****************************************************************************
- * Creates and initializes an OSD widget.
- *****************************************************************************/
-subpicture_t *vout_CreateWidget( spu_t *p_spu, int i_channel )
-{
- subpicture_t *p_subpic;
- mtime_t i_now = mdate();
-
- /* Create and initialize a subpicture */
- p_subpic = spu_CreateSubpicture( p_spu );
- if( p_subpic == NULL ) return NULL;
-
- p_subpic->i_channel = i_channel;
- p_subpic->i_start = i_now;
- p_subpic->i_stop = i_now + 1200000;
- p_subpic->b_ephemer = VLC_TRUE;
- p_subpic->b_fade = VLC_TRUE;
-
- return p_subpic;
-}
-
/*****************************************************************************
* Displays an OSD slider.
* Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
{
vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
- subpicture_t *p_subpic;
- int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height;
-
- if( p_vout == NULL )
- {
- return;
- }
- if( !config_GetInt( p_caller, "osd" ) || i_position < 0 )
- {
- vlc_object_release( p_vout );
- return;
- }
- p_subpic = vout_CreateWidget( p_vout->p_spu, i_channel );
- if( p_subpic == NULL )
- {
- return;
- }
-
- i_y_margin = p_vout->render.i_height / 10;
- i_x_margin = i_y_margin;
- if( i_type == OSD_HOR_SLIDER )
- {
- i_width = p_vout->render.i_width - 2 * i_x_margin;
- i_height = p_vout->render.i_height / 20;
- i_x = i_x_margin;
- i_y = p_vout->render.i_height - i_y_margin - i_height;
- }
- else
- {
- i_width = p_vout->render.i_width / 40;
- i_height = p_vout->render.i_height - 2 * i_y_margin;
- i_x = p_vout->render.i_width - i_x_margin - i_width;
- i_y = i_y_margin;
- }
-
- /* Create subpicture region and picture */
- CreatePicture( p_vout->p_spu, p_subpic, i_x, i_y, i_width, i_height );
-
- if( i_type == OSD_HOR_SLIDER )
+ if( p_vout && ( config_GetInt( p_caller, "osd" ) || ( i_position >= 0 ) ) )
{
- int i_x_pos = ( i_width - 2 ) * i_position / 100;
- DrawRect( p_subpic, i_x_pos - 1, 2, i_x_pos + 1,
- i_height - 3, STYLE_FILLED );
- DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );
+ osd_Slider( p_caller, p_vout->p_spu, p_vout->render.i_width,
+ p_vout->render.i_height, i_channel, i_position, i_type );
}
- else if( i_type == OSD_VERT_SLIDER )
- {
- int i_y_pos = i_height / 2;
- DrawRect( p_subpic, 2, i_height - ( i_height - 2 ) * i_position / 100,
- i_width - 3, i_height - 3, STYLE_FILLED );
- DrawRect( p_subpic, 1, i_y_pos, 1, i_y_pos, STYLE_FILLED );
- DrawRect( p_subpic, i_width - 2, i_y_pos,
- i_width - 2, i_y_pos, STYLE_FILLED );
- DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );
- }
-
- spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
-
vlc_object_release( p_vout );
- return;
}
/*****************************************************************************
{
vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
- subpicture_t *p_subpic;
- int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height;
-
- if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) )
+ if( p_vout && config_GetInt( p_caller, "osd" ) )
{
- return;
+ osd_Icon( p_caller, p_vout->p_spu, p_vout->render.i_width,
+ p_vout->render.i_height, i_channel, i_type );
}
-
- p_subpic = vout_CreateWidget( p_vout->p_spu, i_channel );
- if( p_subpic == NULL )
- {
- return;
- }
-
- i_y_margin = p_vout->render.i_height / 15;
- i_x_margin = i_y_margin;
- i_width = p_vout->render.i_width / 20;
- i_height = i_width;
- i_x = p_vout->render.i_width - i_x_margin - i_width;
- i_y = i_y_margin;
-
- /* Create subpicture region and picture */
- CreatePicture( p_vout->p_spu, p_subpic, i_x, i_y, i_width, i_height );
-
- if( i_type == OSD_PAUSE_ICON )
- {
- int i_bar_width = i_width / 3;
- DrawRect( p_subpic, 0, 0, i_bar_width - 1, i_height -1, STYLE_FILLED );
- DrawRect( p_subpic, i_width - i_bar_width, 0,
- i_width - 1, i_height - 1, STYLE_FILLED );
- }
- else if( i_type == OSD_PLAY_ICON )
- {
- int i_mid = i_height >> 1;
- int i_delta = ( i_width - i_mid ) >> 1;
- int i_y2 = ( ( i_height - 1 ) >> 1 ) * 2;
- DrawTriangle( p_subpic, i_delta, 0, i_width - i_delta, i_y2,
- STYLE_FILLED );
- }
- else if( i_type == OSD_SPEAKER_ICON || i_type == OSD_MUTE_ICON )
- {
- int i_mid = i_height >> 1;
- int i_delta = ( i_width - i_mid ) >> 1;
- int i_y2 = ( ( i_height - 1 ) >> 1 ) * 2;
- DrawRect( p_subpic, i_delta, i_mid / 2, i_width - i_delta,
- i_height - 1 - i_mid / 2, STYLE_FILLED );
- DrawTriangle( p_subpic, i_width - i_delta, 0, i_delta, i_y2,
- STYLE_FILLED );
- if( i_type == OSD_MUTE_ICON )
- {
- uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;
- int i_pitch = p_subpic->p_region->picture.Y_PITCH;
- int i;
- for( i = 1; i < i_pitch; i++ )
- {
- int k = i + ( i_height - i - 1 ) * i_pitch;
- p_a[ k ] = 0xff - p_a[ k ];
- }
- }
- }
-
- spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
-
vlc_object_release( p_vout );
- return;
}