Changeset a92603f2093140f93c34f301a22eb5763abc4232
- Timestamp:
- 27/08/05 18:40:23 (3 years ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (2 diffs)
- include/osd.h (deleted)
- include/vlc_osd.h (modified) (4 diffs)
- include/vlc_symbols.h (modified) (14 diffs)
- include/vlc_video.h (modified) (1 diff)
- modules/access_filter/record.c (modified) (1 diff)
- modules/codec/cmml/cmml.c (modified) (1 diff)
- modules/codec/cmml/intf.c (modified) (1 diff)
- modules/codec/subsdec.c (modified) (1 diff)
- modules/control/corba/mediacontrol-core.c (modified) (1 diff)
- modules/control/hotkeys.c (modified) (2 diffs)
- modules/gui/macosx/controls.m (modified) (1 diff)
- modules/gui/macosx/playlist.m (modified) (2 diffs)
- modules/misc/freetype.c (modified) (1 diff)
- modules/misc/svg.c (modified) (1 diff)
- modules/misc/win32text.c (modified) (1 diff)
- modules/stream_out/transcode.c (modified) (1 diff)
- modules/video_filter/logo.c (modified) (1 diff)
- modules/video_filter/marq.c (modified) (1 diff)
- modules/video_filter/osdmenu.c (modified) (1 diff)
- modules/video_filter/rss.c (modified) (1 diff)
- modules/video_filter/time.c (modified) (1 diff)
- src/control/audio_video.c (modified) (1 diff)
- src/control/core.c (modified) (1 diff)
- src/control/util.c (modified) (1 diff)
- src/misc/modules.c (modified) (1 diff)
- src/osd/osd_text.c (added)
- src/osd/osd_widgets.c (added)
- src/video_output/video_text.c (modified) (2 diffs)
- src/video_output/video_widgets.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r719db51 ra92603f 87 87 include/mtime.h \ 88 88 include/network.h \ 89 include/osd.h \90 89 include/os_specific.h \ 91 90 include/snapshot.h \ … … 431 430 src/osd/osd.c \ 432 431 src/osd/osd_parser.c \ 432 src/osd/osd_text.c \ 433 src/osd/osd_widgets.c \ 433 434 src/misc/charset.c \ 434 435 src/misc/httpd.c \ include/vlc_osd.h
r3740e6a ra92603f 1 1 /***************************************************************************** 2 * osd.h - OSD menu definitions and function prototypes2 * vlc_osd.h - OSD menu definitions and function prototypes 3 3 ***************************************************************************** 4 4 * Copyright (C) 2004-2005 M2X 5 * $Id: osd.h 9451 2004-12-01 01:07:08Z jpsaman $5 * $Id: vlc_osd.h 9451 2004-12-01 01:07:08Z jpsaman $ 6 6 * 7 7 * Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl> 8 * 9 * Added code from include/osd.h written by: 10 * Copyright (C) 2003-2005 the VideoLAN team 11 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> 8 12 * 9 13 * This program is free software; you can redistribute it and/or modify … … 64 68 65 69 /** 66 * The OSD Menu configuration file format.70 * \brief The OSD Menu configuration file format. 67 71 * 68 72 * The configuration file syntax is very basic and so is its parser. See the … … 97 101 98 102 /** 103 * OSD menu position and picture type defines 104 */ 105 106 #define OSD_ALIGN_LEFT 0x1 107 #define OSD_ALIGN_RIGHT 0x2 108 #define OSD_ALIGN_TOP 0x4 109 #define OSD_ALIGN_BOTTOM 0x8 110 111 #define OSD_HOR_SLIDER 1 112 #define OSD_VERT_SLIDER 2 113 114 #define OSD_PLAY_ICON 1 115 #define OSD_PAUSE_ICON 2 116 #define OSD_SPEAKER_ICON 3 117 #define OSD_MUTE_ICON 4 118 119 /** 120 * Text style information. 121 * This struct is currently ignored 122 */ 123 struct text_style_t 124 { 125 int i_size; 126 uint32_t i_color; 127 vlc_bool_t b_italic; 128 vlc_bool_t b_bold; 129 vlc_bool_t b_underline; 130 }; 131 static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE }; 132 133 /** 99 134 * OSD menu button states 100 135 * … … 374 409 375 410 /** 411 * Textual feedback 412 * 413 * Functions that provide the textual feedback on the OSD. They are shown on hotkey commands. The feedback 414 * is also part of the osd_button_t object. The types are declared in the include file 415 * include/vlc_osd.h 416 * @see vlc_osd.h 417 */ 418 VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t ) ); 419 VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) ); 420 VLC_EXPORT( void,osd_Message, ( spu_t *, int, char *, ... ) ); 421 422 /** 423 * Default feedback images 424 * 425 * Functions that provide the default OSD feedback images on hotkey commands. These feedback 426 * images are also part of the osd_button_t object. The types are declared in the include file 427 * include/vlc_osd.h 428 * @see vlc_osd.h 429 */ 430 VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, short ) ); 431 VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, short ) ); 432 433 /** 376 434 * Loading and parse the OSD Configuration file 377 435 * include/vlc_symbols.h
rfe927c0 ra92603f 23 23 int vlm_ScheduleSetup (vlm_schedule_t *, char *, char *); 24 24 vlc_acl_t * __ACL_Duplicate (vlc_object_t *p_this, const vlc_acl_t *p_acl); 25 int osd_Slider (vlc_object_t *, spu_t *, int, int, int, int, short); 25 26 int playlist_ServicesDiscoveryRemove (playlist_t *, const char *); 26 27 int playlist_NodeDelete (playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t); … … 53 54 void * vlc_readdir (void *); 54 55 int sout_AnnounceRegister (sout_instance_t *,session_descriptor_t*, announce_method_t*); 56 int osd_ShowTextRelative (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t); 55 57 void * __vlc_object_get (vlc_object_t *, int); 56 58 void vout_SynchroTrash (vout_synchro_t *); … … 66 68 int playlist_LockItemToNode (playlist_t *,playlist_item_t *); 67 69 void spu_Destroy (spu_t *); 70 int osd_Icon (vlc_object_t *, spu_t *, int, int, int, short); 68 71 char* httpd_ServerIP (httpd_client_t *cl, char *psz_ip); 69 72 int spu_Init (spu_t *); … … 158 161 int vlm_MediaSetup (vlm_t *, vlm_media_t *, char *, char *); 159 162 void sout_StreamDelete (sout_stream_t *); 163 int vout_ShowTextAbsolute (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); 160 164 void __osd_MenuDelete (vlc_object_t *, osd_menu_t *); 161 int vout_ShowTextAbsolute (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t);162 165 int sout_AnnounceUnRegister (sout_instance_t *,session_descriptor_t*); 163 166 vlc_bool_t vlc_ureduce (unsigned *, unsigned *, uint64_t, uint64_t, uint64_t); … … 177 180 char * vlc_strdup (const char *s); 178 181 playlist_item_t* __playlist_ItemNew (vlc_object_t *,const char *,const char *); 182 int __net_OpenTCP (vlc_object_t *p_this, const char *psz_host, int i_port); 179 183 int __var_Get (vlc_object_t *, const char *, vlc_value_t *); 180 int __net_OpenTCP (vlc_object_t *p_this, const char *psz_host, int i_port);181 184 void tls_ServerDelete (tls_server_t *); 182 185 unsigned int aout_FormatNbChannels (const audio_sample_format_t * p_format); … … 246 249 void httpd_StreamDelete (httpd_stream_t *); 247 250 image_handler_t * __image_HandlerCreate (vlc_object_t *); 251 void vout_OSDSlider (vlc_object_t *, int, int , short); 248 252 aout_buffer_t * aout_DecNewBuffer (aout_instance_t *, aout_input_t *, size_t); 249 void vout_OSDSlider (vlc_object_t *, int, int , short);250 253 int vout_ChromaCmp (uint32_t, uint32_t); 251 254 int sout_InputDelete (sout_packetizer_input_t *); … … 281 284 int input_Control (input_thread_t *, int i_query, ...); 282 285 int __aout_VolumeUp (vlc_object_t *, int, audio_volume_t *); 286 void osd_Message (spu_t *, int, char *, ...); 283 287 vout_thread_t * __vout_Request (vlc_object_t *, vout_thread_t *, video_format_t *); 284 288 void __osd_MenuUp (vlc_object_t *); … … 373 377 void __config_PutPsz (vlc_object_t *, const char *, const char *); 374 378 vlm_schedule_t * vlm_ScheduleNew (vlm_t *, char *); 379 int osd_ShowTextAbsolute (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); 375 380 void net_Close (int fd); 376 381 int __vlc_threads_init (vlc_object_t *); … … 809 814 int (*vlc_alphasort_inner) (const struct dirent **a, const struct dirent **b); 810 815 osd_state_t * (*__osd_StateChange_inner) (osd_state_t *, const int); 811 void *osd_Slider_deprecated;816 int (*osd_Slider_inner) (vlc_object_t *, spu_t *, int, int, int, int, short); 812 817 void (*osd_ConfigUnload_inner) (vlc_object_t *, osd_menu_t **); 813 818 void (*__osd_MenuShow_inner) (vlc_object_t *); 814 void *osd_Icon_deprecated;819 int (*osd_Icon_inner) (vlc_object_t *, spu_t *, int, int, int, short); 815 820 void *__osd_VolumeDown_deprecated; 816 821 void (*__osd_MenuNext_inner) (vlc_object_t *); … … 840 845 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); 841 846 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 *); 847 int (*osd_ShowTextRelative_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t); 848 void (*osd_Message_inner) (spu_t *, int, char *, ...); 849 int (*osd_ShowTextAbsolute_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); 842 850 }; 843 851 # if defined (__PLUGIN__) … … 1216 1224 # define vlc_alphasort (p_symbols)->vlc_alphasort_inner 1217 1225 # define __osd_StateChange (p_symbols)->__osd_StateChange_inner 1226 # define osd_Slider (p_symbols)->osd_Slider_inner 1218 1227 # define osd_ConfigUnload (p_symbols)->osd_ConfigUnload_inner 1219 1228 # define __osd_MenuShow (p_symbols)->__osd_MenuShow_inner 1229 # define osd_Icon (p_symbols)->osd_Icon_inner 1220 1230 # define __osd_MenuNext (p_symbols)->__osd_MenuNext_inner 1221 1231 # define __osd_MenuDelete (p_symbols)->__osd_MenuDelete_inner … … 1242 1252 # define __vlc_execve (p_symbols)->__vlc_execve_inner 1243 1253 # define httpd_HandlerNew (p_symbols)->httpd_HandlerNew_inner 1254 # define osd_ShowTextRelative (p_symbols)->osd_ShowTextRelative_inner 1255 # define osd_Message (p_symbols)->osd_Message_inner 1256 # define osd_ShowTextAbsolute (p_symbols)->osd_ShowTextAbsolute_inner 1244 1257 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 1245 1258 /****************************************************************** … … 1621 1634 ((p_symbols)->vlc_alphasort_inner) = vlc_alphasort; \ 1622 1635 ((p_symbols)->__osd_StateChange_inner) = __osd_StateChange; \ 1636 ((p_symbols)->osd_Slider_inner) = osd_Slider; \ 1623 1637 ((p_symbols)->osd_ConfigUnload_inner) = osd_ConfigUnload; \ 1624 1638 ((p_symbols)->__osd_MenuShow_inner) = __osd_MenuShow; \ 1639 ((p_symbols)->osd_Icon_inner) = osd_Icon; \ 1625 1640 ((p_symbols)->__osd_MenuNext_inner) = __osd_MenuNext; \ 1626 1641 ((p_symbols)->__osd_MenuDelete_inner) = __osd_MenuDelete; \ … … 1647 1662 ((p_symbols)->__vlc_execve_inner) = __vlc_execve; \ 1648 1663 ((p_symbols)->httpd_HandlerNew_inner) = httpd_HandlerNew; \ 1664 ((p_symbols)->osd_ShowTextRelative_inner) = osd_ShowTextRelative; \ 1665 ((p_symbols)->osd_Message_inner) = osd_Message; \ 1666 ((p_symbols)->osd_ShowTextAbsolute_inner) = osd_ShowTextAbsolute; \ 1649 1667 (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 1650 1668 (p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \ 1651 (p_symbols)->osd_Slider_deprecated = NULL; \1652 (p_symbols)->osd_Icon_deprecated = NULL; \1653 1669 (p_symbols)->__osd_VolumeDown_deprecated = NULL; \ 1654 1670 (p_symbols)->__osd_VolumeUp_deprecated = NULL; \ include/vlc_video.h
rca639cd ra92603f 348 348 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 ) ); 349 349 350 /** 351 * vout_ShowTextRelative 352 * 353 * Show text on the video for some time 354 * \param p_vout pointer to the vout the text is to be showed on 355 * \param i_channel Subpicture channel 356 * \param psz_string The text to be shown 357 * \param p_style Pointer to a struct with text style info 358 * \param i_flags flags for alignment and such 359 * \param i_hmargin horizontal margin in pixels 360 * \param i_vmargin vertical margin in pixels 361 * \param i_duration Amount of time the text is to be shown. 362 */ 363 VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) ); 364 365 /** 366 * vout_ShowTextAbsolute 367 * 368 * Show text on the video from a given start date to a given end date 369 * \param p_vout pointer to the vout the text is to be showed on 370 * \param i_channel Subpicture channel 371 * \param psz_string The text to be shown 372 * \param p_style Pointer to a struct with text style info 373 * \param i_flags flags for alignment and such 374 * \param i_hmargin horizontal margin in pixels 375 * \param i_vmargin vertical margin in pixels 376 * \param i_start the time when this string is to appear on the video 377 * \param i_stop the time when this string should stop to be displayed 378 * if this is 0 the string will be shown untill the next string 379 * is about to be shown 380 */ 381 VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) ); 382 383 /** 384 * vout_OSDMessage 385 * 386 * Write an informative message at the default location, 387 * for the default duration and only if the OSD option is enabled. 388 * \param p_caller The object that called the function. 389 * \param i_channel Subpicture channel 390 * \param psz_format printf style formatting 391 **/ 392 VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) ); 393 394 /** 395 * Same as __vlc_OSDMessage() but with automatic casting 396 */ 397 #if defined(HAVE_VARIADIC_MACROS) 398 # define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args ) 399 #else 400 # define vout_OSDMessage __vout_OSDMessage 401 #endif 402 403 /** 404 * vout_OSDSlider 405 * 406 * Display a slider on the video output. 407 * \param p_this The object that called the function. 408 * \param i_channel Subpicture channel 409 * \param i_postion Current position in the slider 410 * \param i_type Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER. 411 * @see vlc_osd.h 412 */ 413 VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) ); 414 415 /** 416 * vout_OSDIcon 417 * 418 * Display an Icon on the video output. 419 * \param p_this The object that called the function. 420 * \param i_channel Subpicture channel 421 * \param i_type Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON 422 * @see vlc_osd.h 423 */ 424 VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) ); 425 350 426 /**@}*/ 351 427 modules/access_filter/record.c
rfe087a3 ra92603f 32 32 33 33 #include "vlc_keys.h" 34 #include < osd.h>34 #include <vlc_osd.h> 35 35 #include <errno.h> 36 36 #include <time.h> modules/codec/cmml/cmml.c
rfe087a3 ra92603f 32 32 #include <vlc/intf.h> 33 33 34 #include < osd.h>34 #include <vlc_osd.h> 35 35 36 36 #include "charset.h" modules/codec/cmml/intf.c
rfe087a3 ra92603f 42 42 #include <vlc/vout.h> 43 43 44 #include < osd.h>44 #include <vlc_osd.h> 45 45 46 46 #include "vlc_keys.h" modules/codec/subsdec.c
rfe087a3 ra92603f 30 30 #include <vlc/decoder.h> 31 31 32 #include " osd.h"32 #include "vlc_osd.h" 33 33 #include "vlc_filter.h" 34 34 modules/control/corba/mediacontrol-core.c
r1bb3f90 ra92603f 6 6 #include <vlc_demux.h> 7 7 8 #include < osd.h>8 #include <vlc_osd.h> 9 9 10 10 #define HAS_SNAPSHOT 1 modules/control/hotkeys.c
r736c8e0 ra92603f 33 33 #include <vlc/vout.h> 34 34 #include <vlc/aout.h> 35 #include < osd.h>35 #include <vlc_osd.h> 36 36 37 37 #include "vlc_keys.h" … … 244 244 if( p_hotkeys[i].i_key == i_key ) 245 245 { 246 i_action = p_hotkeys[i].i_action;247 i_times = p_hotkeys[i].i_times; /* times key pressed within max. delta time */248 p_hotkeys[i].i_times = 0;246 i_action = p_hotkeys[i].i_action; 247 i_times = p_hotkeys[i].i_times; /* times key pressed within max. delta time */ 248 p_hotkeys[i].i_times = 0; 249 249 } 250 250 } modules/gui/macosx/controls.m
r09161bc ra92603f 35 35 #include "open.h" 36 36 #include "controls.h" 37 #include < osd.h>37 #include <vlc_osd.h> 38 38 39 39 /***************************************************************************** modules/gui/macosx/playlist.m
raeb0bfb ra92603f 50 50 #include "playlist.h" 51 51 #include "controls.h" 52 #include " osd.h"52 #include "vlc_osd.h" 53 53 #include "misc.h" 54 54 … … 1608 1608 #endif 1609 1609 /* We add the "VLCPlaylistItemPboardType" type to be able to recognize 1610 a Drop operation com� g from the playlist.1610 a Drop operation com�ng from the playlist. 1611 1611 We need to add NSFilenamesPboardType otherwise the outlineview refuses 1612 1612 to the drop. */ modules/misc/freetype.c
rfe087a3 ra92603f 35 35 #include <vlc/vlc.h> 36 36 #include <vlc/vout.h> 37 #include " osd.h"37 #include "vlc_osd.h" 38 38 #include "vlc_block.h" 39 39 #include "vlc_filter.h" modules/misc/svg.c
rfe087a3 ra92603f 34 34 #include <vlc/vlc.h> 35 35 #include <vlc/vout.h> 36 #include " osd.h"36 #include "vlc_osd.h" 37 37 #include "vlc_block.h" 38 38 #include "vlc_filter.h" modules/misc/win32text.c
rfe087a3 ra92603f 30 30 #include <vlc/vlc.h> 31 31 #include <vlc/vout.h> 32 #include " osd.h"32 #include "vlc_osd.h" 33 33 #include "vlc_block.h" 34 34 #include "vlc_filter.h" modules/stream_out/transcode.c
r265e634 ra92603f 37 37 #include <vlc/decoder.h> 38 38 #include "vlc_filter.h" 39 #include " osd.h"39 #include "vlc_osd.h" 40 40 41 41 #define MASTER_SYNC_MAX_DRIFT 100000 modules/video_filter/logo.c
r9097bc1 ra92603f 35 35 #include "filter_common.h" 36 36 #include "vlc_image.h" 37 #include " osd.h"37 #include "vlc_osd.h" 38 38 39 39 #ifdef LoadImage modules/video_filter/marq.c
rb7d8fb7 ra92603f 33 33 #include "vlc_filter.h" 34 34 #include "vlc_block.h" 35 #include " osd.h"35 #include "vlc_osd.h" 36 36 37 37 /***************************************************************************** modules/video_filter/osdmenu.c
ra78a663 ra92603f 33 33 #include <vlc_video.h> 34 34 35 #include <osd.h>36 35 #include <vlc_osd.h> 37 36 modules/video_filter/rss.c
r885fd4c ra92603f 33 33 #include "vlc_filter.h" 34 34 #include "vlc_block.h" 35 #include " osd.h"35 #include "vlc_osd.h" 36 36 37 37 #include "vlc_block.h" modules/video_filter/time.c
rfe087a3 ra92603f 35 35 #include "vlc_filter.h" 36 36 #include "vlc_block.h" 37 #include " osd.h"37 #include "vlc_osd.h" 38 38 39 39 /***************************************************************************** src/control/audio_video.c
rfe087a3 ra92603f 29 29 #include <vlc_demux.h> 30 30 31 #include < osd.h>31 #include <vlc_osd.h> 32 32 33 33 #define HAS_SNAPSHOT 1 src/control/core.c
rfe087a3 ra92603f 29 29 #include <vlc_demux.h> 30 30 31 #include < osd.h>31 #include <vlc_osd.h> 32 32 33 33 #define HAS_SNAPSHOT 1 src/control/util.c
rfe087a3 ra92603f 29 29 #include <vlc_demux.h> 30 30 31 #include < osd.h>31 #include <vlc_osd.h> 32 32 33 33 #define HAS_SNAPSHOT 1 src/misc/modules.c
r4f33bf8 ra92603f 93 93 94 94 #include "stream_output.h" 95 #include "osd.h"96 95 #include "vlc_httpd.h" 97 96 #include "vlc_acl.h" src/video_output/video_text.c
rfe087a3 ra92603f 22 22 *****************************************************************************/ 23 23 #include <vlc/vout.h> 24 #include "vlc_block.h"25 #include "vlc_filter.h"26 #include "osd.h"24 #include <vlc_block.h> 25 #include <vlc_filter.h> 26 #include <vlc_osd.h> 27 27 28 28 /** … … 124 124 125 125 p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE ); 126 127 126 if( p_vout ) 128 127 { src/video_output/video_widgets.c
r94e2f25 ra92603f 2 2 * video_widgets.c : OSD widgets manipulation functions 3 3 ***************************************************************************** 4 * Copyright (C) 2004 the VideoLAN team4 * Copyright (C) 2004-2005 the VideoLAN team 5 5 * $Id$ 6 6 * … … 27 27 #include <stdlib.h> /* free() */ 28 28 #include <vlc/vout.h> 29 #include < osd.h>29 #include <vlc_osd.h> 30 30 31 31 #include "vlc_video.h" 32 32 #include "vlc_filter.h" 33 34 #define STYLE_EMPTY 035 #define STYLE_FILLED 136 37 /*****************************************************************************38 * Local prototypes39 *****************************************************************************/40 static void DrawRect( subpicture_t *, int, int, int, int, short );41 static void DrawTriangle( subpicture_t *, int, int, int, int, short );42 static void CreatePicture( spu_t *, subpicture_t *, int, int, int, int );43 static subpicture_t *vout_CreateWidget( spu_t *, int );44 45 /*****************************************************************************46 * Draws a rectangle at the given position in the subpic.47 * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).48 *****************************************************************************/49 static void DrawRect( subpicture_t *p_subpic, int i_x1, int i_y1,50 int i_x2, int i_y2, short fill )51 {52 int x, y;53 uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;54 int i_pitch = p_subpic->p_region->picture.Y_PITCH;55 56 if( fill == STYLE_FILLED )57 {58 for( y = i_y1; y <= i_y2; y++ )59 {60 for( x = i_x1; x <= i_x2; x++ )61 {62 p_a[ x + i_pitch * y ] = 0xff;63 }64 }65 }66 else67 {68 for( y = i_y1; y <= i_y2; y++ )69 {70 p_a[ i_x1 + i_pitch * y ] = 0xff;71 p_a[ i_x2 + i_pitch * y ] = 0xff;72 }73 for( x = i_x1; x <= i_x2; x++ )74 {75 p_a[ x + i_pitch * i_y1 ] = 0xff;76 p_a[ x + i_pitch * i_y2 ] = 0xff;77 }78 }79 }80 81 /*****************************************************************************82 * Draws a triangle at the given position in the subpic.83 * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).84 *****************************************************************************/85 static void DrawTriangle( subpicture_t *p_subpic, int i_x1, int i_y1,86 int i_x2, int i_y2, short fill )87 {88 int x, y, i_mid, h;89 uint8_t *p_a = p_subpic->p_region->picture.A_PIXELS;90 int i_pitch = p_subpic->p_region->picture.Y_PITCH;91 92 i_mid = i_y1 + ( ( i_y2 - i_y1 ) >> 1 );93 94 if( i_x2 >= i_x1 )95 {96 if( fill == STYLE_FILLED )97 {98 for( y = i_y1; y <= i_mid; y++ )99 {100 h = y - i_y1;101 for( x = i_x1; x <= i_x1 + h && x <= i_x2; x++ )102 {103 p_a[ x + i_pitch * y ] = 0xff;104 p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;105 }106 }107 }108 else109 {110 for( y = i_y1; y <= i_mid; y++ )111 {112 h = y - i_y1;113 p_a[ i_x1 + i_pitch * y ] = 0xff;114 p_a[ i_x1 + h + i_pitch * y ] = 0xff;115 p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;116 p_a[ i_x1 + h + i_pitch * ( i_y2 - h ) ] = 0xff;117 }118 }119 }120 else121 {122 if( fill == STYLE_FILLED )123 {124 for( y = i_y1; y <= i_mid; y++ )125 {126 h = y - i_y1;127 for( x = i_x1; x >= i_x1 - h && x >= i_x2; x-- )128 {129 p_a[ x + i_pitch * y ] = 0xff;130 p_a[ x + i_pitch * ( i_y2 - h ) ] = 0xff;131 }132 }133 }134 else135 {136 for( y = i_y1; y <= i_mid; y++ )137 {138 h = y - i_y1;139 p_a[ i_x1 + i_pitch * y ] = 0xff;140 p_a[ i_x1 - h + i_pitch * y ] = 0xff;141 p_a[ i_x1 + i_pitch * ( i_y2 - h ) ] = 0xff;142 p_a[ i_x1 - h + i_pitch * ( i_y2 - h ) ] = 0xff;143 }144 }145 }146 }147 148 /*****************************************************************************149 * Create Picture: creates subpicture region and picture150 *****************************************************************************/151 static void CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,152 int i_x, int i_y, int i_width, int i_height )153 {154 uint8_t *p_y, *p_u, *p_v, *p_a;155 video_format_t fmt;156 int i_pitch;157 158 /* Create a new subpicture region */159 memset( &fmt, 0, sizeof(video_format_t) );160 fmt.i_chroma = VLC_FOURCC('Y','U','V','A');161 fmt.i_aspect = 0;162 fmt.i_width = fmt.i_visible_width = i_width;163 fmt.i_height = fmt.i_visible_height = i_height;164 fmt.i_x_offset = fmt.i_y_offset = 0;165 p_subpic->p_region = p_subpic->pf_create_region( VLC_OBJECT(p_spu), &fmt );166 if( !p_subpic->p_region )167 {168 msg_Err( p_spu, "cannot allocate SPU region" );169 return;170 }171 172 p_subpic->p_region->i_x = i_x;173 p_subpic->p_region->i_y = i_y;174 p_y = p_subpic->p_region->picture.Y_PIXELS;175 p_u = p_subpic->p_region->picture.U_PIXELS;176 p_v = p_subpic->p_region->picture.V_PIXELS;177 p_a = p_subpic->p_region->picture.A_PIXELS;178 i_pitch = p_subpic->p_region->picture.Y_PITCH;179 180 /* Initialize the region pixels (only the alpha will be changed later) */181 memset( p_y, 0xff, i_pitch * p_subpic->p_region->fmt.i_height );182 memset( p_u, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );183 memset( p_v, 0x80, i_pitch * p_subpic->p_region->fmt.i_height );184 memset( p_a, 0x00, i_pitch * p_subpic->p_region->fmt.i_height );185 }186 187 /*****************************************************************************188 * Creates and initializes an OSD widget.189 *****************************************************************************/190 subpicture_t *vout_CreateWidget( spu_t *p_spu, int i_channel )191 {192 subpicture_t *p_subpic;193 mtime_t i_now = mdate();194 195 /* Create and initialize a subpicture */196 p_subpic = spu_CreateSubpicture( p_spu );197 if( p_subpic == NULL ) return NULL;198 199 p_subpic->i_channel = i_channel;200 p_subpic->i_start = i_now;201 p_subpic->i_stop = i_now + 1200000;202 p_subpic->b_ephemer = VLC_TRUE;203 p_subpic->b_fade = VLC_TRUE;204 205 return p_subpic;206 }207 33 208 34 /***************************************************************************** … … 215 41 vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, 216 42 FIND_ANYWHERE ); 217 subpicture_t *p_subpic; 218 int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height; 219 220 if( p_vout == NULL ) 43 if( p_vout && ( config_GetInt( p_caller, "osd" ) || ( i_position >= 0 ) ) ) 221 44 { 222 return; 45 osd_Slider( p_caller, p_vout->p_spu, p_vout->render.i_width, 46 p_vout->render.i_height, i_channel, i_position, i_type ); 223 47 } 224 if( !config_GetInt( p_caller, "osd" ) || i_position < 0 )225 {226 vlc_object_release( p_vout );227 return;228 }229 p_subpic = vout_CreateWidget( p_vout->p_spu, i_channel );230 if( p_subpic == NULL )231 {232 return;233 }234 235 i_y_margin = p_vout->render.i_height / 10;236 i_x_margin = i_y_margin;237 if( i_type == OSD_HOR_SLIDER )238 {239 i_width = p_vout->render.i_width - 2 * i_x_margin;240 i_height = p_vout->render.i_height / 20;241 i_x = i_x_margin;242 i_y = p_vout->render.i_height - i_y_margin - i_height;243 }244 else245 {246 i_width = p_vout->render.i_width / 40;247 i_height = p_vout->render.i_height - 2 * i_y_margin;248 i_x = p_vout->render.i_width - i_x_margin - i_width;249 i_y = i_y_margin;250 }251 252 /* Create subpicture region and picture */253 CreatePicture( p_vout->p_spu, p_subpic, i_x, i_y, i_width, i_height );254 255 if( i_type == OSD_HOR_SLIDER )256 {257 int i_x_pos = ( i_width - 2 ) * i_position / 100;258 DrawRect( p_subpic, i_x_pos - 1, 2, i_x_pos + 1,259 i_height - 3, STYLE_FILLED );260 DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );261 }262 else if( i_type == OSD_VERT_SLIDER )263 {264 int i_y_pos = i_height / 2;265 DrawRect( p_subpic, 2, i_height - ( i_height - 2 ) * i_position / 100,266 i_width - 3, i_height - 3, STYLE_FILLED );267 DrawRect( p_subpic, 1, i_y_pos, 1, i_y_pos, STYLE_FILLED );268 DrawRect( p_subpic, i_width - 2, i_y_pos,269 i_width - 2, i_y_pos, STYLE_FILLED );270 DrawRect( p_subpic, 0, 0, i_width - 1, i_height - 1, STYLE_EMPTY );271 }272 273 spu_DisplaySubpicture( p_vout->p_spu, p_subpic );274 275 48 vlc_object_release( p_vout ); 276 return;277 49 } 278 50 … … 285 57 vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, 286 58 FIND_ANYWHERE ); 287 subpicture_t *p_subpic; 288 int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height; 289 290 if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) ) 59 if( p_vout && config_GetInt( p_caller, "osd" ) ) 291 60 { 292 return; 61 osd_Icon( p_caller, p_vout->p_spu, p_vout->render.i_width, 62 p_vout->render.i_height, i_channel, i_type ); 293 63 } 294 295 p_subpic = vout_CreateWidget( p_vout->p_spu, i_channel );296 if( p_subpic == NULL )297 {298
