Skip to content

Commit

Permalink
feat(dca): add DCA direct component access
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai authored and I-m-SuperMan committed Jun 28, 2020
1 parent e85595f commit 2e948b8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
35 changes: 35 additions & 0 deletions framework/base/IDCA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Created by moqi on 2020/6/24.
//

#ifndef CICADAMEDIA_IDCA_H
#define CICADAMEDIA_IDCA_H
#include <string>
// direct component access
namespace Cicada {
class IDCAObserver {
public:
virtual void onEvent(int level, const std::string &content) = 0;
};
class IDCA {
public:
void setDCAObserver(IDCAObserver *observer)
{
mObserver = observer;
}
virtual int invoke(int cmd, const std::string &content) = 0;
virtual ~IDCA() = default;

protected:
void sendEvent(int level, const std::string &content)
{
if (mObserver) {
mObserver->onEvent(level, content);
}
};

private:
IDCAObserver *mObserver{nullptr};
};
}// namespace Cicada
#endif//CICADAMEDIA_IDCA_H
16 changes: 11 additions & 5 deletions framework/demuxer/IDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
#include "utils/AFMediaType.h"
#include "play_list/playList.h"

#include "DemuxerMetaInfo.h"
#include <base/IDCA.h>
#include <base/OptionOwner.h>
#include <base/media/IAFPacket.h>
#include <data_source/IDataSource.h>
#include <functional>
#include <string>
#include <utility>
#include <utils/CicadaType.h>
#include <base/media/IAFPacket.h>
#include <utils/mediaTypeInternal.h>
#include <base/OptionOwner.h>
#include <data_source/IDataSource.h>
#include "DemuxerMetaInfo.h"

namespace Cicada {
typedef enum demuxer_type {
Expand All @@ -28,7 +29,7 @@ namespace Cicada {
} demuxer_type;


class CICADA_CPLUS_EXTERN IDemuxer : public OptionOwner {
class CICADA_CPLUS_EXTERN IDemuxer : public OptionOwner, public IDCA {
public:


Expand Down Expand Up @@ -165,6 +166,11 @@ namespace Cicada {
return false;
}

int invoke(int cmd, const std::string &content) override
{
return 0;
}

protected:
demuxer_callback_read mReadCb{nullptr};
demuxer_callback_seek mSeekCb{nullptr};
Expand Down

0 comments on commit 2e948b8

Please sign in to comment.