Skip to content

Commit 68fb311

Browse files
committed
aplay/decklink: Fix One definition rule violation
There is a state_decklink struct in both display/decklink and audio/playback/decklink. Moved to anonymous namespace and also renamed it to avoid confusion
1 parent 646984d commit 68fb311

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/audio/playback/decklink.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@
6363

6464
namespace {
6565
class PlaybackDelegate;
66-
}
6766

6867
#define DECKLINK_MAGIC 0x415f46d0
6968
#define MOD_NAME "[DeckLink audio play.] "
7069

71-
struct state_decklink {
70+
struct state_decklink_aplay {
7271
uint32_t magic;
7372

7473
struct audio_desc audio_desc;
@@ -88,13 +87,12 @@ struct state_decklink {
8887
int audio_consumer_levels; ///< 0 false, 1 true, -1 default
8988
};
9089

91-
namespace {
9290
class PlaybackDelegate : public IDeckLinkVideoOutputCallback // , public IDeckLinkAudioOutputCallback
9391
{
94-
struct state_decklink * s;
92+
struct state_decklink_aplay * s;
9593

9694
public:
97-
PlaybackDelegate (struct state_decklink* owner) {
95+
PlaybackDelegate (struct state_decklink_aplay* owner) {
9896
s = owner;
9997
}
10098

@@ -190,7 +188,7 @@ audio_play_decklink_init(const struct audio_playback_opts *opts)
190188
return INIT_NOERR;
191189
}
192190

193-
struct state_decklink *s = NULL;
191+
struct state_decklink_aplay *s = NULL;
194192
IDeckLinkIterator* deckLinkIterator;
195193
HRESULT result;
196194
IDeckLinkConfiguration* deckLinkConfiguration = NULL;
@@ -204,7 +202,7 @@ audio_play_decklink_init(const struct audio_playback_opts *opts)
204202
//BMDDisplayMode displayMode = bmdModeUnknown;
205203
int width, height;
206204

207-
s = (struct state_decklink *)calloc(1, sizeof(struct state_decklink));
205+
s = (struct state_decklink_aplay *)calloc(1, sizeof(struct state_decklink_aplay));
208206
s->magic = DECKLINK_MAGIC;
209207
s->audio_consumer_levels = -1;
210208

@@ -342,7 +340,7 @@ audio_play_decklink_init(const struct audio_playback_opts *opts)
342340

343341
static void audio_play_decklink_put_frame(void *state, const struct audio_frame *frame)
344342
{
345-
struct state_decklink *s = (struct state_decklink *)state;
343+
struct state_decklink_aplay *s = (struct state_decklink_aplay *)state;
346344
unsigned int sampleFrameCount = frame->data_len /
347345
(s->audio_desc.bps * s->audio_desc.ch_count);
348346
uint32_t sampleFramesWritten;
@@ -397,7 +395,7 @@ static bool audio_play_decklink_ctl(void *state [[gnu::unused]], int request, vo
397395
}
398396

399397
static bool audio_play_decklink_reconfigure(void *state, struct audio_desc desc) {
400-
struct state_decklink *s = (struct state_decklink *)state;
398+
struct state_decklink_aplay *s = (struct state_decklink_aplay *)state;
401399
BMDAudioSampleType sample_type;
402400

403401
s->audio_desc = desc;
@@ -445,7 +443,7 @@ static bool audio_play_decklink_reconfigure(void *state, struct audio_desc desc)
445443

446444
static void audio_play_decklink_done(void *state)
447445
{
448-
struct state_decklink *s = (struct state_decklink *)state;
446+
struct state_decklink_aplay *s = (struct state_decklink_aplay *)state;
449447

450448
s->deckLinkOutput->DisableAudioOutput();
451449
s->deckLinkOutput->DisableVideoOutput();

0 commit comments

Comments
 (0)