55#define MAGIC_AGGREGATE 0xbbcaa321
74 printf(
"Aggregate display\n");
76 printf(
"\t-t aggregate:<dev1_config>#<dev2_config>[#....]\n");
77 printf(
"\t\twhere devn_config is a complete configuration string of device involved in an aggregate device\n");
97 *available_cards = NULL;
105 char *save_ptr = NULL;
107 char *parse_string = NULL;;
111 if(!
fmt || strcmp(
fmt,
"help") == 0) {
120 tmp = parse_string = strdup(
fmt);
122 while(strtok_r(tmp,
"#", &save_ptr)) {
130 tmp = parse_string = strdup(
fmt);
131 while((
item = strtok_r(tmp,
"#", &save_ptr))) {
133 char *config = strdup(
item);
134 const char *device_cfg =
"";
135 unsigned int dev_flags = 0u;
137 if(strchr(config,
':')) {
138 char *delim = strchr(config,
':');
140 device_cfg = delim + 1;
149 device_cfg, dev_flags, NULL, &s->
devices[i]);
151 fprintf(stderr,
"[aggregate] Unable to initialize device %d (%s:%s).\n", i, device, device_cfg);
190 for (
unsigned int i = 0; i < s->
devices_cnt; ++i) {
268 unsigned int codec_idx;
269 unsigned int save_codec_idx = 0;
271 size_t *lens = malloc(s->
devices_cnt *
sizeof(
size_t));
287 for(codec_idx = 0; codec_idx < lens[0] /
sizeof(
codec_t); codec_idx++) {
288 unsigned int found = 0;
291 unsigned int sub_codec;
292 for(sub_codec = 0; sub_codec < lens[i] /
sizeof(
codec_t); ++sub_codec) {
293 if(examined ==
codecs[i][sub_codec]) {
301 ((
codec_t *)
val)[save_codec_idx++] = examined;
326 size_t first_size =
sizeof(first_val);
332 size_t new_size =
sizeof(new_val);
335 if(new_size != first_size || memcmp(first_val, new_val, first_size) != 0)
339 if (first_size > *
len)
342 memcpy(
val, first_val, first_size);
367 float fps = s->
frames / seconds;
struct video_frame long long nonblock
struct video_frame * frame
const char unsigned int flags
int void(** deleter)(void *))
struct video_frame * vf_alloc(int count)
Allocates blank video frame.
void vf_free(struct video_frame *buf)
Frees video_frame structure.
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_INFO
normal reporting
bool display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate)
void display_put_audio_frame(struct display *d, const struct audio_frame *frame)
Puts audio data.
bool display_put_frame(struct display *d, struct video_frame *frame, long long timeout_ns)
Puts filled video frame. After calling this function, video frame cannot be used.
#define DISPLAY_FLAG_AUDIO_ANALOG
bool display_ctl_property(struct display *d, int property, void *val, size_t *len)
Gets property from video display.
void display_run_new_thread(struct display *d)
#define DISPLAY_FLAG_AUDIO_AESEBU
#define VIDEO_DISPLAY_ABI_VERSION
#define DISPLAY_NO_GENERIC_FPS_INDICATOR
#define DISPLAY_FLAG_AUDIO_EMBEDDED
void display_done(struct display *d)
This function performs cleanup after done.
void display_join(struct display *d)
int initialize_video_display(struct module *parent, const char *requested_display, const char *fmt, unsigned int flags, const char *postprocess, struct display **out)
Initializes video display.
struct video_frame * display_get_frame(struct display *d)
Returns video framebuffer which will be written to.
@ DISPLAY_PROPERTY_BUF_PITCH
requested framebuffer pitch - int (bytes), may be PITCH_DEFAULT
@ DISPLAY_PROPERTY_RGB_SHIFT
red,green,blue shift - int[3] (bits)
@ DISPLAY_PROPERTY_VIDEO_MODE
requested video mode - int (one of display_prop_vid_mode)
@ DISPLAY_PROPERTY_CODECS
list of natively supported codecs - codec_t[]
@ DISPLAY_PROPERTY_VIDEO_SEPARATE_TILES
framebuffer consists of separate tiles
@ DISPLAY_PROPERTY_VIDEO_MERGED
monolithic framebuffer
@ LIBRARY_CLASS_VIDEO_DISPLAY
#define REGISTER_HIDDEN_MODULE(name, info, lclass, abi)
struct used to comunicate with audio capture/playback device
struct video_frame ** dev_frames
struct display ** devices
struct video_frame * frame
This struct represents initialized video display state.
Struct tile is an area of video_frame.
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
enum interlacing_t interlacing
Struct video_frame represents a video frame and contains video description.
enum interlacing_t interlacing
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
double tv_diff(struct timeval curr_time, struct timeval prev_time)
@ VIDEO_NORMAL
normal video (one tile)
This is an umbrella header for video functions.
static void show_help(void)
static bool display_aggregate_putf(void *state, struct video_frame *frame, long long nonblock)
static void * display_aggregate_init(struct module *parent, const char *fmt, unsigned int flags)
static const struct video_display_info display_aggregate_info
static bool display_aggregate_get_property(void *state, int property, void *val, size_t *len)
static void display_aggregate_put_audio_frame(void *state, const struct audio_frame *frame)
static struct video_frame * display_aggregate_getf(void *state)
static void display_aggregate_done(void *state)
static bool display_aggregate_reconfigure(void *state, struct video_desc desc)
static void * display_aggregate_run(void *state)
static void display_aggregate_probe(struct device_info **available_cards, int *count, void(**deleter)(void *))
static bool display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate)
bool display_reconfigure(struct display *d, struct video_desc desc, enum video_mode video_mode)
Reconfigure display to new video format.
struct tile * vf_get_tile(struct video_frame *buf, int pos)
Returns pointer to n-th tile from video frame Equivalent to &video_frame::tiles[pos].