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
00030
00031
00032
00033
00034 typedef struct buffer_t
00035 {
00036 size_t i_size;
00037 size_t i_length;
00038
00039 char *p_memory;
00040 char *p_begin;
00041 } buffer_t;
00042
00043 int BufferInit( buffer_t *p_buffer );
00044 int BufferDestroy( buffer_t *p_buffer );
00045 int BufferAdd( buffer_t *p_buffer, const char *p_data, size_t i_len );
00046 int BufferPrintf( buffer_t *p_buffer, const char *p_fmt, ... );
00047 int BufferDel( buffer_t *p_buffer, int i_len );
00048 char *BufferGetToken( buffer_t *p_buffer );
00049
00050
00051
00052
00053
00054
00055 typedef struct commandparams_t
00056 {
00057 int32_t i_id;
00058 int32_t i_shmid;
00059
00060 vlc_fourcc_t fourcc;
00061
00062 int32_t i_x;
00063 int32_t i_y;
00064 int32_t i_width;
00065 int32_t i_height;
00066
00067 int32_t i_alpha;
00068
00069 struct text_style_t fontstyle;
00070
00071 bool b_visible;
00072 } commandparams_t;
00073
00074 typedef struct commanddesc_t
00075 {
00076 const char *psz_command;
00077 bool b_atomic;
00078 int ( *pf_parser ) ( char *psz_command, char *psz_end,
00079 commandparams_t *p_params );
00080 int ( *pf_execute ) ( filter_t *p_filter, const commandparams_t *p_params,
00081 commandparams_t *p_results );
00082 int ( *pf_unparse ) ( const commandparams_t *p_results,
00083 buffer_t *p_output );
00084 } commanddesc_t;
00085
00086 typedef struct command_t
00087 {
00088 struct commanddesc_t *p_command;
00089 int i_status;
00090 commandparams_t params;
00091 commandparams_t results;
00092 struct command_t *p_next;
00093 } command_t;
00094
00095 void RegisterCommand( filter_t *p_filter );
00096 void UnregisterCommand( filter_t *p_filter );
00097
00098
00099
00100
00101
00102 typedef struct queue_t
00103 {
00104 command_t *p_head;
00105 command_t *p_tail;
00106 } queue_t;
00107
00108 int QueueInit( queue_t *p_queue );
00109 int QueueDestroy( queue_t *p_queue );
00110 int QueueEnqueue( queue_t *p_queue, command_t *p_cmd );
00111 command_t *QueueDequeue( queue_t *p_queue );
00112 int QueueTransfer( queue_t *p_sink, queue_t *p_source );
00113
00114
00115
00116
00117
00118 typedef struct overlay_t
00119 {
00120 int i_x, i_y;
00121 int i_alpha;
00122 bool b_active;
00123
00124 video_format_t format;
00125 struct text_style_t fontstyle;
00126 union {
00127 picture_t *p_pic;
00128 char *p_text;
00129 } data;
00130 } overlay_t;
00131
00132 overlay_t *OverlayCreate( void );
00133 int OverlayDestroy( overlay_t *p_ovl );
00134
00135
00136
00137
00138
00139 typedef struct list_t
00140 {
00141 overlay_t **pp_head, **pp_tail;
00142 } list_t;
00143
00144 int ListInit( list_t *p_list );
00145 int ListDestroy( list_t *p_list );
00146 ssize_t ListAdd( list_t *p_list, overlay_t *p_new );
00147 int ListRemove( list_t *p_list, size_t i_idx );
00148 overlay_t *ListGet( list_t *p_list, size_t i_idx );
00149 overlay_t *ListWalk( list_t *p_list );
00150
00151
00152
00153
00154
00155 struct filter_sys_t
00156 {
00157 buffer_t input, output;
00158
00159 int i_inputfd, i_outputfd;
00160 char *psz_inputfile, *psz_outputfile;
00161
00162 commanddesc_t **pp_commands;
00163 size_t i_commands;
00164
00165 bool b_updated, b_atomic;
00166 queue_t atomic, pending, processed;
00167 list_t overlays;
00168 };
00169
00170 #endif