00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BG_MSGQUEUE_H_
00023 #define __BG_MSGQUEUE_H_
00024
00025 #include <gavl/gavl.h>
00026 #include <gavl/gavldsp.h>
00027 #include <gmerlin/streaminfo.h>
00028
00029
00048 #define BG_MSG_NONE -1
00049 #define BG_MSG_MAX_ARGS 4
00050
00051
00054 typedef struct bg_msg_s bg_msg_t;
00055
00063 typedef int (*bg_msg_read_callback_t)(void * priv, uint8_t * data, int len);
00064
00072 typedef int (*bg_msg_write_callback_t)(void * priv, uint8_t * data, int len);
00073
00078 bg_msg_t * bg_msg_create();
00079
00084 void bg_msg_destroy(bg_msg_t * msg);
00085
00093 void bg_msg_free(bg_msg_t * msg);
00094
00095
00096
00102 void bg_msg_set_id(bg_msg_t * msg, int id);
00103
00109 int bg_msg_get_id(bg_msg_t * msg);
00110
00111
00118 void bg_msg_set_arg_int(bg_msg_t * msg, int arg, int value);
00119
00126 int bg_msg_get_arg_int(bg_msg_t * msg, int arg);
00127
00134 void bg_msg_set_arg_time(bg_msg_t * msg, int arg, gavl_time_t value);
00135
00142 gavl_time_t bg_msg_get_arg_time(bg_msg_t * msg, int arg);
00143
00150 void bg_msg_set_arg_string(bg_msg_t * msg, int arg, const char * value);
00151
00161 char * bg_msg_get_arg_string(bg_msg_t * msg, int arg);
00162
00163
00169 void bg_msg_set_arg_float(bg_msg_t * msg, int arg, double value);
00170
00177 double bg_msg_get_arg_float(bg_msg_t * msg, int arg);
00178
00184 void bg_msg_set_arg_color_rgb(bg_msg_t * msg, int arg, const float * value);
00185
00191 void bg_msg_get_arg_color_rgb(bg_msg_t * msg, int arg, float * value);
00192
00193
00199 void bg_msg_set_arg_color_rgba(bg_msg_t * msg, int arg, const float * value);
00200
00206 void bg_msg_get_arg_color_rgba(bg_msg_t * msg, int arg, float * value);
00207
00213 void bg_msg_set_arg_position(bg_msg_t * msg, int arg, const double * value);
00214
00215
00221 void bg_msg_get_arg_position(bg_msg_t * msg, int arg, double * value);
00222
00229 void * bg_msg_set_arg_ptr(bg_msg_t * msg, int arg, int len);
00230
00241 void * bg_msg_get_arg_ptr(bg_msg_t * msg, int arg, int * len);
00242
00251 void bg_msg_set_arg_ptr_nocopy(bg_msg_t * msg, int arg, void * ptr);
00252
00261 void * bg_msg_get_arg_ptr_nocopy(bg_msg_t * msg, int arg);
00262
00263
00270 void bg_msg_set_arg_audio_format(bg_msg_t * msg, int arg,
00271 const gavl_audio_format_t * format);
00272
00279 void bg_msg_get_arg_audio_format(bg_msg_t * msg, int arg,
00280 gavl_audio_format_t * format);
00281
00282
00289 void bg_msg_set_arg_video_format(bg_msg_t * msg, int arg,
00290 const gavl_video_format_t * format);
00291
00298 void bg_msg_get_arg_video_format(bg_msg_t * msg, int arg,
00299 gavl_video_format_t * format);
00300
00301
00308 void bg_msg_set_arg_metadata(bg_msg_t * msg, int arg,
00309 const bg_metadata_t * m);
00310
00319 void bg_msg_get_arg_metadata(bg_msg_t * msg, int arg,
00320 bg_metadata_t * m);
00321
00322
00323
00324
00325
00326
00334 int bg_msg_read(bg_msg_t * ret, bg_msg_read_callback_t cb, void * cb_data);
00335
00343 int bg_msg_write(bg_msg_t * msg, bg_msg_write_callback_t cb, void * cb_data);
00344
00345
00353 int bg_msg_read_socket(bg_msg_t * ret, int fd, int milliseconds);
00354
00361 int bg_msg_write_socket(bg_msg_t * msg, int fd);
00362
00363
00364
00365
00366
00378 int bg_msg_write_audio_frame(bg_msg_t * msg,
00379 const gavl_audio_format_t * format,
00380 const gavl_audio_frame_t * frame,
00381 bg_msg_write_callback_t cb, void * cb_data);
00382
00397 int bg_msg_read_audio_frame(gavl_dsp_context_t * ctx,
00398 bg_msg_t * msg,
00399 const gavl_audio_format_t * format,
00400 gavl_audio_frame_t * frame,
00401 bg_msg_read_callback_t cb,
00402 void * cb_data);
00403
00411 void bg_msg_set_parameter(bg_msg_t * msg,
00412 const char * name,
00413 bg_parameter_type_t type,
00414 const bg_parameter_value_t * val);
00415
00416
00426 void bg_msg_get_parameter(bg_msg_t * msg,
00427 char ** name,
00428 bg_parameter_type_t * type,
00429 bg_parameter_value_t * val);
00430
00431
00444 typedef struct bg_msg_queue_s bg_msg_queue_t;
00445
00450 bg_msg_queue_t * bg_msg_queue_create();
00451
00456 void bg_msg_queue_destroy(bg_msg_queue_t * mq);
00457
00458
00459
00460
00461
00462
00474 bg_msg_t * bg_msg_queue_lock_read(bg_msg_queue_t * mq);
00475
00485 bg_msg_t * bg_msg_queue_try_lock_read(bg_msg_queue_t * mq);
00486
00493 void bg_msg_queue_unlock_read(bg_msg_queue_t * mq);
00494
00502 bg_msg_t * bg_msg_queue_lock_write(bg_msg_queue_t * mq);
00503
00510 void bg_msg_queue_unlock_write(bg_msg_queue_t * mq);
00511
00518 int bg_msg_queue_peek(bg_msg_queue_t * mq, uint32_t * id);
00519
00535 typedef struct bg_msg_queue_list_s bg_msg_queue_list_t;
00536
00541 bg_msg_queue_list_t * bg_msg_queue_list_create();
00542
00547 void bg_msg_queue_list_destroy(bg_msg_queue_list_t * list);
00548
00555 void
00556 bg_msg_queue_list_send(bg_msg_queue_list_t * list,
00557 void (*set_message)(bg_msg_t * message,
00558 const void * data),
00559 const void * data);
00560
00566 void bg_msg_queue_list_add(bg_msg_queue_list_t * list,
00567 bg_msg_queue_t * queue);
00568
00574 void bg_msg_queue_list_remove(bg_msg_queue_list_t * list,
00575 bg_msg_queue_t * queue);
00576
00580 #endif