Gstreamer


Documentation


GStreamer アプリケーション開発マニュアル 日本語訳 (0.10.25.1)
http://oss.infoscience.co.jp/gstreamer/


gst-launch-0.10(1) - Linux man page
http://linux.die.net/man/1/gst-launch-0.10

Debug

Gstreamerはデバッグシステム機能をサポートしている。
http://oss.infoscience.co.jp/gstreamer/section-checklist-debug.html

デバッグ出力例:
  • --gst-debug-level=5
全てのデバッグ出力を有効にする。出力量が膨大になるのでファイルにリダイレクトするとよい。
  • --gst-debug=oggdemux:5
  • --gst-debug=GST_AUTOPLUG:5,avidemux:3
  • --gst-debug=GST_PIPELINE:5

環境変数によってデバッグ機能を有効にすることも可能である。
export GST_DEBUG=GST_PIPELINE:5

gdbでデバッグするためにはソースからコンパイルする必要がある。
configureはデフォルトでデバッグシンボル、デバッグシステムがenableになっているので
オプションには何も指定しないくてもよい。
./configure

Configuration
       Version                    : 0.10.28
       Source code location       : .
       Prefix                     : /usr/local
       Compiler                   : gcc
       Package name               : GStreamer source release
       Package origin             : Unknown package origin

       Documentation (manuals)    : no
       Documentation (API)        : no

       Debug Logging              : yes
       Pipeline XML load/save     : yes
       Command-line parser        : yes
       Option parsing in gst_init : yes
       Tracing subsystem          : yes
       Allocation tracing         : yes
       Plugin registry            : yes
       Plugin support             : yes
       Network support            : yes
       Unit testing support       : yes

       Debug                      : yes
       Profiling                  : no

       Building examples          : yes
       Building test apps         : yes
       Building tests that fail   : no

なお、gst-plugins-base、gst-plugins-goodのコンフィギュアオプションも同様である。
プラグインのビルドは依存パッケージが多いのでコンフィギュアの結果、ビルドしない
ものが多々でてくる。その場合はconfig.logからエラーを探し、依存パッケージを
インストールする。

ex: xvimagesink
# config.log
configure:25663: checking for XvQueryExtension in -lXv
configure:25688: gcc -o conftest -g -O2 conftest.c -lXv -lSM -lICE -lX11 -lXext >&5
/usr/bin/ld: cannot find -lXv
collect2: ld returned 1 exit status
...
configure:25697: result: no
configure:25738: *** These plugins will not be built: xvimagesink

# install
sudo apt-get install libxv-dev

この作業が面倒ならapt-getで依存パッケージを一括インストールしてもよい。
sudo apt-get build-dep gstreamer0.10-plugins-base
sudo apt-get build-dep gstreamer0.10-plugins-good

Test

Sample movie

GOMの公式サイトのサポートに各フォーマットのサンプル動画がある
http://www.gomplayer.jp/support/sample.html

Execution method

# 利用可能なデバッグカテゴリ表示
gst-launch --gst-debug-help
# Manual
gst-launch videotestsrc ! ximagesink --gst-debug-level=5 > videotestsrc_all.txt 2>&1
gst-launch videotestsrc ! ximagesink --gst-debug=GST_PARENTAGE:5 > videotestsrc_plugin.txt 2>&1
gst-launch videotestsrc ! ximagesink --gst-debug=GST_PIPELINE:5,GST_PLUGIN_LOADING:5,GST_PARENTAGE:5 > videotestsrc_plugin.txt 2>&1
# Autoplugging
gst-launch playbin uri=file:///home/fusilier/build/gst/samples/data/mov_jpeg_aac.mov --gst-debug-level=5 > mov_jpeg_acc_all.txt 2>&1
gst-launch playbin uri=file:///home/fusilier/build/gst/samples/data/mov_jpeg_aac.mov --gst-debug=GST_PARENTAGE:5 > mov_jpeg_acc_plugin.txt 2>&1
gst-launch playbin uri=file:///home/fusilier/build/gst/samples/data/mov_jpeg_aac.mov --gst-debug=GST_PIPELINE:5,GST_PLUGIN_LOADING:5,GST_PARENTAGE:5 > mov_jpeg_acc_plugin.txt 2>&1

print pipeline

パイプラインの汎用的なデバッグ出力方法は次の通りである。
1. GST_PARENTAGE:5のデバッグ情報を出力する
2. デバッグ情報にbinへのエレメント追加/削除関数を対象としたgrepをかける
秀丸 grep string
(gst_bin_((add)|(remove))_func)|(Pipeline is PREROLLED)

Case A) gst-launch videotestsrc ! ximagesink
grep result
... GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<pipeline0> added element "videotestsrc0"
... GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<pipeline0> element "ximagesink0" was sink
... GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<pipeline0> added element "ximagesink0"
Pipeline is PREROLLED ...
... GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<pipeline0> removed child "ximagesink0"
... GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<pipeline0> removed child "videotestsrc0"

pipeline0 : videotestsrc0 -> ximagesink0

GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<playbin0> element "test" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "test"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "source"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<GstDecodeBin@0x811a080> added element "typefind"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<GstDecodeBin@0x811a080> added element "fakesink"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "decodebin0"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<decodebin0> added element "qtdemux0"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<decodebin0> added element "queue0"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<decodebin0> added element "jpegdec0"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "selector_video_src0"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "preroll_video_src0"
GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<GstAutoVideoSink@0x811df08> element "tempsink" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<GstAutoVideoSink@0x811df08> added element "tempsink"
GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<vbin> element "videosink" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<vbin> added element "videosink"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<vbin> added element "vconv"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<vbin> added element "vscale"
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<vbin> added element "id"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<videosink> removed child "tempsink"
GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<videosink> element "videosink-actual-sink-ximage" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<videosink> added element "videosink-actual-sink-ximage"
GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<playbin0> element "vbin" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "vbin"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "test"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<decodebin0> removed child "fakesink"
Pipeline is PREROLLED ...
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<playbin0> added element "fakesrc0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<decodebin0> removed child "jpegdec0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<decodebin0> removed child "queue0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<decodebin0> removed child "qtdemux0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "decodebin0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "fakesrc0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "preroll_video_src0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "selector_video_src0"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "source"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<videosink> removed child "videosink-actual-sink-ximage"
GST_PARENTAGE gstbin.c:1021:gst_bin_add_func:<videosink> element "tempsink" was sink
GST_PARENTAGE gstbin.c:1096:gst_bin_add_func:<videosink> added element "tempsink"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<playbin0> removed child "vbin"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<decodebin0> removed child "typefind"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<vbin> removed child "id"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<vbin> removed child "vscale"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<vbin> removed child "vconv"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<vbin> removed child "videosink"
GST_PARENTAGE gstbin.c:1371:gst_bin_remove_func:<videosink> removed child "tempsink"

playbin0: source -> decodebin0 -> selector_video_src0 -> preroll_video_src0 -> vbin
decodebin0: typefind -> qtdemux0 -> queue0 -> jpegdec0
vbin: videosink -> vconv -> vscale -> id
videosink: videosink-actual-sink-ximage

Core

GstBin

GstBuffer

GstPipeline

GstPlugin


Core Library

GstBaseSrc

GstBaseSink

GstPushSrc


Plugin

Imaginary element

Gstreamerはアプリがパイプラインを流れるデータを追加・削除する仮想エレメントを提供している。
http://oss.infoscience.co.jp/gstreamer/section-data-spoof.html
Plugin Description Signal call
fakesrc an imaginary source _get()
fakesink an imaginary sink _chain()
identity an imaginary filter _chain()

特徴
  • これらの仮想エレメントは"handoff" シグナルを提供している
  • このシグナルはfakesrcは_get()、identityとfakesink の場合は_chain()関数からコールされる
  • g_signal_connectを使用してコールバック関数を登録する
  • ex: g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL);

Source Hierarchy


Statical View


Dynamic View

gst-launch filesrc location=sample.jpg ! jpegdec ! ffmpegcolorspace ! ximagesink
gst-launch filesrc location=mov_jpeg_aac.mov ! qtdemux ! jpegdec ! ffmpegcolorspace ! ximagesink

Note



ToDo

  • ffmpegcolorspace追加
  • StaticalViewのGstBin修正
  • qtdemuxなどのパッド情報記述
  • バッファ管理方法 プール
  • GstEditor
最終更新:2011年09月03日 19:50
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。
添付ファイル