dynamicoverlay.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DYNAMIC_OVERLAY_H
00025 #define DYNAMIC_OVERLAY_H 1
00026
00027 #include <vlc_common.h>
00028 #include <vlc_filter.h>
00029 #include <vlc_text_style.h>
00030
00031
00032
00033
00034
00035 typedef struct buffer_t
00036 {
00037 size_t i_size;
00038 size_t i_length;
00039
00040 char *p_memory;
00041 char *p_begin;
00042 } buffer_t;
00043
00044 int BufferInit( buffer_t *p_buffer );
00045 int BufferDestroy( buffer_t *p_buffer );
00046 int BufferAdd( buffer_t *p_buffer, const char *p_data, size_t i_len );
00047 int BufferPrintf( buffer_t *p_buffer, const char *p_fmt, ... );
00048 int BufferDel( buffer_t *p_buffer, int i_len );
00049 char *BufferGetToken( buffer_t *p_buffer );
00050
00051
00052
00053
00054
00055
00056 typedef struct commandparams_t
00057 {
00058 int32_t i_id;
00059 int32_t i_shmid;
00060
00061 vlc_fourcc_t fourcc;
00062
00063 int32_t i_x;
00064 int32_t i_y;
00065 int32_t i_width;
00066 int32_t i_height;
00067
00068 int32_t i_alpha;
00069
00070 text_style_t fontstyle;
00071
00072 bool b_visible;
00073 } commandparams_t;
00074
00075 typedef int (*parser_func_t)(char *psz_command, char *psz_end, commandparams_t *p_params );
00076 typedef int (*execute_func_t)( filter_t *p_filter, const commandparams_t *p_params, commandparams_t *p_results );
00077 typedef int (*unparse_func_t)( const commandparams_t *p_results, buffer_t *p_output );
00078
00079 typedef struct commanddesc_t
00080 {
00081 char *psz_command;
00082 bool b_atomic;
00083 parser_func_t pf_parser;
00084 execute_func_t pf_execute;
00085 unparse_func_t pf_unparse;
00086 } commanddesc_t;
00087
00088 typedef struct commanddesc_static_t
00089 {
00090 const char *psz_command;
00091 bool b_atomic;
00092 parser_func_t pf_parser;
00093 execute_func_t pf_execute;
00094 unparse_func_t pf_unparse;
00095 } commanddesc_static_t;
00096
00097
00098 typedef struct command_t
00099 {
00100 struct commanddesc_t *p_command;
00101 int i_status;
00102 commandparams_t params;
00103 commandparams_t results;
00104 struct command_t *p_next;
00105 } command_t;
00106
00107 void RegisterCommand( filter_t *p_filter );
00108 void UnregisterCommand( filter_t *p_filter );
00109
00110
00111
00112
00113
00114 typedef struct queue_t
00115 {
00116 command_t *p_head;
00117 command_t *p_tail;
00118 } queue_t;
00119
00120 int QueueInit( queue_t *p_queue );
00121 int QueueDestroy( queue_t *p_queue );
00122 int QueueEnqueue( queue_t *p_queue, command_t *p_cmd );
00123 command_t *QueueDequeue( queue_t *p_queue );
00124 int QueueTransfer( queue_t *p_sink, queue_t *p_source );
00125
00126
00127
00128
00129
00130 typedef struct overlay_t
00131 {
00132 int i_x, i_y;
00133 int i_alpha;
00134 bool b_active;
00135
00136 video_format_t format;
00137 text_style_t *p_fontstyle;
00138 union {
00139 picture_t *p_pic;
00140 char *p_text;
00141 } data;
00142 } overlay_t;
00143
00144 overlay_t *OverlayCreate( void );
00145 int OverlayDestroy( overlay_t *p_ovl );
00146
00147
00148
00149
00150
00151 typedef struct list_t
00152 {
00153 overlay_t **pp_head, **pp_tail;
00154 } list_t;
00155
00156 int ListInit( list_t *p_list );
00157 int ListDestroy( list_t *p_list );
00158 ssize_t ListAdd( list_t *p_list, overlay_t *p_new );
00159 int ListRemove( list_t *p_list, size_t i_idx );
00160 overlay_t *ListGet( list_t *p_list, size_t i_idx );
00161 overlay_t *ListWalk( list_t *p_list );
00162
00163
00164
00165
00166
00167 struct filter_sys_t
00168 {
00169 buffer_t input, output;
00170
00171 int i_inputfd, i_outputfd;
00172 char *psz_inputfile, *psz_outputfile;
00173
00174 commanddesc_t **pp_commands;
00175 size_t i_commands;
00176
00177 bool b_updated, b_atomic;
00178 queue_t atomic, pending, processed;
00179 list_t overlays;
00180
00181 vlc_mutex_t lock;
00182 };
00183
00184 #endif