2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GStreamerAdvent Calendar 2016

Day 5

gst-examples を試す

Posted at

gst-examples

1.10のリリースノートの中にgst-examplesというサンプルアプリが含まれていました。今回はコレをビルド・実行してみようと思います。

ビルドには meson を使う

gst-examplesをcloneするとわかるのですが、gst-examplesにはmakefileが含まれていません。

$ git clone git://anongit.freedesktop.org/gstreamer/gst-examples
$ find gst-examples/ | grep -i makefile || echo not found.
not found.

ビルドにはmesonを使います。mesonaptでもpipでもインストールできます。

$ apt-get install meson
$ which meson
/usr/bin/meson

mesonの使い方は簡単です。

  1. プロジェクトのルートディレクトリにビルド用ディレクトリ用意
  2. プロジェクトのルートディレクトリで、meson <ビルド用ディレクトリ>を実行
  3. プロジェクトのビルド用ディレクトリ内で、ninjaを実行

だけです。やってみると↓こんな感じ。

$ cd gst-examples
$ mkdir build
$ meson build/
the meson build system
version: 0.36.0
source dir: /home/shotam/src/gst/gst-examples
build dir: /home/shotam/src/gst/gst-examples/build
build type: native build
project name: gst-examples
native c compiler: cc (gcc 6.2.1)
build machine cpu family: x86_64
build machine cpu: x86_64
found pkg-config: /usr/bin/pkg-config (0.29)
native dependency gstreamer-1.0 found: yes 1.10.2
native dependency gstreamer-player-1.0 found: yes 1.10.2
library m found: yes
native dependency glib-2.0 found: yes 2.50.2
native dependency gobject-2.0 found: yes 2.50.2
native dependency gmodule-2.0 found: yes 2.50.2
native dependency gstreamer-tag-1.0 found: yes 1.10.2
native dependency gtk+-3.0 found: yes 3.22.5
native dependency x11 found: yes 1.6.4
native dependency glib-2.0 found: yes 2.50.2
warning: glib compiled dependencies do not work reliably with
the current version of glib. see the following upstream issue: https://bugzilla.gnome.org/show_bug.cgi?id=774368
xmllint not set and xmllint not found in path; skipping xml preprocessing.
native dependency gio-2.0 found: yes 2.50.2
build targets in project: 5
$ cd build/
$ ninja
[1/11] 'generating gtk-play-resources_h with a custom command.'
xmllint not set and xmllint not found in path; skipping xml preprocessing.
[2/11] 'generating gtk-play-resources_c with a custom command.'
xmllint not set and xmllint not found in path; skipping xml preprocessing.
[10/11] compiling c object 'playback/player/gtk/gtk-play@exe/gtk-play.c.o'
../playback/player/gtk/gtk-play.c: in function ‘gtk_player_popup_menu_create’:
../playback/player/gtk/gtk-play.c:1266:3: warning: ‘gtk_menu_popup’ is deprecated: use '(gtk_menu_popup_at_widget, gtk_menu_popup_at_pointer, gtk_menu_popup_at_rect)' instead [-wdeprecated-declarations]
   gtk_menu_popup (gtk_menu (menu), null, null, null, null,
   ^~~~~~~~~~~~~~
in file included from /usr/include/gtk-3.0/gtk/gtklabel.h:34:0,
                 from /usr/include/gtk-3.0/gtk/gtkaccellabel.h:35,
                 from /usr/include/gtk-3.0/gtk/gtk.h:33,
                 from ../playback/player/gtk/gtk-play.c:38:
/usr/include/gtk-3.0/gtk/gtkmenu.h:138:9: note: declared here
 void    gtk_menu_popup    (gtkmenu        *menu,
         ^~~~~~~~~~~~~~
[11/11] linking target playback/player/gtk/gtk-play

ビルドするとbuildディレクトリはこのようになります。

build
|-- build.ninja
|-- compile_commands.json
|-- meson-logs
|   `-- meson-log.txt
|-- meson-private
|   |-- build.dat
|   |-- coredata.dat
|   |-- install.dat
|   |-- meson_benchmark_setup.dat
```shell-session
|   |-- meson_test_setup.dat
|   |-- sanitycheckc.c
|   `-- sanitycheckc.exe
|-- network
|   `-- http-launch
|       |-- http-launch
|       `-- http-launch@exe
|           `-- http-launch.c.o
`-- playback
    `-- player
        |-- gst-play
        |   |-- gst-play
        |   `-- gst-play@exe
        |       |-- gst-play-kb.c.o
        |       `-- gst-play.c.o
        `-- gtk
            |-- gtk-play
            |-- gtk-play-resources.c
            |-- gtk-play-resources.h
            `-- gtk-play@exe
                |-- gtk-play.c.o
                |-- gtk-video-renderer.c.o
                `-- playback_player_gtk_gtk-play-resources.c.o

ちなみに、mesonはビルドに必要なものが足りないものがある場合、これを報告してくれます。

$ meson build/
the meson build system
version: 0.36.0
source dir: /home/shotam/src/gst/gst-examples
build dir: /home/shotam/src/gst/gst-examples/build
build type: native build
project name: gst-examples
native c compiler: cc (gcc 6.2.1)
build machine cpu family: x86_64
build machine cpu: x86_64
found pkg-config: /usr/bin/pkg-config (0.29)
native dependency gstreamer-1.0 found: yes 1.10.2
native dependency gstreamer-player-1.0 found: yes 1.10.2
library m found: yes
native dependency glib-2.0 found: yes 2.50.2
native dependency gobject-2.0 found: yes 2.50.2
native dependency gmodule-2.0 found: yes 2.50.2
native dependency gstreamer-tag-1.0 found: yes 1.10.2

meson encountered an error in file playback/player/gtk/meson.build, line 7, column 0:
native dependency gtk+-3.0 not found.

ビルドした gtk-play を実行する

試しに gtk-play を実行してみます。

$ build/playback/player/gtk/gtk-play neko.avi

Screenshot from 2016-12-11 21-46-51.png

まとめ

今回は gst-examples を触ってみました。gst-examples は今後より増えていく予定です。
アプリを作る時にはこういったサンプルを見てから作るのが良さそうですね。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?