0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GStreamerトラブルシューティングTips】C++からカスタムプラグインが読み込めない場合の対処法

Posted at

はじめに

GStreamerをC++から呼び出す際に、カスタムのプラグインが読み込めない場合の対処方法を示す。

動作確認環境

  • Ubuntu 20.04 x64

原因と対策

原因1:パスが通っていない

GStreamerで利用したいカスタムプラグインが配置されているフォルダのパスを通す必要がある。
C++でのGStreamerのパスを通すには、環境変数「GST_PLUGIN_PATH」を設定する。

bashに設定する、もしくは、C++で環境変数を設定する。

bashに環境変数を設定する場合

bashの~/.bashrcに以下のように設定する。

export GST_PLUGIN_PATH=/path/to/plugin1:/path/to/plugin2
  • パスが複数ある場合は、コロン(:)で区切る

C++内で環境変数を設定する場合

#include <cstdlib>
setenv("GST_PLUGIN_PATH", "/path/to/plugin1:/path/to/plugin2", 1);
  • 第3引数:1とすると、既存の値を上書きする

原因2: 参照ライブラリが更新されていない

パスを通しているにも関わらず、プラグインが利用できない場合は、以下を実行する。GStreamerの初期化(gst_init)後などに、GST_PLUGIN_PATHを更新すると発生する。

#include <gst/gst.h>
gst_update_registry();

まとめ

GStreamerをC++から呼び出す際に、カスタムのプラグインが読み込めない場合の対処方法を紹介した。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?