GStreamerにより動画のストリーム配信を行うコードを、チュートリアルのコードを作成しながら勉強中です。
チュートリアルのコードはこちらのサイトを参考にしています。
動かそうとしているのは、GstElement の作成用の以下のコードです。
C
1#include <gst/gst.h> 2 3int 4main(int argc, 5char *argv[]) 6{ 7 GstElement *element; 8 9 /* init GStreamer */ 10 gst_init(NULL, NULL); 11 12 /* create element */ 13 element = gst_element_factory_make("fakesrc", "source"); 14 if (!element) { 15 g_print("Failed to create element of type 'fakesrc'\n"); 16 return -1; 17 } 18 19 gst_object_unref(GST_OBJECT(element)); 20 21 return 0; 22}
このコードを動かすと、gst_element_factory_make関数のところでNULLが返ってきます。
gst_element_factory_make関数でNULLが返ってくるのは、新しいGstElementの要素を作成できない場合と
リファレンスにありますが、何故要素が作成できないのか分かりません。
原因、解決方法が分かる方がおられましたら、宜しくお願い致します。
追記
以下の環境で実行しています。
OS:Windows 10 64bit
統合開発環境:Visual Studio Express 2013 for Windows Desktop
また、「gst-inspect-1.0 fakesrc」を実行すると以下の結果が得られます。
WARNING: no real random source present!
Factory Details:
Rank none (0)
Long-name Fake Source
Klass Source
Description Push empty (no data) buffers around
Author Erik Walthinsen omega@cse.ogi.edu, Wim Taymans wim@fluendo.com
Plugin Details:
Name coreelements
Description GStreamer core elements
Filename C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\libgstcoreelements.dll
Version 1.16.0
License LGPL
Source module gstreamer
Binary package GStreamer source release
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseSrc
+----GstFakeSrc
Pad Templates:
SRC template: 'src'
Availability: Always
Capabilities:
ANY
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SRC: 'src'
Pad Template: 'src'
Element Properties:
blocksize : Size in bytes to read per buffer (-1 = default)
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 4096
can-activate-pull : Can activate in pull mode
flags: readable, writable
Boolean. Default: true
can-activate-push : Can activate in push mode
flags: readable, writable
Boolean. Default: true
data : Data allocation method
flags: readable, writable
Enum "GstFakeSrcDataType" Default: 1, "allocate"
(1): allocate - Allocate data
(2): subbuffer - Subbuffer data
datarate : Timestamps buffers with number of bytes per second (0 = none)
flags: readable, writable
Integer. Range: 0 - 2147483647 Default: 0
do-timestamp : Apply current stream time to buffers
flags: readable, writable
Boolean. Default: false
dump : Dump buffer contents to stdout
flags: readable, writable
Boolean. Default: false
filltype : How to fill the buffer, if at all
flags: readable, writable
Enum "GstFakeSrcFillType" Default: 1, "nothing"
(1): nothing - Leave data as malloced
(2): zero - Fill buffers with zeros
(3): random - Fill buffers with random data
(4): pattern - Fill buffers with pattern 0x00 -> 0xff
(5): pattern-span - Fill buffers with pattern 0x00 -> 0xff that spans buffers
format : The format of the segment events
flags: readable, writable
Enum "GstFormat" Default: 2, "bytes"
(0): undefined - GST_FORMAT_UNDEFINED
(1): default - GST_FORMAT_DEFAULT
(2): bytes - GST_FORMAT_BYTES
(3): time - GST_FORMAT_TIME
(4): buffers - GST_FORMAT_BUFFERS
(5): percent - GST_FORMAT_PERCENT
is-live : True if the element cannot produce data in PAUSED
flags: readable, writable
Boolean. Default: false
last-message : The last status message
flags: readable
String. Default: null
name : The name of the object
flags: readable, writable
String. Default: "fakesrc0"
num-buffers : Number of buffers to output before sending EOS (-1 = unlimited)
flags: readable, writable
Integer. Range: -1 - 2147483647 Default: -1
parent : The parent of the object
flags: readable, writable
Object of type "GstObject"
parentsize : Size of parent buffer for sub-buffered allocation
flags: readable, writable
Integer. Range: 0 - 2147483647 Default: 40960
pattern : Set the pattern (unused)
flags: readable, writable
String. Default: null
signal-handoffs : Send a signal before pushing the buffer
flags: readable, writable
Boolean. Default: false
silent : Don't produce last_message events
flags: readable, writable
Boolean. Default: true
sizemax : Maximum buffer size
flags: readable, writable
Integer. Range: 0 - 2147483647 Default: 4096
sizemin : Minimum buffer size
flags: readable, writable
Integer. Range: 0 - 2147483647 Default: 0
sizetype : How to determine buffer sizes
flags: readable, writable
Enum "GstFakeSrcSizeType" Default: 1, "empty"
(1): empty - Send empty buffers
(2): fixed - Fixed size buffers (sizemax sized)
(3): random - Random sized buffers (sizemin <= size <= sizemax)
sync : Sync to the clock to the datarate
flags: readable, writable
Boolean. Default: false
typefind : Run typefind before negotiating (deprecated, non-functional)
flags: readable, writable, deprecated
Boolean. Default: false
Element Signals:
"handoff" : void user_function (GstElement* object,
GstBuffer* arg0,
GstPad* arg1,
gpointer user_data);
回答3件
あなたの回答
tips
プレビュー