sACN  HEAD (unstable)
Implementation of ANSI E1.31 (Streaming ACN)
View other versions:
Loading...
Searching...
No Matches
dmx_merger.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2024 ETC Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************
16 * This file is a part of sACN. For more information, go to:
17 * https://github.com/ETCLabs/sACN
18 *****************************************************************************/
19
28#ifndef SACN_DMX_MERGER_H_
29#define SACN_DMX_MERGER_H_
30
31#include <stdbool.h>
32#include <stdint.h>
33#include "etcpal/error.h"
34#include "sacn/common.h"
35#include "sacn/receiver.h"
36#include "sacn/opts.h"
37
61#ifdef __cplusplus
62extern "C" {
63#endif
64
69
72typedef uint16_t sacn_dmx_merger_source_t;
75
120
132#define SACN_DMX_MERGER_CONFIG_INIT {NULL, NULL, NULL, NULL, NULL, kSacnReceiverInfiniteSources}
133
140#define SACN_DMX_MERGER_SOURCE_IS_VALID(owners_array, slot_index) \
141 (owners_array[slot_index] != kSacnDmxMergerSourceInvalid)
142
168
171
175
178 const uint8_t* new_levels,
179 size_t new_levels_count);
182 const uint8_t* pap,
183 size_t pap_count);
186 uint8_t universe_priority);
188
189#ifdef __cplusplus
190}
191#endif
192
197#endif /* SACN_DMX_MERGER_H_ */
Common definitions for sACN.
etcpal_error_t
const SacnDmxMergerSource * sacn_dmx_merger_get_source(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source)
Gets a read-only view of the source data.
Definition dmx_merger.c:390
etcpal_error_t sacn_dmx_merger_destroy(sacn_dmx_merger_t handle)
Destroy a merger instance.
Definition dmx_merger.c:258
struct SacnDmxMergerSource SacnDmxMergerSource
The current input data for a single source of the merge.
uint16_t sacn_dmx_merger_source_t
A source handle used by the DMX merger, could represent a remote source or another logical source (e....
Definition dmx_merger.h:72
etcpal_error_t sacn_dmx_merger_update_levels(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source, const uint8_t *new_levels, size_t new_levels_count)
Updates a source's levels and recalculates outputs.
Definition dmx_merger.c:434
etcpal_error_t sacn_dmx_merger_create(const SacnDmxMergerConfig *config, sacn_dmx_merger_t *handle)
Create a new merger instance.
Definition dmx_merger.c:203
struct SacnDmxMergerConfig SacnDmxMergerConfig
A set of configuration information for a merger instance.
static const sacn_dmx_merger_t kSacnDmxMergerInvalid
An invalid sACN merger handle value.
Definition dmx_merger.h:68
etcpal_error_t sacn_dmx_merger_update_universe_priority(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source, uint8_t universe_priority)
Updates a source's universe priority and recalculates outputs.
Definition dmx_merger.c:557
int sacn_dmx_merger_t
Each merger has a handle associated with it.
Definition dmx_merger.h:66
etcpal_error_t sacn_dmx_merger_update_pap(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source, const uint8_t *pap, size_t pap_count)
Updates a source's per-address priorities (PAP) and recalculates outputs.
Definition dmx_merger.c:494
etcpal_error_t sacn_dmx_merger_remove_source(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source)
Removes a source from the merger.
Definition dmx_merger.c:348
etcpal_error_t sacn_dmx_merger_remove_pap(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t source)
Removes the per-address priority (PAP) data from the source and recalculate outputs.
Definition dmx_merger.c:603
static const sacn_dmx_merger_source_t kSacnDmxMergerSourceInvalid
An invalid DMX merger source handle value.
Definition dmx_merger.h:74
etcpal_error_t sacn_dmx_merger_add_source(sacn_dmx_merger_t merger, sacn_dmx_merger_source_t *source_id)
Adds a new source to the merger.
Definition dmx_merger.c:306
#define SACN_DMX_MERGER_MAX_SLOTS
Configures the maximum number of slots supported for merging by the DMX merger.
Definition opts.h:502
sACN configuration options.
sACN Receiver API definitions
A set of configuration information for a merger instance.
Definition dmx_merger.h:78
sacn_dmx_merger_source_t * owners
This is only allowed to be NULL if and only if SACN_DMX_MERGER_DISABLE_INTERNAL_OWNER_BUFFER is 0.
Definition dmx_merger.h:112
int source_count_max
The maximum number of sources this merger will listen to.
Definition dmx_merger.h:117
uint8_t * per_address_priorities
This is only allowed to be NULL if and only if SACN_DMX_MERGER_DISABLE_INTERNAL_PAP_BUFFER is 0.
Definition dmx_merger.h:92
uint8_t * universe_priority
This is allowed to be NULL.
Definition dmx_merger.h:103
uint8_t * levels
This is always required to be non-NULL.
Definition dmx_merger.h:84
bool * per_address_priorities_active
This is allowed to be NULL.
Definition dmx_merger.h:98
The current input data for a single source of the merge.
Definition dmx_merger.h:145
uint8_t levels[SACN_DMX_MERGER_MAX_SLOTS]
The DMX NULL start code data (0 - 255).
Definition dmx_merger.h:150
bool using_universe_priority
Whether or not the source is currently using universe priority (converted to address priorities) for ...
Definition dmx_merger.h:165
uint8_t address_priority[SACN_DMX_MERGER_MAX_SLOTS]
The sACN per-address (startcode 0xdd) priority (1-255, 0 means not sourced).
Definition dmx_merger.h:162
uint8_t universe_priority
The sACN per-universe priority (0 - 200).
Definition dmx_merger.h:156
sacn_dmx_merger_source_t id
The merger's ID for the DMX source.
Definition dmx_merger.h:147
size_t valid_level_count
Some sources don't send all 512 levels, so here's how much of levels to use.
Definition dmx_merger.h:153