Fixed warnings and memmory leaks
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14607 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
e4e22bb1af
commit
e7ea085912
@ -59,11 +59,11 @@ bool GStreamerImageStream::open(const std::string& filename)
|
||||
|
||||
bool has_audio_stream = false;
|
||||
|
||||
GstDiscoverer *item = gst_discoverer_new(1*GST_SECOND, &error);
|
||||
gchar *uri = g_filename_to_uri(filename.c_str(), NULL, NULL);
|
||||
|
||||
if( gst_uri_is_valid(uri) )
|
||||
if( uri!=0 && gst_uri_is_valid(uri) )
|
||||
{
|
||||
GstDiscoverer *item = gst_discoverer_new(1*GST_SECOND, &error);
|
||||
GstDiscovererInfo *info = gst_discoverer_discover_uri(item, uri, &error);
|
||||
GList *audio_list = gst_discoverer_info_get_audio_streams(info);
|
||||
|
||||
@ -75,11 +75,11 @@ bool GStreamerImageStream::open(const std::string& filename)
|
||||
}
|
||||
|
||||
// build pipeline
|
||||
|
||||
const gchar *audio_pipe = "";
|
||||
|
||||
if( has_audio_stream )
|
||||
{
|
||||
audio_pipe = "deco. ! queue ! audioconvert ! autoaudiosink";
|
||||
}
|
||||
|
||||
gchar *string = g_strdup_printf("filesrc location=%s ! \
|
||||
decodebin name=deco \
|
||||
@ -88,17 +88,21 @@ bool GStreamerImageStream::open(const std::string& filename)
|
||||
|
||||
_pipeline = gst_parse_launch(string, &error);
|
||||
|
||||
if( _pipeline == NULL )
|
||||
g_free(string);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_printerr("Error: %s\n", error->message);
|
||||
g_error_free(error);
|
||||
}
|
||||
|
||||
if( _pipeline == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
g_free(string);
|
||||
g_error_free(error);
|
||||
|
||||
// bus
|
||||
|
||||
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(_pipeline));
|
||||
|
||||
gst_bus_add_watch(bus, (GstBusFunc)on_message, this);
|
||||
|
Loading…
Reference in New Issue
Block a user