forked from alibaba/CicadaPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSMP_DCAManager.h
64 lines (48 loc) · 1.54 KB
/
SMP_DCAManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Created by moqi on 2020/6/24.
//
#ifndef CICADAMEDIA_SMP_DCAMANAGER_H
#define CICADAMEDIA_SMP_DCAMANAGER_H
#include <base/IDCA.h>
#include <memory>
#include <mutex>
#include <queue>
#include <utility>
namespace Cicada {
class SuperMediaPlayer;
class mediaPlayerDCAObserverListener {
public:
virtual void onEvent(const std::string &content) = 0;
};
class SMP_DCAObserver : public IDCAObserver {
public:
explicit SMP_DCAObserver(std::string className, std::string compName, void *obj);
void setListener(mediaPlayerDCAObserverListener *listener);
void hello();
private:
void onEvent(int level, const std::string &content) override;
private:
std::string mClass{};
std::string mName{};
void *mObj{nullptr};
mediaPlayerDCAObserverListener *mListener{nullptr};
};
class SMP_DCAManager : public mediaPlayerDCAObserverListener {
public:
explicit SMP_DCAManager(SuperMediaPlayer &player) : mPlayer(player)
{}
void createObservers();
int invoke(const std::string &content);
std::string getEvent();
void reset();
private:
void onEvent(const std::string &content) override;
private:
SuperMediaPlayer &mPlayer;
std::unique_ptr<SMP_DCAObserver> mDemuxerObserver{nullptr};
std::unique_ptr<SMP_DCAObserver> mFilterObserver{nullptr};
std::queue<std::string> mEventQue;
std::mutex mMutex;
};
}// namespace Cicada
#endif//CICADAMEDIA_SMP_DCAMANAGER_H