Last active
December 2, 2018 13:53
-
-
Save satoru-naruko/9c37c36c2b2bc8ed8bd2d3f8881e16af to your computer and use it in GitHub Desktop.
gstreamer tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gsttestapp.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 | |
// | |
#include "pch.h" | |
#include <gst/gst.h> | |
int basic_tutorial_1(int argc, char *argv[]); | |
int main(int argc, char *argv[]) | |
{ | |
basic_tutorial_1(argc, argv); | |
} | |
int basic_tutorial_1(int argc, char *argv[]) | |
{ | |
GstElement *pipeline; | |
GstBus *bus; | |
GstMessage *msg; | |
/* Initialize GStreamer */ | |
gst_init(&argc, &argv); | |
/* Build the pipeline */ | |
pipeline = gst_parse_launch("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL); | |
/* Start playing */ | |
gst_element_set_state(pipeline, GST_STATE_PLAYING); | |
/* Wait until error or EOS */ | |
bus = gst_element_get_bus(pipeline); | |
msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GstMessageType::GST_MESSAGE_ERROR | GstMessageType::GST_MESSAGE_EOS)); | |
/* Free resources */ | |
if (msg != NULL) | |
gst_message_unref(msg); | |
gst_object_unref(bus); | |
gst_element_set_state(pipeline, GST_STATE_NULL); | |
gst_object_unref(pipeline); | |
return 0; | |
} | |
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー | |
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー | |
// 作業を開始するためのヒント: | |
// 1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します | |
// 2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します | |
// 3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します | |
// 4. エラー一覧ウィンドウを使用してエラーを表示します | |
// 5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します | |
// 6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment