Changeset a92603f2093140f93c34f301a22eb5763abc4232

Show
Ignore:
Timestamp:
27/08/05 18:40:23 (3 years ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1125160823 +0000
git-parent:

[89ae1690f9c9bcc71d45c30da3938ece83dd1e5a]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1125160823 +0000
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r719db51 ra92603f  
    8787    include/mtime.h \ 
    8888    include/network.h \ 
    89     include/osd.h \ 
    9089    include/os_specific.h \ 
    9190    include/snapshot.h \ 
     
    431430    src/osd/osd.c \ 
    432431    src/osd/osd_parser.c \ 
     432    src/osd/osd_text.c \ 
     433    src/osd/osd_widgets.c \ 
    433434    src/misc/charset.c \ 
    434435    src/misc/httpd.c \ 
  • include/vlc_osd.h

    r3740e6a ra92603f  
    11/***************************************************************************** 
    2  * osd.h - OSD menu definitions and function prototypes 
     2 * vlc_osd.h - OSD menu definitions and function prototypes 
    33 ***************************************************************************** 
    44 * 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 $ 
    66 * 
    77 * 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> 
    812 * 
    913 * This program is free software; you can redistribute it and/or modify 
     
    6468 
    6569/** 
    66  * The OSD Menu configuration file format. 
     70 * \brief The OSD Menu configuration file format. 
    6771 * 
    6872 * The configuration file syntax is very basic and so is its parser. See the 
     
    97101 
    98102/** 
     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 */ 
     123struct 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}; 
     131static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE }; 
     132  
     133/** 
    99134 * OSD menu button states 
    100135 * 
     
    374409 
    375410/** 
     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 */ 
     418VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t ) ); 
     419VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) ); 
     420VLC_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 */ 
     430VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, short ) ); 
     431VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, short ) ); 
     432 
     433/** 
    376434 * Loading and parse the OSD Configuration file 
    377435 * 
  • include/vlc_symbols.h

    rfe927c0 ra92603f  
    2323int vlm_ScheduleSetup (vlm_schedule_t *, char *, char *); 
    2424vlc_acl_t * __ACL_Duplicate (vlc_object_t *p_this, const vlc_acl_t *p_acl); 
     25int osd_Slider (vlc_object_t *, spu_t *, int, int, int, int, short); 
    2526int playlist_ServicesDiscoveryRemove (playlist_t *, const char *); 
    2627int playlist_NodeDelete (playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t); 
     
    5354void * vlc_readdir (void *); 
    5455int sout_AnnounceRegister (sout_instance_t *,session_descriptor_t*, announce_method_t*); 
     56int osd_ShowTextRelative (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t); 
    5557void * __vlc_object_get (vlc_object_t *, int); 
    5658void vout_SynchroTrash (vout_synchro_t *); 
     
    6668int playlist_LockItemToNode (playlist_t *,playlist_item_t *); 
    6769void spu_Destroy (spu_t *); 
     70int osd_Icon (vlc_object_t *, spu_t *, int, int, int, short); 
    6871char* httpd_ServerIP (httpd_client_t *cl, char *psz_ip); 
    6972int spu_Init (spu_t *); 
     
    158161int vlm_MediaSetup (vlm_t *, vlm_media_t *, char *, char *); 
    159162void sout_StreamDelete (sout_stream_t *); 
     163int vout_ShowTextAbsolute (vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); 
    160164void __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); 
    162165int sout_AnnounceUnRegister (sout_instance_t *,session_descriptor_t*); 
    163166vlc_bool_t vlc_ureduce (unsigned *, unsigned *, uint64_t, uint64_t, uint64_t); 
     
    177180char * vlc_strdup (const char *s); 
    178181playlist_item_t* __playlist_ItemNew (vlc_object_t *,const char *,const char *); 
     182int __net_OpenTCP (vlc_object_t *p_this, const char *psz_host, int i_port); 
    179183int __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); 
    181184void tls_ServerDelete (tls_server_t *); 
    182185unsigned int aout_FormatNbChannels (const audio_sample_format_t * p_format); 
     
    246249void httpd_StreamDelete (httpd_stream_t *); 
    247250image_handler_t * __image_HandlerCreate (vlc_object_t *); 
     251void vout_OSDSlider (vlc_object_t *, int, int , short); 
    248252aout_buffer_t * aout_DecNewBuffer (aout_instance_t *, aout_input_t *, size_t); 
    249 void vout_OSDSlider (vlc_object_t *, int, int , short); 
    250253int vout_ChromaCmp (uint32_t, uint32_t); 
    251254int sout_InputDelete (sout_packetizer_input_t *); 
     
    281284int input_Control (input_thread_t *, int i_query, ...); 
    282285int __aout_VolumeUp (vlc_object_t *, int, audio_volume_t *); 
     286void osd_Message (spu_t *, int, char *, ...); 
    283287vout_thread_t * __vout_Request (vlc_object_t *, vout_thread_t *, video_format_t *); 
    284288void __osd_MenuUp (vlc_object_t *); 
     
    373377void __config_PutPsz (vlc_object_t *, const char *, const char *); 
    374378vlm_schedule_t * vlm_ScheduleNew (vlm_t *, char *); 
     379int osd_ShowTextAbsolute (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); 
    375380void net_Close (int fd); 
    376381int __vlc_threads_init (vlc_object_t *); 
     
    809814    int (*vlc_alphasort_inner) (const struct dirent **a, const struct dirent **b); 
    810815    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)
    812817    void (*osd_ConfigUnload_inner) (vlc_object_t *, osd_menu_t **); 
    813818    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)
    815820    void *__osd_VolumeDown_deprecated; 
    816821    void (*__osd_MenuNext_inner) (vlc_object_t *); 
     
    840845    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); 
    841846    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); 
    842850}; 
    843851#  if defined (__PLUGIN__) 
     
    12161224#  define vlc_alphasort (p_symbols)->vlc_alphasort_inner 
    12171225#  define __osd_StateChange (p_symbols)->__osd_StateChange_inner 
     1226#  define osd_Slider (p_symbols)->osd_Slider_inner 
    12181227#  define osd_ConfigUnload (p_symbols)->osd_ConfigUnload_inner 
    12191228#  define __osd_MenuShow (p_symbols)->__osd_MenuShow_inner 
     1229#  define osd_Icon (p_symbols)->osd_Icon_inner 
    12201230#  define __osd_MenuNext (p_symbols)->__osd_MenuNext_inner 
    12211231#  define __osd_MenuDelete (p_symbols)->__osd_MenuDelete_inner 
     
    12421252#  define __vlc_execve (p_symbols)->__vlc_execve_inner 
    12431253#  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 
    12441257#  elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 
    12451258/****************************************************************** 
     
    16211634    ((p_symbols)->vlc_alphasort_inner) = vlc_alphasort; \ 
    16221635    ((p_symbols)->__osd_StateChange_inner) = __osd_StateChange; \ 
     1636    ((p_symbols)->osd_Slider_inner) = osd_Slider; \ 
    16231637    ((p_symbols)->osd_ConfigUnload_inner) = osd_ConfigUnload; \ 
    16241638    ((p_symbols)->__osd_MenuShow_inner) = __osd_MenuShow; \ 
     1639    ((p_symbols)->osd_Icon_inner) = osd_Icon; \ 
    16251640    ((p_symbols)->__osd_MenuNext_inner) = __osd_MenuNext; \ 
    16261641    ((p_symbols)->__osd_MenuDelete_inner) = __osd_MenuDelete; \ 
     
    16471662    ((p_symbols)->__vlc_execve_inner) = __vlc_execve; \ 
    16481663    ((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; \ 
    16491667    (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 
    16501668    (p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \ 
    1651     (p_symbols)->osd_Slider_deprecated = NULL; \ 
    1652     (p_symbols)->osd_Icon_deprecated = NULL; \ 
    16531669    (p_symbols)->__osd_VolumeDown_deprecated = NULL; \ 
    16541670    (p_symbols)->__osd_VolumeUp_deprecated = NULL; \ 
  • include/vlc_video.h

    rca639cd ra92603f  
    348348VLC_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 ) ); 
    349349 
     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 */ 
     363VLC_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 */ 
     381VLC_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 **/ 
     392VLC_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 */ 
     413VLC_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 */ 
     424VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) ); 
     425 
    350426/**@}*/ 
    351427 
  • modules/access_filter/record.c

    rfe087a3 ra92603f  
    3232 
    3333#include "vlc_keys.h" 
    34 #include <osd.h> 
     34#include <vlc_osd.h> 
    3535#include <errno.h> 
    3636#include <time.h> 
  • modules/codec/cmml/cmml.c

    rfe087a3 ra92603f  
    3232#include <vlc/intf.h> 
    3333 
    34 #include <osd.h> 
     34#include <vlc_osd.h> 
    3535 
    3636#include "charset.h" 
  • modules/codec/cmml/intf.c

    rfe087a3 ra92603f  
    4242#include <vlc/vout.h> 
    4343 
    44 #include <osd.h> 
     44#include <vlc_osd.h> 
    4545 
    4646#include "vlc_keys.h" 
  • modules/codec/subsdec.c

    rfe087a3 ra92603f  
    3030#include <vlc/decoder.h> 
    3131 
    32 #include "osd.h" 
     32#include "vlc_osd.h" 
    3333#include "vlc_filter.h" 
    3434 
  • modules/control/corba/mediacontrol-core.c

    r1bb3f90 ra92603f  
    66#include <vlc_demux.h> 
    77 
    8 #include <osd.h> 
     8#include <vlc_osd.h> 
    99 
    1010#define HAS_SNAPSHOT 1 
  • modules/control/hotkeys.c

    r736c8e0 ra92603f  
    3333#include <vlc/vout.h> 
    3434#include <vlc/aout.h> 
    35 #include <osd.h> 
     35#include <vlc_osd.h> 
    3636 
    3737#include "vlc_keys.h" 
     
    244244            if( p_hotkeys[i].i_key == i_key ) 
    245245            { 
    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; 
    249249            } 
    250250        } 
  • modules/gui/macosx/controls.m

    r09161bc ra92603f  
    3535#include "open.h" 
    3636#include "controls.h" 
    37 #include <osd.h> 
     37#include <vlc_osd.h> 
    3838 
    3939/***************************************************************************** 
  • modules/gui/macosx/playlist.m

    raeb0bfb ra92603f  
    5050#include "playlist.h" 
    5151#include "controls.h" 
    52 #include "osd.h" 
     52#include "vlc_osd.h" 
    5353#include "misc.h" 
    5454 
     
    16081608#endif 
    16091609    /* 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. 
    16111611       We need to add NSFilenamesPboardType otherwise the outlineview refuses 
    16121612       to the drop. */ 
  • modules/misc/freetype.c

    rfe087a3 ra92603f  
    3535#include <vlc/vlc.h> 
    3636#include <vlc/vout.h> 
    37 #include "osd.h" 
     37#include "vlc_osd.h" 
    3838#include "vlc_block.h" 
    3939#include "vlc_filter.h" 
  • modules/misc/svg.c

    rfe087a3 ra92603f  
    3434#include <vlc/vlc.h> 
    3535#include <vlc/vout.h> 
    36 #include "osd.h" 
     36#include "vlc_osd.h" 
    3737#include "vlc_block.h" 
    3838#include "vlc_filter.h" 
  • modules/misc/win32text.c

    rfe087a3 ra92603f  
    3030#include <vlc/vlc.h> 
    3131#include <vlc/vout.h> 
    32 #include "osd.h" 
     32#include "vlc_osd.h" 
    3333#include "vlc_block.h" 
    3434#include "vlc_filter.h" 
  • modules/stream_out/transcode.c

    r265e634 ra92603f  
    3737#include <vlc/decoder.h> 
    3838#include "vlc_filter.h" 
    39 #include "osd.h" 
     39#include "vlc_osd.h" 
    4040 
    4141#define MASTER_SYNC_MAX_DRIFT 100000 
  • modules/video_filter/logo.c

    r9097bc1 ra92603f  
    3535#include "filter_common.h" 
    3636#include "vlc_image.h" 
    37 #include "osd.h" 
     37#include "vlc_osd.h" 
    3838 
    3939#ifdef LoadImage 
  • modules/video_filter/marq.c

    rb7d8fb7 ra92603f  
    3333#include "vlc_filter.h" 
    3434#include "vlc_block.h" 
    35 #include "osd.h" 
     35#include "vlc_osd.h" 
    3636 
    3737/***************************************************************************** 
  • modules/video_filter/osdmenu.c

    ra78a663 ra92603f  
    3333#include <vlc_video.h> 
    3434 
    35 #include <osd.h> 
    3635#include <vlc_osd.h> 
    3736 
  • modules/video_filter/rss.c

    r885fd4c ra92603f  
    3333#include "vlc_filter.h" 
    3434#include "vlc_block.h" 
    35 #include "osd.h" 
     35#include "vlc_osd.h" 
    3636 
    3737#include "vlc_block.h" 
  • modules/video_filter/time.c

    rfe087a3 ra92603f  
    3535#include "vlc_filter.h" 
    3636#include "vlc_block.h" 
    37 #include "osd.h" 
     37#include "vlc_osd.h" 
    3838 
    3939/***************************************************************************** 
  • src/control/audio_video.c

    rfe087a3 ra92603f  
    2929#include <vlc_demux.h> 
    3030 
    31 #include <osd.h> 
     31#include <vlc_osd.h> 
    3232 
    3333#define HAS_SNAPSHOT 1 
  • src/control/core.c

    rfe087a3 ra92603f  
    2929#include <vlc_demux.h> 
    3030 
    31 #include <osd.h> 
     31#include <vlc_osd.h> 
    3232 
    3333#define HAS_SNAPSHOT 1 
  • src/control/util.c

    rfe087a3 ra92603f  
    2929#include <vlc_demux.h> 
    3030 
    31 #include <osd.h> 
     31#include <vlc_osd.h> 
    3232 
    3333#define HAS_SNAPSHOT 1 
  • src/misc/modules.c

    r4f33bf8 ra92603f  
    9393 
    9494#include "stream_output.h" 
    95 #include "osd.h" 
    9695#include "vlc_httpd.h" 
    9796#include "vlc_acl.h" 
  • src/video_output/video_text.c

    rfe087a3 ra92603f  
    2222 *****************************************************************************/ 
    2323#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> 
    2727 
    2828/** 
     
    124124 
    125125    p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE ); 
    126  
    127126    if( p_vout ) 
    128127    { 
  • src/video_output/video_widgets.c

    r94e2f25 ra92603f  
    22 * video_widgets.c : OSD widgets manipulation functions 
    33 ***************************************************************************** 
    4  * Copyright (C) 2004 the VideoLAN team 
     4 * Copyright (C) 2004-2005 the VideoLAN team 
    55 * $Id$ 
    66 * 
     
    2727#include <stdlib.h>                                                /* free() */ 
    2828#include <vlc/vout.h> 
    29 #include <osd.h> 
     29#include <vlc_osd.h> 
    3030 
    3131#include "vlc_video.h" 
    3232#include "vlc_filter.h" 
    33  
    34 #define STYLE_EMPTY 0 
    35 #define STYLE_FILLED 1 
    36  
    37 /***************************************************************************** 
    38  * Local prototypes 
    39  *****************************************************************************/ 
    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     else 
    67     { 
    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         else 
    109         { 
    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     else 
    121     { 
    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         else 
    135         { 
    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 picture 
    150  *****************************************************************************/ 
    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 } 
    20733 
    20834/***************************************************************************** 
     
    21541    vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, 
    21642                                             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 ) ) ) 
    22144    { 
    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 ); 
    22347    } 
    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     else 
    245     { 
    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  
    27548    vlc_object_release( p_vout ); 
    276     return; 
    27749} 
    27850 
     
    28557    vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, 
    28658                                             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" ) ) 
    29160    { 
    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 ); 
    29363    } 
    294  
    295     p_subpic = vout_CreateWidget( p_vout->p_spu, i_channel ); 
    296     if( p_subpic == NULL ) 
    297     { 
    298