Skip to content

Commit

Permalink
修改factory初始化codec过程
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyfcu committed Mar 20, 2024
1 parent e7921eb commit 5f66d9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/Extension/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ extern CodecPlugin g711a_plugin;
extern CodecPlugin g711u_plugin;
extern CodecPlugin l16_plugin;

REGISTER_CODEC(h264_plugin);
REGISTER_CODEC(h265_plugin);
REGISTER_CODEC(jpeg_plugin);
REGISTER_CODEC(aac_plugin);
REGISTER_CODEC(opus_plugin);
REGISTER_CODEC(g711a_plugin)
REGISTER_CODEC(g711u_plugin);
REGISTER_CODEC(l16_plugin);
void Factory::loadPlugins() {
registerPlugin(h264_plugin);
registerPlugin(h265_plugin);
registerPlugin(jpeg_plugin);
registerPlugin(aac_plugin);
registerPlugin(opus_plugin);
registerPlugin(g711a_plugin);
registerPlugin(g711u_plugin);
registerPlugin(l16_plugin);
}

void Factory::registerPlugin(const CodecPlugin &plugin) {
InfoL << "Load codec: " << getCodecName(plugin.getCodec());
Expand Down
3 changes: 2 additions & 1 deletion src/Extension/Factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ static toolkit::onceToken REGISTER_STATIC_VAR(s_token, __LINE__) ([]() { \
});

namespace mediakit {

struct CodecPlugin {
CodecId (*getCodec)();
Track::Ptr (*getTrackByCodecId)(int sample_rate, int channels, int sample_bit);
Expand All @@ -42,6 +41,8 @@ struct CodecPlugin {

class Factory {
public:
static void loadPlugins();

/**
* 注册插件,非线程安全的
*/
Expand Down

0 comments on commit 5f66d9d

Please sign in to comment.