How to debug Gstreamer on Windows

Daniel Sperka djsperka at ucdavis.edu
Mon Mar 30 17:27:17 UTC 2020


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 <ding at panopto.com> 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 <erik at vivoh.com> 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
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


-- 
Daniel J. Sperka, Ph. D.
UC Davis Center for Neuroscience
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200330/e189c124/attachment-0001.htm>


More information about the gstreamer-devel mailing list