[gst-devel] Newbe Gstreamer for Win32

Larry Berlinski LBerlinski at inspireworksinc.com
Thu Nov 18 13:01:02 CET 2004


I finally got gstreamer-0.8.7 compiled on a W2K machine (using MSVS .NET 2003), but when attempting to run the samples in the doc, I ran into some problems. I hope someone can help me out.

A trival application was developed based on the sample code on pages 25, 27, and 28 of the gstreamer manual (see the code below). I compiled it (using cygwin) and ran the program. I got the following output.
------------------------------------------
[snip RESULTS]
SAMPLE 1 (init.c pg 25 GStreamer docs)...
...this program is linked to GStreamer version 0.8.5.
SAMPLE 2 (elementmake.c pg 27 GStreamer docs)...
...successfully created element from a factory.  releasing reference
SAMPLE 3 (elementget.c pg 28 GStreamer docs)...
Set a property named "name" to the value "mysource" on the element
(process:1432): GLib-GObject-WARNING **: invalid cast from `(null)' to `<unknown>'
(process:1432): GLib-GObject-CRITICAL **: file /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gobject.c: line 1207 (g_object_set): assertion `G_IS_OBJECT (object)' failed

Initialize a variant-like object to type string.
(process:1432): GLib-GObject-WARNING **: /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gtype.c:3350: type id `64' is invalid
(process:1432): GLib-GObject-WARNING **: can't peek value table for type `<unknown>' which is not currently referenced
(process:1432): GLib-GObject-CRITICAL **: /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gtype.c:2640: initialization assertion failed, use g_type_init() prior to this function
(process:1432): GLib-GObject-WARNING **: /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gvalue.c:95: cannot initialize GValue with type `(null)', this type has no GTypeValueTable implementation

Get the property named "name" into the variant
(process:1432): GLib-GObject-WARNING **: invalid cast from `(null)' to `<unknown>'
(process:1432): GLib-GObject-CRITICAL **: file /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gobject.c: line 1275 (g_object_get_property): assertion `G_IS_OBJECT (object)' failed

Attempting to get the value of the named property ...
(process:1432): GLib-GObject-CRITICAL **: file /ftproot/pub/gnome/platform/glib-2.4.7/gobject/gvaluetypes.c: line 785 (g_value_get_string): assertion `G_VALUE_HOLDS_STRING (value)' failed
...the value of the named property is [
[/snip RESULTS]
------------------------------------------
You'll note that in SAMPLE 1, the version reported is 0.8.5 ... however, like I mentioned before, I used the tar ball from 0.8.7 ... the difference is because the win32 gstversion.h is not being recreated from configure.in ... not a serious problem. 

However SAMPLE 3, fails miserably ... This is where I need help ... any ideas guys?

------- B E G I N  C O D E  S N I P P E T S ------
[snip main.cpp]
static const char sz_iwi_main_cpp[] = "$Header: $";

#include <application.h>

using namespace iwi;

int main(int argc, char *argv[])
{
        Application* pApp = new Application();
        pApp->Initialize(&argc, &argv);
        pApp->Run();
        return 0;
}
[/snip main.cpp]
------------------------------------------
[snip application.cpp]
static const char sz_iwi_application_cpp[] = "$Header: $";

#include <application.h>
#include <iostream>
extern "C"
 {
#include <gst/gst.h>
 }
using namespace std;

namespace iwi
{

void Application::Initialize(int* pargc, char** pargv[])
{
	gst_init(pargc, pargv);
}

int Application::Run()
{
	Sample1();
	Sample2();
	Sample3();
}

int Application::Sample1()
{
	cout << "SAMPLE 1 (init.c pg 29 GStreamer docs)..." << endl;
	
	guint major=0, minor=0, micro=0;
	gst_version(&major, &minor, &micro);
	cout << "...this program is linked to GStreamer version " << major << "." << minor << "." << micro << "." << endl;
}

int Application::Sample2()
{
	cout << "SAMPLE 2 (elementmake.c pg 31 GStreamer docs)..." << endl;
	
	// create a element from a factory
	GstElement* pElement = gst_element_factory_make("fakesrc", "source");
	if (!pElement)
		g_error("Could not create an element from 'fakesrc' factory.\n");
	cout << "...successfully created element from a factory.  releasing reference" << endl;
			
	// release the reference to the element (reference counting functionality should be wrapped in a C++ smart pointer)
	gst_object_unref(GST_OBJECT(pElement));
	return 1;
}

int Application::Sample3()
{
	cout << "SAMPLE 3 (elementget.c pg 32 GStreamer docs)..." << endl;
	
	GstElement* pElement = gst_element_factory_make("fakesrc", "source");
	if (!pElement)
		g_error("Could not create an element from 'fakesrc' factory.\n");

	// set a property named "name" to the value "mysource" on the element
	cout << "Set a property named \"name\" to the value \"mysource\" on the element" << endl;
	g_object_set(G_OBJECT(pElement), "name", "mysource", NULL);
	
	// initialize a varaint-like object to type string
	cout << "Initialize a variant-like object to type string." << endl;
	GValue value = {0};
	g_value_init(&value, G_TYPE_STRING);
	
	// get the property named "name" into the variant
	cout << "Get the property named \"name\" into the variant" << endl;
	g_object_get_property(G_OBJECT(pElement), "name", &value);
	
	// output the value contained in the property
        cout << "Attempting to get the value of the named property ..." << endl;
	cout << "...the value of the named property is [" << g_value_get_string(&value) << "]" << endl;
	
	// release the reference to the element (reference counting functionality should be wrapped in a C++ smart pointer)
	gst_object_unref(GST_OBJECT(pElement));
	return 1;
}

};	// iwi namespace
[/snip application.cpp]
------------------------------------------
,,,,    
Ô¿Ô¬    Larry Berlinski

--> There are 10 types of people who understand binary: those who do and those who don't.




More information about the gstreamer-devel mailing list