How to debug Gstreamer on Windows

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

How to debug Gstreamer on Windows

erikherz
I have an app that runs on my Windows build machine but not on another windows machine.

I get this error:
gst_element_set_state() returns GST_STATE_CHANGE_FAILURE

I suspect that I am missing a library.

How can I debug what is happening?

My App is QT-based.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

yair
dependency walker sometime finds missing stuff. 
try to prepend it with GST_DEBUG:7 

more here

On Fri, Mar 27, 2020 at 1:19 AM Erik Herz <[hidden email]> wrote:
I have an app that runs on my Windows build machine but not on another windows machine.

I get this error:
gst_element_set_state() returns GST_STATE_CHANGE_FAILURE

I suspect that I am missing a library.

How can I debug what is happening?

My App is QT-based.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

Daniel Sperka
Could it be that you are using elements that do not work on windows? 

A desktop app, for example, will have to create different audio sink elements for mac/linux/windows/. When I had this bug, the windows version failed when creating "osxaudiosink", as it should. I was sloppy in checking for NULL or return values when adding,linking in pipeline. When I try to run application, it fails when I try to preroll (change of state to PAUSE) because the pipeline is incomplete (no sink). 

My fix was to use the correct elements for different platforms - the project (Qt) that has code something like this:

audioSink = NULL;

#if defined(Q_OS_MAC)

qDebug() << "make osxaudiosink for mac";

audioSink = gst_element_factory_make("osxaudiosink");

#elif defined(Q_OS_LINUX)

qDebug() << "make alsasink for linux";

audioSink = gst_element_factory_make("alsaudiosink");

#elif defined(Q_OS_WIN)

qDebug() << "make directsoundsink for win";

audioSink = gst_element_factory_make("directsoundsink");

#else

qDebug() << "Unsupported OS.";

#endif


Q_ASSERT(audioSink);



Dan


On Thu, Mar 26, 2020 at 4:34 PM Yair Reshef <[hidden email]> wrote:
dependency walker sometime finds missing stuff. 
try to prepend it with GST_DEBUG:7 

more here

On Fri, Mar 27, 2020 at 1:19 AM Erik Herz <[hidden email]> wrote:
I have an app that runs on my Windows build machine but not on another windows machine.

I get this error:
gst_element_set_state() returns GST_STATE_CHANGE_FAILURE

I suspect that I am missing a library.

How can I debug what is happening?

My App is QT-based.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

Daniel Sperka
Oops, I missed that both machines are windows machines. Sorry. d

On Fri, Mar 27, 2020 at 9:20 AM Daniel Sperka <[hidden email]> wrote:
Could it be that you are using elements that do not work on windows? 

A desktop app, for example, will have to create different audio sink elements for mac/linux/windows/. When I had this bug, the windows version failed when creating "osxaudiosink", as it should. I was sloppy in checking for NULL or return values when adding,linking in pipeline. When I try to run application, it fails when I try to preroll (change of state to PAUSE) because the pipeline is incomplete (no sink). 

My fix was to use the correct elements for different platforms - the project (Qt) that has code something like this:

audioSink = NULL;

#if defined(Q_OS_MAC)

qDebug() << "make osxaudiosink for mac";

audioSink = gst_element_factory_make("osxaudiosink");

#elif defined(Q_OS_LINUX)

qDebug() << "make alsasink for linux";

audioSink = gst_element_factory_make("alsaudiosink");

#elif defined(Q_OS_WIN)

qDebug() << "make directsoundsink for win";

audioSink = gst_element_factory_make("directsoundsink");

#else

qDebug() << "Unsupported OS.";

#endif


Q_ASSERT(audioSink);



Dan


On Thu, Mar 26, 2020 at 4:34 PM Yair Reshef <[hidden email]> wrote:
dependency walker sometime finds missing stuff. 
try to prepend it with GST_DEBUG:7 

more here

On Fri, Mar 27, 2020 at 1:19 AM Erik Herz <[hidden email]> wrote:
I have an app that runs on my Windows build machine but not on another windows machine.

I get this error:
gst_element_set_state() returns GST_STATE_CHANGE_FAILURE

I suspect that I am missing a library.

How can I debug what is happening?

My App is QT-based.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

David Ing
One thing to check is a compatibility issue with the C Runtime environment.  I have often seen this issues manifest as GST_STATE_CHANGE_FAILURE in the past.  These issues are very difficult to diagnose / debug.  (You may even find that the issue will not reproduce under a debugger.)

Are you using the mingw binaries for Gstreamer?  If so, these kinds of issues may disappear if you switch to the msvc binaries.  The msvc binaries also have debug symbols which makes it possible to debug (if the problem doesn't go away by itself), whereas the mingw binaries have no such symbols.

You should also check the C Runtime versions on your two Windows machines and see if they are different.

On Fri, Mar 27, 2020 at 9:21 AM Daniel Sperka <[hidden email]> wrote:
Oops, I missed that both machines are windows machines. Sorry. d

On Fri, Mar 27, 2020 at 9:20 AM Daniel Sperka <[hidden email]> wrote:
Could it be that you are using elements that do not work on windows? 

A desktop app, for example, will have to create different audio sink elements for mac/linux/windows/. When I had this bug, the windows version failed when creating "osxaudiosink", as it should. I was sloppy in checking for NULL or return values when adding,linking in pipeline. When I try to run application, it fails when I try to preroll (change of state to PAUSE) because the pipeline is incomplete (no sink). 

My fix was to use the correct elements for different platforms - the project (Qt) that has code something like this:

audioSink = NULL;

#if defined(Q_OS_MAC)

qDebug() << "make osxaudiosink for mac";

audioSink = gst_element_factory_make("osxaudiosink");

#elif defined(Q_OS_LINUX)

qDebug() << "make alsasink for linux";

audioSink = gst_element_factory_make("alsaudiosink");

#elif defined(Q_OS_WIN)

qDebug() << "make directsoundsink for win";

audioSink = gst_element_factory_make("directsoundsink");

#else

qDebug() << "Unsupported OS.";

#endif


Q_ASSERT(audioSink);



Dan


On Thu, Mar 26, 2020 at 4:34 PM Yair Reshef <[hidden email]> wrote:
dependency walker sometime finds missing stuff. 
try to prepend it with GST_DEBUG:7 

more here

On Fri, Mar 27, 2020 at 1:19 AM Erik Herz <[hidden email]> wrote:
I have an app that runs on my Windows build machine but not on another windows machine.

I get this error:
gst_element_set_state() returns GST_STATE_CHANGE_FAILURE

I suspect that I am missing a library.

How can I debug what is happening?

My App is QT-based.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

Tim Müller
In reply to this post by erikherz
On Thu, 2020-03-26 at 19:18 -0400, Erik Herz wrote:

Hi Erik,

> I have an app that runs on my Windows build machine but not on
> another windows machine.
>
> I get this error:
>
> gst_element_set_state() returns GST_STATE_CHANGE_FAILURE
>
> I suspect that I am missing a library.
>
> How can I debug what is happening?
>
> My App is QT-based.

First of all, there should (hopefully) be one or more error messages on
the pipeline's GstBus with details about the problem. So I'd recommend
you check those.

Secondly, you can run your app with GStreamer debug logging enabled,
either by setting the GST_DEBUG environment variable or by
programmatically doing something like:

  gst_debug_set_threshold_from_string("*:WARN", TRUE)

or

  gst_debug_set_default_threshold(GST_LEVEL_WARNING)

after gst_init().

If that doesn't show anything, try increasing the debug level to INFO
or DEBUG.

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by yair
Thank you, Yair.
I was able to get a ton of debugging output with your advice (and Tim's).

My steps:

Set GST_DEBUG=*:7

Then adding this to my command-line program execution:

1> out.txt 2>&1

eg: foo.exe 1> out.txt 2>&1

Now I will step through that. Happy to share it if anyone wants to see it.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by Daniel Sperka
Great advice, Dan. Thank you!

I found this useful too:
https://gstreamer.freedesktop.org/documentation/tutorials/basic/platform-specific-elements.html?gi-language=c

My application uses overlay which may preclude: directdrawsink ... I have it
working with d3dvideosink.

It is not working with dshowvideosink despite support for overlay ...

My application requires Windows 10, so perhaps I can get away with
d3dvideosink



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by David Ing
Thank you, David. I will look into the C runtimes on the target machines.

I just switched my build environment from QT with Gstreamer MSVC to MinGW as
the windeployqt.exe tool was giving me more complete library support ... but
I will set up another with MSVC to get access to those debugging symbols.

I isolated the problem to the most simple, video-only, pipeline:

"videotestsrc ! d3dvideosink  name=video_out";

... and still get the error.

I also set up a new QT build environment where it works with QT Creator
build (c:\qt) but not with the stand-alone (c:\qt\static) build.

So now I can test and debug on the same machine which should speed up the
process.

Here is my new QT environment:

1. Qt Creator 4.11.1 [Based on Qt 5.14.1 at (c:\qt\) ]
2. MinGW 7.3.0 64-bit
3. Command-line QT Version 5.9.9 (c:\qt\static) built with MinGW-64
(C:\Qt\Tools\mingw730_64)

I also posted my QT source and the steps that I took to get QT Creator to
recognize my Gstreamer libs here:
https://forum.qt.io/topic/112384/building-with-gstreamer-on-windows/27 ...
It is now a bit out of date after the above changes ...





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by Tim Müller
Looking at the debug output, I see:

GST_ELEMENT_FACTORY gstelementfactory.c:444:gst_element_factory_make:
gstelementfactory: make "videotestsrc" "(NULL)"
GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no
such element factory "videotestsrc"

GST_ELEMENT_FACTORY gstelementfactory.c:444:gst_element_factory_make:
gstelementfactory: make "d3dvideosink" "(NULL)"
GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no
such element factory "d3dvideosink"

The app runs on the same machine and shows the video test pattern when I
launch it from QT Creator but not when I deploy it as a stand-alone
application (using windeployqt.exe and copying over all of the Gstreamer
libraries).

Here is the full output file (GST_DEBUG=*:7):
https://customers.vivoh.com/all/mini_app_out_mar_30_2020.txt

I posted the source code to a very small QT sample application that
reproduces the problem here:
https://forum.qt.io/topic/112384/building-with-gstreamer-on-windows/28



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

David Ing
It can't find the gstreamer plugins plugins.

On the build machine, you can probably run `gst-inspect-1.0 videotestsrc` and it shows you where the plugins can be found.

I am willing to bet you did not package the plugin binaries with your deployable.  You need to package the binaries and then tell gstreamer where to look for them.

I have a bit of initialization code that I run when my program starts.

if (!_initialized)
{
    boost::filesystem::path pluginFolder = assemblyFolder / "plugins";

    // WARNING: setting an environment variable is only safe at the beginning of the program (before any
    // other threads have been spun up).  We do this to maintain strict control over the plugins that we
    // are using.
    const char* priorGstPluginPath = g_getenv("GST_PLUGIN_PATH");
    std::string gstPluginPath = string::unwiden(pluginFolder.string());
    if (priorGstPluginPath)
    {
        char c = priorGstPluginPath[0];
        if (c != 0)
        {
            gstPluginPath = gstPluginPath + PATHS_SEP_STR + priorGstPluginPath;
        }
    }

    g_unsetenv("GST_PLUGIN_SYSTEM_PATH_1_0");
    g_unsetenv("GST_PLUGIN_SYSTEM_PATH");
    g_unsetenv("GST_PLUGIN_PATH_1_0");
    g_unsetenv("GSTREAMER_ROOT_X86_64");
    g_setenv("GST_PLUGIN_PATH", gstPluginPath.c_str(), true);
    g_setenv("GSTREAMER_1_0_ROOT_X86_64", string::unwiden(assemblyFolder.string()).c_str(), true);

    //  Initialize gstreamer
    gst_init(pnargs, pargs);

    //  Guard against initializing more than once.
    _initialized = true;
}

On Mon, Mar 30, 2020 at 8:19 AM erikherz <[hidden email]> wrote:
Looking at the debug output, I see:

GST_ELEMENT_FACTORY gstelementfactory.c:444:gst_element_factory_make:
gstelementfactory: make "videotestsrc" "(NULL)"
GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no
such element factory "videotestsrc"

GST_ELEMENT_FACTORY gstelementfactory.c:444:gst_element_factory_make:
gstelementfactory: make "d3dvideosink" "(NULL)"
GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no
such element factory "d3dvideosink"

The app runs on the same machine and shows the video test pattern when I
launch it from QT Creator but not when I deploy it as a stand-alone
application (using windeployqt.exe and copying over all of the Gstreamer
libraries).

Here is the full output file (GST_DEBUG=*:7):
https://customers.vivoh.com/all/mini_app_out_mar_30_2020.txt

I posted the source code to a very small QT sample application that
reproduces the problem here:
https://forum.qt.io/topic/112384/building-with-gstreamer-on-windows/28



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
Thank you, David!

Here is my inspect output:
Plugin Details:
  Name                     videotestsrc
  Description              Creates a test video stream
  Filename                
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\libgstvideotestsrc.dll
  Version                  1.16.2
  License                  LGPL
  Source module            gst-plugins-base
  Binary package           GStreamer Base Plug-ins source release
  Origin URL               Unknown package origin

I verified that libgstvideotestsrc.dll is in the same directory as my
executable.

As a brute force attempt to get it to work, I just copied all of the
libraries to the same directory:
C:\gstreamer\1.0\x86_64\bin\*.dll
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\*.dll
C:\Qt\5.14.1\mingw73_64\bin\*.dll
C:\Qt\5.14.1\mingw73_64\plugins\platforms\*.dll
C:\Windows\System32\*.dll

and I get this debug output:

GST_REGISTRY gstregistrychunks.c:850:_priv_gst_registry_chunks_load_plugin:
read strings for name='videotestsrc'
GST_REGISTRY gstregistrychunks.c:851:_priv_gst_registry_chunks_load_plugin:  
desc.description='Creates a test video stream'
GST_REGISTRY gstregistrychunks.c:852:_priv_gst_registry_chunks_load_plugin:  
filename='C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\libgstvideotestsrc.dll'

GST_REGISTRY gstregistry.c:578:gst_registry_add_feature:<registry0> adding
feature 0000000003DDC380 (videotestsrc)

GST_REGISTRY gstregistrychunks.c:730:gst_registry_chunks_load_feature: Added
feature videotestsrc, plugin 0000000003DDB2C0 videotestsrc

GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no
such element factory "videotestsrc"

... I was told that Gstreamer and QT will only work with MSVC and not MinGW
but was not told why ... Perhaps this will all just work once I get my MSVC
environment set up ... but it would be great to understand why MinGW does
not work.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by David Ing
David,

I will try out this code too ... assuming that simply putting all of the
plugins in the same directory is not sufficient.

Thank you!

Erik



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

David Ing
FWIW -- The mingw binaries are built with a very old toolchain:   https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/1.16/recipes/toolchain/mingw-w64.recipe#L3

On Mon, Mar 30, 2020 at 8:59 AM erikherz <[hidden email]> wrote:
David,

I will try out this code too ... assuming that simply putting all of the
plugins in the same directory is not sufficient.

Thank you!

Erik



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

Daniel Sperka
I made an attempt at migrating my build on windows to MINGW, but gave up for reasons I cannot remember. 

I've wrestled with it, but have stuck with MSVC in my Qt+gstreamer application. One issue I ran into that sounds similar to what yours is had to do with the scanner running at startup. It searches a hard-coded path, but if I use an embedded gstreamer lib I had to set some env variables. Here is a portion of my code - the usage is a bit messy and intertwined with other stuff.

In my app, I distribute gstreamer libs with the application using the *.msm modules. The directory structure is slightly different on mac/windows. (I chose not to require a full gstreamer installation when installing my application). I had various issues until I got these env vars sorted out - my code defines these env vars relative to the location of the exe file, and the msm files are installed in a subfolder of the file the exe is in. 

I distribute a plugin for drawing on a Qt widget (pulled it out of old Qt-Gstreamer dist). I put that plugin into the GST_PLUGIN_SYSTEM_PATH folder with the official ones rather than create another folder for my plugins, so I do not define GST_PLUGIN_PATH here. 


Dan



// Initialize gstreamer

// Debug  builds (HABIT_DEBUG) use system-defined gstreamer libs.

// Release builds (HABIT_RELEASE) _can_ use the system-installed (whatever we link against) gstreamer libs,

// but the -n flag tells us to run as NOT installed.

//

// When running "installed", we assume that the gstreamer framework is embedded in the bundle, and we set two

// env variables to point that direction:

// GST_PLUGIN_SYSTEM_PATH - where gstreamer finds plugins. Note that I stick the gst-qt plugin there.

// GIO_EXTRA_MODULES - some glib thing

// GST_PLUGIN_SCANNER - scanner checks local plugin cache??


if (bNotInstalled)

{

qDebug() << "Run as NOT installed, exe file is " << argv[0];

}

else

{

qDebug() << "Run installed, exe file is " << argv[0];


//#ifdef HABIT_RELEASE

qDebug() << "exePath " << QCoreApplication::applicationDirPath();

QDir dirScanner(QCoreApplication::applicationDirPath());

QString sRelPathToScanner;

QString sRelPathToSystemPlugins;

QString sRelPathToGioModules;

#if defined(Q_OS_MAC)

sRelPathToScanner = "../Frameworks/GStreamer.framework/Versions/1.0/libexec/gstreamer-1.0";

sRelPathToSystemPlugins = "../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0";

sRelPathToGioModules = "../Frameworks/GStreamer.framework/Versions/1.0/lib/gio/modules";

#else

sRelPathToScanner = "gstreamer-1.0/libexec/gstreamer-1.0";

sRelPathToSystemPlugins = "gstreamer-1.0/lib/gstreamer-1.0";

sRelPathToGioModules = "gstreamer-1.0/lib/gio/modules";

#endif

if (dirScanner.cd(sRelPathToScanner))

{

qDebug() << "Set GST_PLUGIN_SCANNER=" << dirScanner.filePath("gst-plugin-scanner");

qputenv("GST_PLUGIN_SCANNER", dirScanner.filePath("gst-plugin-scanner").toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative scanner path " << sRelPathToScanner << " from exePath ";

}

QDir dirPlugins(QCoreApplication::applicationDirPath());

if (dirPlugins.cd(sRelPathToSystemPlugins))

{

qDebug() << "Set GST_PLUGIN_SYSTEM_PATH=" << dirPlugins.path();

qputenv("GST_PLUGIN_SYSTEM_PATH", dirPlugins.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative system plugin path " << sRelPathToSystemPlugins;

}

QDir dirGio(QCoreApplication::applicationDirPath());

if (dirGio.cd(sRelPathToGioModules))

{

qDebug() << "Set GIO_EXTRA_MODULES=" << dirGio.path();

qputenv("GIO_EXTRA_MODULES", dirGio.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative gio module folder " << sRelPathToGioModules;

}


#ifdef Q_OS_WIN

QString sRelPathToHabitPlugins("gstreamer-plugins");

QDir dirHabitPlugins(QCoreApplication::applicationDirPath());

if (dirHabitPlugins.cd(sRelPathToHabitPlugins))

{

qDebug() << "Set GST_PLUGIN_PATH=" << dirHabitPlugins.path();

qputenv("GST_PLUGIN_PATH", dirHabitPlugins.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative Habit plugin path " << sRelPathToHabitPlugins;

}

#endif

}


// Initialize gstreamer

qDebug() << "Initialize gstreamer...";

gst_init(&argc, &argv);

qDebug() << "Initialize gstreamer...Done.";


On Mon, Mar 30, 2020 at 9:28 AM David Ing <[hidden email]> wrote:
FWIW -- The mingw binaries are built with a very old toolchain:   https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/1.16/recipes/toolchain/mingw-w64.recipe#L3

On Mon, Mar 30, 2020 at 8:59 AM erikherz <[hidden email]> wrote:
David,

I will try out this code too ... assuming that simply putting all of the
plugins in the same directory is not sufficient.

Thank you!

Erik



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

David Ing
Since you are switching from mingw to msvc ... watch out for weird issues with the plugin cache.


On Mon, Mar 30, 2020 at 10:27 AM Daniel Sperka <[hidden email]> wrote:
I made an attempt at migrating my build on windows to MINGW, but gave up for reasons I cannot remember. 

I've wrestled with it, but have stuck with MSVC in my Qt+gstreamer application. One issue I ran into that sounds similar to what yours is had to do with the scanner running at startup. It searches a hard-coded path, but if I use an embedded gstreamer lib I had to set some env variables. Here is a portion of my code - the usage is a bit messy and intertwined with other stuff.

In my app, I distribute gstreamer libs with the application using the *.msm modules. The directory structure is slightly different on mac/windows. (I chose not to require a full gstreamer installation when installing my application). I had various issues until I got these env vars sorted out - my code defines these env vars relative to the location of the exe file, and the msm files are installed in a subfolder of the file the exe is in. 

I distribute a plugin for drawing on a Qt widget (pulled it out of old Qt-Gstreamer dist). I put that plugin into the GST_PLUGIN_SYSTEM_PATH folder with the official ones rather than create another folder for my plugins, so I do not define GST_PLUGIN_PATH here. 


Dan



// Initialize gstreamer

// Debug  builds (HABIT_DEBUG) use system-defined gstreamer libs.

// Release builds (HABIT_RELEASE) _can_ use the system-installed (whatever we link against) gstreamer libs,

// but the -n flag tells us to run as NOT installed.

//

// When running "installed", we assume that the gstreamer framework is embedded in the bundle, and we set two

// env variables to point that direction:

// GST_PLUGIN_SYSTEM_PATH - where gstreamer finds plugins. Note that I stick the gst-qt plugin there.

// GIO_EXTRA_MODULES - some glib thing

// GST_PLUGIN_SCANNER - scanner checks local plugin cache??


if (bNotInstalled)

{

qDebug() << "Run as NOT installed, exe file is " << argv[0];

}

else

{

qDebug() << "Run installed, exe file is " << argv[0];


//#ifdef HABIT_RELEASE

qDebug() << "exePath " << QCoreApplication::applicationDirPath();

QDir dirScanner(QCoreApplication::applicationDirPath());

QString sRelPathToScanner;

QString sRelPathToSystemPlugins;

QString sRelPathToGioModules;

#if defined(Q_OS_MAC)

sRelPathToScanner = "../Frameworks/GStreamer.framework/Versions/1.0/libexec/gstreamer-1.0";

sRelPathToSystemPlugins = "../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0";

sRelPathToGioModules = "../Frameworks/GStreamer.framework/Versions/1.0/lib/gio/modules";

#else

sRelPathToScanner = "gstreamer-1.0/libexec/gstreamer-1.0";

sRelPathToSystemPlugins = "gstreamer-1.0/lib/gstreamer-1.0";

sRelPathToGioModules = "gstreamer-1.0/lib/gio/modules";

#endif

if (dirScanner.cd(sRelPathToScanner))

{

qDebug() << "Set GST_PLUGIN_SCANNER=" << dirScanner.filePath("gst-plugin-scanner");

qputenv("GST_PLUGIN_SCANNER", dirScanner.filePath("gst-plugin-scanner").toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative scanner path " << sRelPathToScanner << " from exePath ";

}

QDir dirPlugins(QCoreApplication::applicationDirPath());

if (dirPlugins.cd(sRelPathToSystemPlugins))

{

qDebug() << "Set GST_PLUGIN_SYSTEM_PATH=" << dirPlugins.path();

qputenv("GST_PLUGIN_SYSTEM_PATH", dirPlugins.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative system plugin path " << sRelPathToSystemPlugins;

}

QDir dirGio(QCoreApplication::applicationDirPath());

if (dirGio.cd(sRelPathToGioModules))

{

qDebug() << "Set GIO_EXTRA_MODULES=" << dirGio.path();

qputenv("GIO_EXTRA_MODULES", dirGio.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative gio module folder " << sRelPathToGioModules;

}


#ifdef Q_OS_WIN

QString sRelPathToHabitPlugins("gstreamer-plugins");

QDir dirHabitPlugins(QCoreApplication::applicationDirPath());

if (dirHabitPlugins.cd(sRelPathToHabitPlugins))

{

qDebug() << "Set GST_PLUGIN_PATH=" << dirHabitPlugins.path();

qputenv("GST_PLUGIN_PATH", dirHabitPlugins.path().toLocal8Bit());

}

else

{

qCritical() << "Cannot navigate to relative Habit plugin path " << sRelPathToHabitPlugins;

}

#endif

}


// Initialize gstreamer

qDebug() << "Initialize gstreamer...";

gst_init(&argc, &argv);

qDebug() << "Initialize gstreamer...Done.";


On Mon, Mar 30, 2020 at 9:28 AM David Ing <[hidden email]> wrote:
FWIW -- The mingw binaries are built with a very old toolchain:   https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/1.16/recipes/toolchain/mingw-w64.recipe#L3

On Mon, Mar 30, 2020 at 8:59 AM erikherz <[hidden email]> wrote:
David,

I will try out this code too ... assuming that simply putting all of the
plugins in the same directory is not sufficient.

Thank you!

Erik



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by David Ing
David,

You were right ... I looked at the debug output and saw that it was looking
for a plugins path. Then I created a plugins subdirectory, dropped in
"gstvideotestsrc.dll" and "gstd3d.dll" set it like so: set
GST_PLUGIN_PATH=C:\Users\vivoh\Desktop\mini\plugins ... then it worked!

... also I had to switch from MinGW to MSVC ...

Erik



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to debug Gstreamer on Windows

erikherz
In reply to this post by David Ing
Thank you for the heads up!



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel