Commit a92603f2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Merged OSD functionality on the same core functions. All OSD functionality is...

Merged OSD functionality on the same core functions. All OSD functionality is described in include/vlc_osd.h now, which entirely replace include/osd.h. The file src/video_output/video_widgets.c uses functionality from src/osd/osd_widgets.c now.
parent 89ae1690
......@@ -86,7 +86,6 @@ HEADERS_include = \
include/modules_inner.h \
include/mtime.h \
include/network.h \
include/osd.h \
include/os_specific.h \
include/snapshot.h \
include/stream_output.h \
......@@ -430,6 +429,8 @@ SOURCES_libvlc_common = \
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 \
......
/*****************************************************************************
* 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 ) );
/*****************************************************************************
* osd.h - OSD menu definitions and function prototypes
* vlc_osd.h - OSD menu definitions and function prototypes
*****************************************************************************
* Copyright (C) 2004-2005 M2X
* $Id: osd.h 9451 2004-12-01 01:07:08Z jpsaman $
* $Id: vlc_osd.h 9451 2004-12-01 01:07:08Z jpsaman $
*
* Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
*
* Added code from include/osd.h written by:
* Copyright (C) 2003-2005 the VideoLAN team
* 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
......@@ -63,7 +67,7 @@ extern "C" {
# endif
/**
* The OSD Menu configuration file format.
* \brief The OSD Menu configuration file format.
*
* The configuration file syntax is very basic and so is its parser. See the
* BNF formal representation below:
......@@ -95,6 +99,37 @@ extern "C" {
*
*/
/**
* OSD menu position and picture type defines
*/
#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 };
/**
* OSD menu button states
*
......@@ -372,6 +407,29 @@ static inline void osd_SetMenuUpdate( osd_menu_t *p_osd, vlc_bool_t b_value )
var_Set( p_osd, "osd-menu-update", val );
}
/**
* Textual feedback
*
* Functions that provide the textual feedback on the OSD. They are shown on hotkey commands. The feedback
* is also part of the osd_button_t object. The types are declared in the include file
* include/vlc_osd.h
* @see vlc_osd.h
*/
VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
VLC_EXPORT( void,osd_Message, ( spu_t *, int, char *, ... ) );
/**
* Default feedback images
*
* Functions that provide the default OSD feedback images on hotkey commands. These feedback
* images are also part of the osd_button_t object. The types are declared in the include file
* include/vlc_osd.h
* @see vlc_osd.h
*/
VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, short ) );
VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, short ) );
/**
* Loading and parse the OSD Configuration file
*
......
......@@ -22,6 +22,7 @@ int playlist_ItemDelete (playlist_item_t *);
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 *);
......@@ -52,6 +53,7 @@ int __vout_AllocatePicture (vlc_object_t *p_this, picture_t *p_pic, uint32_t i_c
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);
......@@ -65,6 +67,7 @@ void __sout_CfgParse (vlc_object_t *, char *psz_prefix, const char **ppsz_option
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 *);
......@@ -157,8 +160,8 @@ void EndMD5 (struct md5_s *);
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);
......@@ -176,8 +179,8 @@ int playlist_Enable (playlist_t *, playlist_item_t *);
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 *);
......@@ -245,8 +248,8 @@ const char * aout_FormatPrintChannels (const audio_sample_format_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 *);
......@@ -280,6 +283,7 @@ int playlist_LockReplace (playlist_t *,playlist_item_t *, input_item_t*);
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 *);
......@@ -372,6 +376,7 @@ int playlist_NodeGroup (playlist_t *, int,playlist_item_t *,playlist_item_t **,i
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);
......@@ -808,10 +813,10 @@ struct module_symbols_t
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 *);
......@@ -839,6 +844,9 @@ struct module_symbols_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
......@@ -1215,8 +1223,10 @@ struct module_symbols_t
# 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
......@@ -1241,6 +1251,9 @@ struct module_symbols_t
# 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.
......@@ -1620,8 +1633,10 @@ struct module_symbols_t
((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; \
......@@ -1646,10 +1661,11 @@ struct module_symbols_t
((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; \
......
......@@ -347,6 +347,82 @@ VLC_EXPORT( int, __vout_InitPicture, ( vlc_object_t *p_this, picture_t *p_pic, u
__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 */
......@@ -31,7 +31,7 @@
#include <vlc/vout.h>
#include "vlc_keys.h"
#include <osd.h>
#include <vlc_osd.h>
#include <errno.h>
#include <time.h>
......
......@@ -31,7 +31,7 @@
#include <vlc/decoder.h>
#include <vlc/intf.h>
#include <osd.h>
#include <vlc_osd.h>
#include "charset.h"
......
......@@ -41,7 +41,7 @@
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <osd.h>
#include <vlc_osd.h>
#include "vlc_keys.h"
......
......@@ -29,7 +29,7 @@
#include <vlc/vout.h>
#include <vlc/decoder.h>
#include "osd.h"
#include "vlc_osd.h"
#include "vlc_filter.h"
#include "charset.h"
......
......@@ -5,7 +5,7 @@
#include <vlc/aout.h>
#include <vlc_demux.h>
#include <osd.h>
#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
......
......@@ -32,7 +32,7 @@
#include <vlc/input.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <osd.h>
#include <vlc_osd.h>
#include "vlc_keys.h"
......@@ -243,9 +243,9 @@ static void Run( intf_thread_t *p_intf )
{
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;
}
}
......
......@@ -34,7 +34,7 @@
#include "vout.h"
#include "open.h"
#include "controls.h"
#include <osd.h>
#include <vlc_osd.h>
/*****************************************************************************
* VLCControls implementation
......
......@@ -49,7 +49,7 @@
#import "bookmarks.h"
#include "playlist.h"
#include "controls.h"
#include "osd.h"
#include "vlc_osd.h"
#include "misc.h"
/*****************************************************************************
......@@ -1607,7 +1607,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
}
#endif
/* We add the "VLCPlaylistItemPboardType" type to be able to recognize
a Drop operation coming from the playlist.
a Drop operation com�ng from the playlist.
We need to add NSFilenamesPboardType otherwise the outlineview refuses
to the drop. */
......
......@@ -34,7 +34,7 @@
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "osd.h"
#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
......
......@@ -33,7 +33,7 @@
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "osd.h"
#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
......
......@@ -29,7 +29,7 @@
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "osd.h"
#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_filter.h"
......
......@@ -36,7 +36,7 @@
#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
......
......@@ -34,7 +34,7 @@
#include "vlc_filter.h"
#include "filter_common.h"
#include "vlc_image.h"
#include "osd.h"
#include "vlc_osd.h"
#ifdef LoadImage
# undef LoadImage
......
......@@ -32,7 +32,7 @@
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
#include "vlc_osd.h"
/*****************************************************************************
* Local prototypes
......
......@@ -32,7 +32,6 @@
#include <vlc_filter.h>
#include <vlc_video.h>
#include <osd.h>
#include <vlc_osd.h>
/*****************************************************************************
......
......@@ -32,7 +32,7 @@
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
#include "vlc_osd.h"
#include "vlc_block.h"
#include "vlc_stream.h"
......
......@@ -34,7 +34,7 @@
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
#include "vlc_osd.h"
/*****************************************************************************
* Local prototypes
......
......@@ -28,7 +28,7 @@
#include <vlc/aout.h>
#include <vlc_demux.h>
#include <osd.h>
#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
......
......@@ -28,7 +28,7 @@
#include <vlc/aout.h>
#include <vlc_demux.h>
#include <osd.h>
#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
......
......@@ -28,7 +28,7 @@
#include <vlc/aout.h>
#include <vlc_demux.h>
#include <osd.h>
#include <vlc_osd.h>
#define HAS_SNAPSHOT 1
......
......@@ -92,7 +92,6 @@
#include "aout_internal.h"
#include "stream_output.h"
#include "osd.h"
#include "vlc_httpd.h"
#include "vlc_acl.h"
#include "vlc_tls.h"
......
/*****************************************************************************
* 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 );
}
}
This diff is collapsed.
......@@ -21,9 +21,9 @@
* 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
......@@ -123,7 +123,6 @@ void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
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 );
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment