| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#ifndef DYNAMIC_OVERLAY_H |
|---|
| 25 |
#define DYNAMIC_OVERLAY_H 1 |
|---|
| 26 |
|
|---|
| 27 |
#include <vlc_common.h> |
|---|
| 28 |
#include <vlc_filter.h> |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
typedef struct buffer_t |
|---|
| 35 |
{ |
|---|
| 36 |
size_t i_size; |
|---|
| 37 |
size_t i_length; |
|---|
| 38 |
|
|---|
| 39 |
char *p_memory; |
|---|
| 40 |
char *p_begin; |
|---|
| 41 |
} buffer_t; |
|---|
| 42 |
|
|---|
| 43 |
int BufferInit( buffer_t *p_buffer ); |
|---|
| 44 |
int BufferDestroy( buffer_t *p_buffer ); |
|---|
| 45 |
int BufferAdd( buffer_t *p_buffer, const char *p_data, size_t i_len ); |
|---|
| 46 |
int BufferPrintf( buffer_t *p_buffer, const char *p_fmt, ... ); |
|---|
| 47 |
int BufferDel( buffer_t *p_buffer, int i_len ); |
|---|
| 48 |
char *BufferGetToken( buffer_t *p_buffer ); |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
typedef struct commandparams_t |
|---|
| 56 |
{ |
|---|
| 57 |
int32_t i_id; |
|---|
| 58 |
int32_t i_shmid; |
|---|
| 59 |
|
|---|
| 60 |
vlc_fourcc_t fourcc; |
|---|
| 61 |
|
|---|
| 62 |
int32_t i_x; |
|---|
| 63 |
int32_t i_y; |
|---|
| 64 |
int32_t i_width; |
|---|
| 65 |
int32_t i_height; |
|---|
| 66 |
|
|---|
| 67 |
int32_t i_alpha; |
|---|
| 68 |
|
|---|
| 69 |
struct text_style_t fontstyle; |
|---|
| 70 |
|
|---|
| 71 |
bool b_visible; |
|---|
| 72 |
} commandparams_t; |
|---|
| 73 |
|
|---|
| 74 |
typedef struct commanddesc_t |
|---|
| 75 |
{ |
|---|
| 76 |
const char *psz_command; |
|---|
| 77 |
bool b_atomic; |
|---|
| 78 |
int ( *pf_parser ) ( char *psz_command, char *psz_end, |
|---|
| 79 |
commandparams_t *p_params ); |
|---|
| 80 |
int ( *pf_execute ) ( filter_t *p_filter, const commandparams_t *p_params, |
|---|
| 81 |
commandparams_t *p_results ); |
|---|
| 82 |
int ( *pf_unparse ) ( const commandparams_t *p_results, |
|---|
| 83 |
buffer_t *p_output ); |
|---|
| 84 |
} commanddesc_t; |
|---|
| 85 |
|
|---|
| 86 |
typedef struct command_t |
|---|
| 87 |
{ |
|---|
| 88 |
struct commanddesc_t *p_command; |
|---|
| 89 |
int i_status; |
|---|
| 90 |
commandparams_t params; |
|---|
| 91 |
commandparams_t results; |
|---|
| 92 |
struct command_t *p_next; |
|---|
| 93 |
} command_t; |
|---|
| 94 |
|
|---|
| 95 |
void RegisterCommand( filter_t *p_filter ); |
|---|
| 96 |
void UnregisterCommand( filter_t *p_filter ); |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
typedef struct queue_t |
|---|
| 103 |
{ |
|---|
| 104 |
command_t *p_head; |
|---|
| 105 |
command_t *p_tail; |
|---|
| 106 |
} queue_t; |
|---|
| 107 |
|
|---|
| 108 |
int QueueInit( queue_t *p_queue ); |
|---|
| 109 |
int QueueDestroy( queue_t *p_queue ); |
|---|
| 110 |
int QueueEnqueue( queue_t *p_queue, command_t *p_cmd ); |
|---|
| 111 |
command_t *QueueDequeue( queue_t *p_queue ); |
|---|
| 112 |
int QueueTransfer( queue_t *p_sink, queue_t *p_source ); |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
typedef struct overlay_t |
|---|
| 119 |
{ |
|---|
| 120 |
int i_x, i_y; |
|---|
| 121 |
int i_alpha; |
|---|
| 122 |
bool b_active; |
|---|
| 123 |
|
|---|
| 124 |
video_format_t format; |
|---|
| 125 |
struct text_style_t fontstyle; |
|---|
| 126 |
union { |
|---|
| 127 |
picture_t *p_pic; |
|---|
| 128 |
char *p_text; |
|---|
| 129 |
} data; |
|---|
| 130 |
} overlay_t; |
|---|
| 131 |
|
|---|
| 132 |
overlay_t *OverlayCreate( void ); |
|---|
| 133 |
int OverlayDestroy( overlay_t *p_ovl ); |
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
typedef struct list_t |
|---|
| 140 |
{ |
|---|
| 141 |
overlay_t **pp_head, **pp_tail; |
|---|
| 142 |
} list_t; |
|---|
| 143 |
|
|---|
| 144 |
int ListInit( list_t *p_list ); |
|---|
| 145 |
int ListDestroy( list_t *p_list ); |
|---|
| 146 |
ssize_t ListAdd( list_t *p_list, overlay_t *p_new ); |
|---|
| 147 |
int ListRemove( list_t *p_list, size_t i_idx ); |
|---|
| 148 |
overlay_t *ListGet( list_t *p_list, size_t i_idx ); |
|---|
| 149 |
overlay_t *ListWalk( list_t *p_list ); |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
struct filter_sys_t |
|---|
| 156 |
{ |
|---|
| 157 |
buffer_t input, output; |
|---|
| 158 |
|
|---|
| 159 |
int i_inputfd, i_outputfd; |
|---|
| 160 |
char *psz_inputfile, *psz_outputfile; |
|---|
| 161 |
|
|---|
| 162 |
commanddesc_t **pp_commands; |
|---|
| 163 |
size_t i_commands; |
|---|
| 164 |
|
|---|
| 165 |
bool b_updated, b_atomic; |
|---|
| 166 |
queue_t atomic, pending, processed; |
|---|
| 167 |
list_t overlays; |
|---|
| 168 |
}; |
|---|
| 169 |
|
|---|
| 170 |
#endif |
|---|