Create GStreamer plugin in VisualStudio 2015

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

Create GStreamer plugin in VisualStudio 2015

Sharden
Hello everyone!
I am trying to create a plugin from official Plugins Writer's Guide -
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/pwg.pdf .
I cannot use make_element for creating my own plugin from gstplugin.c/h
files (from
https://cgit.freedesktop.org/gstreamer/gst-template/tree/gst-plugin/src) but
I saw what it does on Linux machine and replaced everything myself. I
replaced all "gstplugin" entries with "mynewplugin". I also tried to use
gsttransform files from the same page.
I added proprties included in the gstreamer sdk - gstreamer-1.0.props and
tried to build the dll file. It showed me an error in macros
GST_PLUGIN_DEFINE: VERSION - undeclared identifier.
Also Visual Stufio itself starts to behave strangely - intellisene always
parses something and I am not able to close VS as it does nothing when I try
to close it. Looks like the prop files which were designed for VS 2010 does
not work for 2015.
Does anyone has an experience of writing plugin via Windows on VS 2015? Any
help will do!



--
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: Create GStreamer plugin in VisualStudio 2015

David Ing
I did some preliminary plugin development on VS 2015, so I can probably help you out with that.

After VS 2010 the MSVC Runtime was fractured into a bunch of separate libs, so things have changed which prevents the VS 2010 property sheets from working properly.  If you are using VS 2015 then you want to avoid all of the property sheets in the installation folder ...

%GSTREAMER_1_0_ROOT_X86_64%\share\vs\2010\msvc

... where my environment variables are:

GSTREAMER_1_0_ROOT_X86_64=C:\dev\gstreamer\%GST_VERSION%\x86_64
GST_VERSION=1.14.3

Fortunately, all of the property sheets in the following folder work fine:

%GSTREAMER_1_0_ROOT_X86_64%\share\vs\2010\libs
 
Here is an example of a property sheet that works with VS 2015 (where I am consuming gst-editing-services):


I'm not sure if the following clauses are really necessary if you simply allow visual studio to include the default property sheets for a given build.
Under Debug:  <AdditionalDependencies>libucrtd.lib;libcmtd.lib;libvcruntimed.lib;libcpmtd.lib;msvcprtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Under Release:  <AdditionalDependencies>libucrt.lib;libcmt.lib;libvcruntime.lib;libcpmt.lib;msvcprt.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>

In the example above, I made the mistake of starting from the VS 2010 property sheets under the "msvc" folder and then I fixed what was broken (it wasn't easy).  If I were to do it over, I would just start with a normal VS 2015 C++ project and include at least the following property sheets (for plugin development):

gstreamer-1.0.props
gstreamer-base-1.0.props
gstreamer-pbutils-1.0.props

I believe that by including the property sheets above, you will resolve the error regarding GST_PLUGIN_DEFINE and VERSION.

If you run into linker errors (can't find a particular symbol) then try searching the *.lib files for that symbol (perhaps I was using a hex editor, or perhaps I was using the `grep` command from GitBash ... I can't remember).  Once you figure out which *.lib file defines the given symbol then you can find the property sheet that goes with that *.lib file, and include it into your project.

On Wed, Nov 28, 2018 at 3:12 AM Sharden <[hidden email]> wrote:
Hello everyone!
I am trying to create a plugin from official Plugins Writer's Guide -
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/pwg.pdf .
I cannot use make_element for creating my own plugin from gstplugin.c/h
files (from
https://cgit.freedesktop.org/gstreamer/gst-template/tree/gst-plugin/src) but
I saw what it does on Linux machine and replaced everything myself. I
replaced all "gstplugin" entries with "mynewplugin". I also tried to use
gsttransform files from the same page.
I added proprties included in the gstreamer sdk - gstreamer-1.0.props and
tried to build the dll file. It showed me an error in macros
GST_PLUGIN_DEFINE: VERSION - undeclared identifier.
Also Visual Stufio itself starts to behave strangely - intellisene always
parses something and I am not able to close VS as it does nothing when I try
to close it. Looks like the prop files which were designed for VS 2010 does
not work for 2015.
Does anyone has an experience of writing plugin via Windows on VS 2015? Any
help will do!



--
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: Create GStreamer plugin in VisualStudio 2015

David Ing
Also I had problems including the Windows Driver Kit (which I didn't need for my plugin).  If you need to include it then good luck (I never figured it out).

On Wed, Nov 28, 2018 at 8:08 AM David Ing <[hidden email]> wrote:
I did some preliminary plugin development on VS 2015, so I can probably help you out with that.

After VS 2010 the MSVC Runtime was fractured into a bunch of separate libs, so things have changed which prevents the VS 2010 property sheets from working properly.  If you are using VS 2015 then you want to avoid all of the property sheets in the installation folder ...

%GSTREAMER_1_0_ROOT_X86_64%\share\vs\2010\msvc

... where my environment variables are:

GSTREAMER_1_0_ROOT_X86_64=C:\dev\gstreamer\%GST_VERSION%\x86_64
GST_VERSION=1.14.3

Fortunately, all of the property sheets in the following folder work fine:

%GSTREAMER_1_0_ROOT_X86_64%\share\vs\2010\libs
 
Here is an example of a property sheet that works with VS 2015 (where I am consuming gst-editing-services):


I'm not sure if the following clauses are really necessary if you simply allow visual studio to include the default property sheets for a given build.
Under Debug:  <AdditionalDependencies>libucrtd.lib;libcmtd.lib;libvcruntimed.lib;libcpmtd.lib;msvcprtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Under Release:  <AdditionalDependencies>libucrt.lib;libcmt.lib;libvcruntime.lib;libcpmt.lib;msvcprt.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>

In the example above, I made the mistake of starting from the VS 2010 property sheets under the "msvc" folder and then I fixed what was broken (it wasn't easy).  If I were to do it over, I would just start with a normal VS 2015 C++ project and include at least the following property sheets (for plugin development):

gstreamer-1.0.props
gstreamer-base-1.0.props
gstreamer-pbutils-1.0.props

I believe that by including the property sheets above, you will resolve the error regarding GST_PLUGIN_DEFINE and VERSION.

If you run into linker errors (can't find a particular symbol) then try searching the *.lib files for that symbol (perhaps I was using a hex editor, or perhaps I was using the `grep` command from GitBash ... I can't remember).  Once you figure out which *.lib file defines the given symbol then you can find the property sheet that goes with that *.lib file, and include it into your project.

On Wed, Nov 28, 2018 at 3:12 AM Sharden <[hidden email]> wrote:
Hello everyone!
I am trying to create a plugin from official Plugins Writer's Guide -
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/pwg.pdf .
I cannot use make_element for creating my own plugin from gstplugin.c/h
files (from
https://cgit.freedesktop.org/gstreamer/gst-template/tree/gst-plugin/src) but
I saw what it does on Linux machine and replaced everything myself. I
replaced all "gstplugin" entries with "mynewplugin". I also tried to use
gsttransform files from the same page.
I added proprties included in the gstreamer sdk - gstreamer-1.0.props and
tried to build the dll file. It showed me an error in macros
GST_PLUGIN_DEFINE: VERSION - undeclared identifier.
Also Visual Stufio itself starts to behave strangely - intellisene always
parses something and I am not able to close VS as it does nothing when I try
to close it. Looks like the prop files which were designed for VS 2010 does
not work for 2015.
Does anyone has an experience of writing plugin via Windows on VS 2015? Any
help will do!



--
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: Create GStreamer plugin in VisualStudio 2015

Sharden
Thank you for your answer!
Including additional prop files didnt help much and config.h wasn't found.

I've created my own definitions of VERSION and PACKAGE variables and
everything was built successfully.

However I am not able to discover my new plugin with gst-inspect tool. I
assume it should be discoverable, isn't it?

I placed my dll plugin file directly in the GST_PLUGIN_PATH directory
(%GSTREAMER_1_0_ROOT_X86_64%\lib\gstreamer-1.0 in my case) and tried to
launch gst-inspect (from %GSTREAMER_1_0_ROOT_X86_64%\bin directory)
providing it with the name of my plugin. I also tried the description of the
plugin and the name of the dll file where the plugin is stored. No success.
I assume that I've built the plugin wrong.

Does anyone know what can possibly lead to that?



--
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: Create GStreamer plugin in VisualStudio 2015

David Ing
There are a number of different ways to tell gstreamer where to search for plugins.

One method is to set the environment variable GST_PLUGIN_PATH.

Another method is to use a parameters which available on any of the gstreamer command-line tools.

  --gst-plugin-path=PATHS              Colon-separated paths containing plugins
  --gst-plugin-load=PLUGINS            Comma-separated list of plugins to preload in addition to the list stored in environment variable GST_PLUGIN_PATH


On Fri, Nov 30, 2018 at 5:16 AM Sharden <[hidden email]> wrote:
Thank you for your answer!
Including additional prop files didnt help much and config.h wasn't found.

I've created my own definitions of VERSION and PACKAGE variables and
everything was built successfully.

However I am not able to discover my new plugin with gst-inspect tool. I
assume it should be discoverable, isn't it?

I placed my dll plugin file directly in the GST_PLUGIN_PATH directory
(%GSTREAMER_1_0_ROOT_X86_64%\lib\gstreamer-1.0 in my case) and tried to
launch gst-inspect (from %GSTREAMER_1_0_ROOT_X86_64%\bin directory)
providing it with the name of my plugin. I also tried the description of the
plugin and the name of the dll file where the plugin is stored. No success.
I assume that I've built the plugin wrong.

Does anyone know what can possibly lead to that?



--
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: Create GStreamer plugin in VisualStudio 2015

Sharden
I have plugin path described successfuly in the PATH encironment variable.
Even when I launch gst-inspect and provide it with the full path of the
plugin .dll dile it says that it is not a gstreamer plugin. So obviously it
was not registered correctly. Did you run into such a problem? Any ideas
would be helpful.



--
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: Create GStreamer plugin in VisualStudio 2015

TheGiamig
Sharden wrote

> I have plugin path described successfuly in the PATH encironment variable.
> Even when I launch gst-inspect and provide it with the full path of the
> plugin .dll dile it says that it is not a gstreamer plugin. So obviously
> it
> was not registered correctly. Did you run into such a problem? Any ideas
> would be helpful.
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list

> gstreamer-devel@.freedesktop

> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

Post the code about plugin and elements registration so we can take a look.
The are also a convention to respect about filename/plugin name, you know?!





--
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: Create GStreamer plugin in VisualStudio 2015

Sharden
Thank you for your answer!
Yes, I know that there is difference between the file name and the plugin
name. I tried both - nothing helped.

Here is my code - just two dummy files that contains nothing but a simple
gstplugin with plugin_template replaced by "dummy". It builds successfully
but gst-inspect says that it can't find a plugin/element with such a name (I
checked the plugin_path variable and .dll file location more than twice) and
if I provide it directly with my dll file then it says that it is not a
gstreamer plugin.

https://drive.google.com/open?id=1tVz8M3dbosQ0620csAxjCFzzNzLW-e4A
<https://drive.google.com/open?id=1tVz8M3dbosQ0620csAxjCFzzNzLW-e4A>  

I also opened the dll as a text and got some info there, check it:
"
Stack around the variable '     " was corrupted. The variable ' <lots of
spaces> '
The value of ESP was not properly saved across a function call.  This is
usually a result of calling a function declared with one calling convention
with a function pointer declared with a different calling convention.

Stack memory was corrupted
A local variable was used before it was initialized
Stack memory around _alloca was corrupted
Unknown Runtime Check Error
Runtime check error
Unable to display RTC message
Stack area around _alloca memory reserved by this function is corrupted

"

Lools weird. Maybe I shouldn't check the contents of a dll directly, but it
is written in human-readable way. Maybe it is important



--
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: Create GStreamer plugin in VisualStudio 2015

David Ing
Maybe check gst-plugins-good for an example.

On Tue, Dec 4, 2018, 7:50 AM Sharden <[hidden email] wrote:
Thank you for your answer!
Yes, I know that there is difference between the file name and the plugin
name. I tried both - nothing helped.

Here is my code - just two dummy files that contains nothing but a simple
gstplugin with plugin_template replaced by "dummy". It builds successfully
but gst-inspect says that it can't find a plugin/element with such a name (I
checked the plugin_path variable and .dll file location more than twice) and
if I provide it directly with my dll file then it says that it is not a
gstreamer plugin.

https://drive.google.com/open?id=1tVz8M3dbosQ0620csAxjCFzzNzLW-e4A
<https://drive.google.com/open?id=1tVz8M3dbosQ0620csAxjCFzzNzLW-e4A

I also opened the dll as a text and got some info there, check it:
"
Stack around the variable '     " was corrupted. The variable ' <lots of
spaces> '
The value of ESP was not properly saved across a function call.  This is
usually a result of calling a function declared with one calling convention
with a function pointer declared with a different calling convention.

Stack memory was corrupted
A local variable was used before it was initialized
Stack memory around _alloca was corrupted
Unknown Runtime Check Error
Runtime check error
Unable to display RTC message
Stack area around _alloca memory reserved by this function is corrupted

"

Lools weird. Maybe I shouldn't check the contents of a dll directly, but it
is written in human-readable way. Maybe it is important



--
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