LoginSignup
1
0

More than 5 years have passed since last update.

gstreamerのsrtプラグインを1.12.x にバックポートする

Posted at

gstreamer 1.14.0 でsrtのプラグインが追加されました。
これを使用するために、gstreamer全体を1.14.x にアップデートするのがひとつの方法ですが、けっこう大変です。
gstreamer をソースからビルドする

そこで、もうひとつの方法として、srtプラグインだけをバックポートするというのがあります。
実際に1.12.4 にバックポートすることができたので、その手順を紹介します。

バックポートの概要

srtプラグインはgst-plugins-badの中のext/srtにあります。
このディレクトリはそのまま持ってきます。
configure.ac の中のsrtに関する部分だけを持ってきます。
その後は、autogen.sh でconfigure を作成し、configureを実行してMakefileを作成します。
ext/srt の下だけ makeして、でき上がった共有ライブラリのファイルをgstreamerのプラグインのディレクトリにコピーします。

ソースコードの入手

git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-bad
cd gst-plugins-bad/

ext/src の取り出し

まずは 1.14.1 をチェックアウトして、ext/srt のディレクトリの名前を変更。
また、configure.ac を別名でコピーしておく。

git checkout -b work2 1.14.1
cp configure.ac configure.ac.1.14.1
cp -a ext/srt ext/srt.1.14.1

ソースツリーを1.12.4 に変更して、先ほど変更したディレクトリを元に戻す。

git checkout -b work3 1.12.4
mv ext/srt.1.14.1 ext/srt

これで ext/srt のディレクトリを持って来れた。

configure.acの変更

次に、configure.ac の変更を確認。

diff -u configure.ac configure.ac.1.14.1 > configure.ac.diff

その中でsrtに関するところだけconfigure.acに追加する。
そうしてできたパッチはこちら。

$ git diff configure.ac
diff --git a/configure.ac b/configure.ac
index fc15bfd8a..7dbdbbae9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2466,6 +2466,13 @@ AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
 ])
 AC_SUBST(LIBMMS_LIBS)

+dnl *** libsrt ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_SRT, true)
+AG_GST_CHECK_FEATURE(SRT, [srt library], srt, [
+  PKG_CHECK_MODULES(SRT, srt, HAVE_SRT="yes", HAVE_SRT=no)
+  AC_SUBST(SRT_LIBS)
+  AC_SUBST(SRT_CFLAGS)
+])

 dnl *** libsrtp ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_SRTP, true)
@@ -3400,6 +3407,7 @@ AM_CONDITIONAL(USE_SOUNDTOUCH, false)
 AM_CONDITIONAL(USE_SPANDSP, false)
 AM_CONDITIONAL(USE_SPC, false)
 AM_CONDITIONAL(USE_SRTP, false)
+AM_CONDITIONAL(USE_SRT, false)
 AM_CONDITIONAL(USE_GME, false)
 AM_CONDITIONAL(USE_DVB, false)
 AM_CONDITIONAL(USE_ACM, false)
@@ -3703,6 +3711,7 @@ ext/smoothstreaming/Makefile
 ext/sndfile/Makefile
 ext/soundtouch/Makefile
 ext/spandsp/Makefile
+ext/srt/Makefile
 ext/srtp/Makefile
 ext/teletextdec/Makefile
 ext/gme/Makefile

configureしてmake

NOCONFIGURE=1 ./autogen.sh 
./configure
make

クロスビルドのときは ./configure のときに環境変数や引数をいろいろ指定します。

インストール

cd .libs/
cp libgstsrt.so /usr/lib/gstreamer-1.0/
cp libgstsrt.la /usr/lib/gstreamer-1.0/

srtのプラグインが認識されるか確認。

$ gst-inspect-1.0 |grep srt
subparse: subparse_typefind: srt, sub, mpsub, mdvd, smi, txt, dks, vtt
srt:  srtclientsrc: SRT client source
srt:  srtserversrc: SRT Server source
srt:  srtclientsink: SRT client sink
srt:  srtserversink: SRT server sink
srtp:  srtpenc: SRTP encoder
srtp:  srtpdec: SRTP decoder

これでOK。

1
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
1
0