src/core/sync.h (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef M_CORE_SYNC_H
7#define M_CORE_SYNC_H
8
9#include "util/common.h"
10
11#include "util/threading.h"
12
13struct mCoreSync {
14 int videoFramePending;
15 bool videoFrameWait;
16 bool videoFrameOn;
17 Mutex videoFrameMutex;
18 Condition videoFrameAvailableCond;
19 Condition videoFrameRequiredCond;
20
21 bool audioWait;
22 Condition audioRequiredCond;
23 Mutex audioBufferMutex;
24
25 float fpsTarget;
26};
27
28void mCoreSyncPostFrame(struct mCoreSync* sync);
29void mCoreSyncForceFrame(struct mCoreSync* sync);
30bool mCoreSyncWaitFrameStart(struct mCoreSync* sync);
31void mCoreSyncWaitFrameEnd(struct mCoreSync* sync);
32void mCoreSyncSetVideoSync(struct mCoreSync* sync, bool wait);
33
34void mCoreSyncProduceAudio(struct mCoreSync* sync, bool wait);
35void mCoreSyncLockAudio(struct mCoreSync* sync);
36void mCoreSyncUnlockAudio(struct mCoreSync* sync);
37void mCoreSyncConsumeAudio(struct mCoreSync* sync);
38
39#endif