[Solved] Qt5 media service について
- 
環境 
 ホスト:ubuntu12.04
 ターゲット:i.MX53
 Qt 5.2.1組み込みLinuxで Qt5 をテストしています。 端末から、Qt5のサンプルの player を実行させると下記のメッセージが表示されます。/usr/local/QtEmbedded-5.2.1/examples/multimediawidgets/player # ./player
 QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
 QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
 EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
 EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
 defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
 Panning swap enabled
 This plugin does not support propagateSizeHints()
 This plugin does not support propagateSizeHints()
 Panning swap enabled画面には、下記のメッセージが表示されます。The QMediaPlayer object dose not have a valid service.
 Please check the media service plugins are installed.media serviec plugins をインストールしないといけないようです。
 下記のように、plugins/mediaservice には、ライブラリが1つしかありません。~ # ls /usr/local/QtEmbedded-5.2.1/plugins/mediaservice/
 libqtmedia_audioengine.so
 ~ #どのようにして足りないライブラリを追加すれば良いでしょうか? 
 足りないのは、libgstmedia*.so でしょうか?以上、よろしくお願いします。 
- 
libgstmediaplayer.so などのプラグインが必要です。 
 Qt のビルド時に GStreamer 関連の開発環境が足りない場合には GStreamer 関連のプラグインはビルドされません。
 qtmultimedia/config.tests/gstreamer* が確認用のプロジェクトですので、そちらを確認してください。
 また、qtmultimedia をビルドしたディレクトリの config.log も参考になると思います。
- 
Qt のビルド時に GStreamer 関連の開発環境が足りない場合には GStreamer 関連のプラグインはビルドされません。 -sysroot で指定するターゲットのrootfs にGStreamer 関連の開境が必要という事でしょうか? 
 rootfs には、/lib/libgstreamer0.10.so.* や、/lib/libgst* などのライブラリはあります。qtmultimedia/config.tests/gstreamer* が確認用のプロジェクトですので、そちらを確認してください。 qtmultimedia/config.tests/gstreamer* はディレクトリ(プロジェクト?)が4つありましたが、 
 確認とは、どのようにするのでしょうか?以上、よろしくお願いします。 
- 
config.log を見ました。executing config test gstreamer - cd /home/vaio/qt-everywhere-opensource-src-5.2.1/qtmultimedia/config.tests/gstreamer && /home/vaio/qt-everywhere-opensource-src-5.2.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" /home/vaio/qt-everywhere-opensource-src-5.2.1/qtmultimedia/config.tests/gstreamer
 Project ERROR: gstreamer-0.10 development package not found
 test gstreamer FAILED
 
 gstreamer-0.10 development package がないとエラーになっていました。 ターゲットの rootfs には、gstreamer-0.10.28 をインストールしている状態ですが、エラーのpackage とは別物でしょうか? 以上、よろしくお願いします。 
- cd /home/vaio/qt-everywhere-opensource-src-5.2.1/qtmultimedia/config.tests/gstreamer && /home/vaio/qt-everywhere-opensource-src-5.2.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" /home/vaio/qt-everywhere-opensource-src-5.2.1/qtmultimedia/config.tests/gstreamer
- 
ターゲットの構成は、下記のようになっています。 
 SYSROOT/include/gstreamer-0.10/gst/base/
 SYSROOT/include/gstreamer-0.10/gst/check/
 SYSROOT/include/gstreamer-0.10/gst/controller/
 SYSROOT/include/gstreamer-0.10/gst/dataprotocol/
 SYSROOT/include/gstreamer-0.10/gst/gst*.hSYSROOT/usr/include/ にコピーしてみましたが同じでした。 以上、よろしくお願いします。 
- 
gstreamer-0.10.28 
 gst-plugins-base-0.10.28
 gst-plugins-good-0.10.26
 gst-plugins-bad-0.10.14
 gst-plugins-ugly-0.10.11
 gst-ffmpeg-0.10.10上記をインストールして、libgstmediaplayer.so がビルドされるか確認してみます。 
- 
libgstmediaplayer.so などのプラグインが必要です。 下記をインストールしました。 
 gstreamer-0.10.28
 gst-plugins-base-0.10.28
 gst-plugins-good-0.10.26
 gst-plugins-bad-0.10.14
 gst-plugins-ugly-0.10.11
 gst-ffmpeg-0.10.10 (← これだけエラーが取れずインストールできていません)しかし、libgstmediaplayer.so が見当たりません。 
 どのプラグインをインストールすれば、libgstmediaplayer.so が組み込まれるのでしょうか?以上、よろしくお願いします。 chung@ubuntu:~/workspace/rootfs/build/rootfs/usr/lib/gstreamer-0.10$ ls -all合計 25108 
 drwxrwxr-x 2 chung chung 12288 6月 17 16:42 .
 drwxr-xr-x 5 chung chung 4096 6月 17 16:41 ..
 :
 :
 -rwxr-xr-x 1 chung chung 2478 6月 17 16:38 libgstmatroska.la
 -rwxr-xr-x 1 chung chung 455594 6月 17 16:38 libgstmatroska.so
 -rwxr-xr-x 1 chung chung 2030 6月 17 16:41 libgstmpeg4videoparse.la
 -rwxr-xr-x 1 chung chung 79745 6月 17 16:41 libgstmpeg4videoparse.so
 -rwxr-xr-x 1 chung chung 2024 6月 17 16:42 libgstmpegaudioparse.la
 -rwxr-xr-x 1 chung chung 166142 6月 17 16:42 libgstmpegaudioparse.so
 -rwxr-xr-x 1 chung chung 2110 6月 17 16:41 libgstmpegdemux.la
 -rwxr-xr-x 1 chung chung 533629 6月 17 16:41 libgstmpegdemux.so
 -rwxr-xr-x 1 chung chung 2249 6月 17 16:42 libgstmpegstream.la
 -rwxr-xr-x 1 chung chung 249770 6月 17 16:42 libgstmpegstream.so
 -rwxr-xr-x 1 chung chung 1994 6月 17 16:41 libgstmpegtsmux.la
 -rwxr-xr-x 1 chung chung 165861 6月 17 16:41 libgstmpegtsmux.so
 -rwxr-xr-x 1 chung chung 2024 6月 17 16:41 libgstmpegvideoparse.la
 -rwxr-xr-x 1 chung chung 98689 6月 17 16:41 libgstmpegvideoparse.so
 -rwxr-xr-x 1 chung chung 1849 6月 17 16:38 libgstmulaw.la
 -rwxr-xr-x 1 chung chung 75926 6月 17 16:38 libgstmulaw.so
 :
 :
- 
GStreamerインストール後にqtmultimediaモジュールの再ビルドは行っていますか。 
 その際にqmakeの再実行も必要だと思います。
 うまくいかない場合は qtmultimedia をビルドしたディレクトリに config.log ファイルがあればその内容を教えてください。
- 
やはり、GStreamer が正しくインストールできていないようです。 下記をインストールしました。 
 gstreamer-0.10.28
 gst-plugins-base-0.10.28
 gst-plugins-good-0.10.26
 gst-plugins-bad-0.10.14
 gst-plugins-ugly-0.10.11
 gst-ffmpeg-0.10.10 (これもできました)しかし、 
 ・gst-launch audiotestsrc ! autoaudiosink では、正常に音が出ますが、
 ・gst-launch videotestsrc ! autovideosink では、画像が表示されません。
 ・gst-launch playbin2 uri=file://xxxx.mp4 では、音だけ出て動画が出ません。
 ~ # gst-launch videotestsrc ! autovideosink
 Setting pipeline to PAUSED ...
 Pipeline is PREROLLING ...
 WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0: Resource not found.
 Additional debug info:
 gstautovideosink.c(313): gst_auto_video_sink_find_best (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0:
 Failed to find a usable video sink
 Pipeline is PREROLLED ...
 Setting pipeline to PLAYING ...
 New clock: GstSystemClockQt 以前に、gst-launch を使用して、音や動画の確認が必要と思い、 
 いろいろ調べてはいますが行き詰っております。GStreamer の話で申し訳ありませんが、 
 何かお気づきの点がありましたら教えていただければと思います。以上 
- 
intervideosink を使うとメッセージは正しいですが、やはり画は出ません。 
 —————————————————————
 ~ # gst-launch videotestsrc ! intervideosink
 Setting pipeline to PAUSED ...
 Pipeline is PREROLLING ...
 Pipeline is PREROLLED ...
 Setting pipeline to PLAYING ...
 New clock: GstSystemClock
 —————————————————————組み込みボードなので、frame buffer 関連でしょうか? 
 PCにインストールした場合は正しく動画が再生されました。以上 
- 
GStreamerで画が出ない場合、原因がデコーダーかsinkのどちらかにある場合が多いと思います。 
 GST_DEBUG環境変数などを使って、何処でエラーが出ているかを確認してください。エラーがデコーダーが見つからない場合は対応するデコーダーを入れてください。(gst-ffmpegがあればたいていは問題ないと思いますが) エラーがsink(xvideosinkなど適切ではないsinkを選んでいる場合)はQt MultiMediaでは独自のsinkを作成して使用するので気にしないでいい場合もあります。ただ、まれにハードウェアデコーダを使用していてフルスクリーンのsinkにしか出力できないケースもあります。v4l2sink などを指定した場合に動作しないかを確認するのも手だと思います。 
- 
GStreamer で音と画、共に出るようになりました。 ・gstreamer 
 ・gst-plugins-base
 ・gst-plugins-good
 ・gst-plugins-bad
 ・gst-plugins-ugly
 ・gst-ffmpeg
 今まで上記の6つをインストールしていました。
 この場合は、音しか出なかったのですが、
 ・gst-fsl-plugin (ボードに付属)
 をインストールしたところ画も出るようになりました。開発ボードは freescale の i.MX53 を使っています。 
 ・gst-fsl-plugin はこのボード専用のプラグインなのかもしれません。そして、この状態で、QT3.1をビルドしましたが、いくつかエラーが出ました。 qtmultimedia をビルドしたディレクトリに config.log ファイルがあればその内容を教えてください。 qtmultimedia の config.log を転記(多いので抜粋)します。インクルードのパスの問題かも知れません。 executing config test pulseaudio - cd /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/pulseaudio && /home/vaio/qt-everywhere-opensource-src-5.3.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/pulseaudio
 Project ERROR: libpulse development package not found
 test pulseaudio FAILED
 executing config test gstreamer
- cd /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer && /home/vaio/qt-everywhere-opensource-src-5.3.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer
- cd /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer && make
 make[1]: ディレクトリ/home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer' に入ります /usr/local/DigiEL-5.9/x-tools/arm-cortex_a8-linux-gnueabi/bin/arm-cortex_a8-linux-gnueabi-g++ -c -pipe -mfloat-abi=softfp -O2 -O2 -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -Wno-psabi -fno-exceptions -Wall -W -fPIE -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/vaio/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/devices/linux-imx53qsb-g++ -I. -I/home/vaio/workspace/rootfs/build/rootfs/usr/include -o .obj/main.o main.cpp main.cpp:44:21: error: gst/gst.h: No such file or directory main.cpp:46: warning: unused parameter 'argc' main.cpp:46: warning: unused parameter 'argv' make[1]: *** [.obj/main.o] エラー 1 make[1]: ディレクトリ/home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer' から出ます
 test gstreamer FAILED
 
- cd /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/pulseaudio && /home/vaio/qt-everywhere-opensource-src-5.3.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" /home/vaio/qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/pulseaudio
- 
@main.cpp:44:21: error: gst/gst.h: No such file or directory@ とあるので、インストールしたGStreamerのヘッダーファイルが見つけられていないようです。 /home/vaio/workspace/rootfs/build/rootfs/usr/include/gst/gst.h はありますか。 
 GStreamer のヘッダーファイルをそこに置いて qmake を再度実行してください。
- 
/home/vaio/workspace/rootfs/build/rootfs/usr/include/gstreamer-0.10/gst になっていましたので、ディレクトリ構成を 
 /home/vaio/workspace/rootfs/build/rootfs/usr/include/gst にしました。
 が、結果は同じでした。
 gst には、gst.h や、多くの gstxxx.h があります。① libは、 
 /home/vaio/workspace/rootfs/build/rootfs/usr/lib/gstreamer-0.10 になっていますが、
 /home/vaio/workspace/rootfs/build/rootfs/usr/lib にする必要がありますか?② .qmake.cache が生成されるとき、alsa 以外は、no になっています。 
 Info: creating cache file /home/chung/qt-everywhere-opensource-src-5.3.1/qtmultimedia/.qmake.cache
 Checking for openal... no
 Checking for alsa... yes
 Checking for pulseaudio... no
 Checking for gstreamer... no
 Checking for resourcepolicy... no
 Checking for gpu_vivante... noこれは、まだ環境が正しくないという事ですね? 
 ここで、Checking for gstreamer... yes になるのが正解?③ .qmake.cache を削除するタイミングがわからないのですが、make前に常にするのでしょうか? よろしくお願いします。 
- 
config.log は変化していると思います。チェックしてみてください。 
 qt-everywhere-opensource-src-5.3.1/qtmultimedia/config.tests/gstreamer
 に Makefile が出来ていると思うので、そこでmakeが成功すれば環境が整ったということになります。- 
設定次第ですが、usr/lib 以下にある方がリンクは通りやすいと思います。 
- 
openal や pulseaudio などは no でかまいませんが、gstreamer が yes になる必要があります。 qtmultimedia/config.tests/gstreamer での make が成功する場合、yes になります。 
- 
qmake の実行前に消してください。make 時には必要なファイルなので消さないでください。 
 
- 
- 
qtmultimedia/config.tests/gstreamer で make しました。 
 足りないファイルがいろいろあるようです。
 glib.h glib-object.h などが必要ですが、
 これらは、Glib のソースをダウンロードし、ビルドしてインストールすればいいですか?In file included from main.cpp:44: 
 /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gst.h:27:18: error: glib.h: No such file or directory
 In file included from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gst.h:31,
 from main.cpp:44:
 /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstenumtypes.h:7:25: error: glib-object.h: No such file or directory
 In file included from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstelement.h:55,
 from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstbin.h:27,
 from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gst.h:34,
 from main.cpp:44:
 /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstconfig.h:197:28: error: libxml/parser.h: No such file or directory
 In file included from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstelementfactory.h:33,
 from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstelement.h:60,
 from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gstbin.h:27,
 from /home/chung/workspace/rootfs/build/rootfs/usr/include/gst/gst.h:34,
 from main.cpp:44:
- 
それらのファイルは GStreamer のビルド時に使用しているはずです。 
 新たなインストールは要らないと思いますが、その時に利用したものを rootfs にコピーしてみてください。
- 
glib関連のパスが通ってなかったようです。 
 必要なファイルをrootfsにおいてqmake したところ
 gstreamer... yes になりました。Info: creating cache file /home/chung/qt-everywhere-opensource-src-5.3.1/qtmultimedia/.qmake.cache 
 Checking for openal... no
 Checking for alsa... yes
 Checking for pulseaudio... no
 Checking for gstreamer... yes
 Checking for gstreamer_photography... no
 Checking for gstreamer_encodingprofiles... no
 Checking for gstreamer_appsrc... yes
 Checking for resourcepolicy... no
 Checking for gpu_vivante... noこれでビルドしなおしてみます。 
 ありがとうございました。
