Gstreamer-Sharp - Use Cairo Overlay

Agarwal, Piyush - 0446 - MITLL Piyush.Agarwal at ll.mit.edu
Tue Jan 13 09:55:48 PST 2015


Actually turns out I am having two separate issues hereŠ

Interestingly the ³overlay" element never seems to be doing anything
regardless of what video filter I am using. For example just as a test I
changed it to  a videoflip filter with method=clockwise and that doesn¹t
seem to be happening either.

            sourceElement = ElementFactory.Make("filesrc", "source" +
playerId);
            decodeElement = ElementFactory.Make("decodebin", "decoder" +
playerId);
            convertElement = ElementFactory.Make("videoconvert", "convert" +
playerId);
            overlayElement = ElementFactory.Make("videoflip", "overlay" +
playerId);
            queueElement = ElementFactory.Make("queue", "queue" + playerId);

            if (overlayElement != null)
            {
                overlayElement["method"] = "clockwise";
            }
            pipeline = new Pipeline("pipeline" + playerId);
            sourceElement["location"] = videoUri;
            decodeElement.PadAdded += decodeElement_PadAdded; // connect the
convertElement to decodeElement once its ready

            pipeline.Bus.EnableSyncMessageEmission();
            pipeline.Bus.AddSignalWatch();
            pipeline.Bus.SyncMessage += Bus_SyncMessageHandler;
            pipeline.Bus.Message += Bus_MessageHandler;

            pipeline.Add(sourceElement, decodeElement, convertElement,
overlayElement, queueElement, sinkElement);
            Element.Link(sourceElement, decodeElement);

            isPlaying = false;
            pipeline.SetState(State.Playing);
            
private static void decodeElement_PadAdded(object o, PadAddedArgs args)
{
    Console.WriteLine("Decode element, pad added.");
    PadLinkReturn padReturn =
args.NewPad.Link(convertElement.GetStaticPad("sink"));
    bool linked = convertElement.Link(overlayElement);
    bool linked2 = overlayElement.Link(queueElement);
    bool linked3 = queueElement.Link(sinkElement);
}


Oddly enough if I construct the same pipeline using Gst.Parse it works, so
clearly I must be missing something in how I am manually creating the
pipeline.

Pipeline pipeline = Parse.Launch("filesrc location=\²<path to videofile>" !
decodebin ! videoconvert ! videoflip  method=clockwise ! queue !
autovideosink") as Pipeline;

^ this pipeline works was expected.

Now back to the cairooverlay issue. If I use the Parsed pipeline with the
cairooverlay and iterate over the pipeline elements I can discover the cairo
overlay element and connect to its Draw function. The problem I am having if
I do that is that my glib-sharp.dll 3.0.0.0 gives me an error ­ Unknown type
CairoContext.  My glib-sharp is built off off the gtk-sharp-master git repo.
I thought that CairoContext was part of Mono.Cairo and I have also included
cairo-sharp.dll in my project. So I¹m not sure how to solve this issue. Is
there something better to use for Drawing on top of video frame rather than
the CairoOverlay element?

Thanks,
Piyush

From:  <Agarwal>, Piyush Agarwal <piyush.agarwal at ll.mit.edu>
Reply-To:  Discussion of the development of and with GStreamer
<gstreamer-devel at lists.freedesktop.org>
Date:  Monday, January 12, 2015 at 5:15 PM
To:  Discussion of the development of and with GStreamer
<gstreamer-devel at lists.freedesktop.org>
Subject:  Gstreamer-Sharp - Use Cairo Overlay

Hi Everyone,

I am trying to use the cairooverlay element in a Gstreamer-sharp application
and unfortunately the draw/caps-changed signals are not being called. Just
wanted to double check and make sure I was setting up the element properly:

            sourceElement = ElementFactory.Make("filesrc", "source" +
playerId);
            decodeElement = ElementFactory.Make("decodebin", "decoder" +
playerId);
            convertElement = ElementFactory.Make("videoconvert", "convert" +
playerId);
            overlayElement = ElementFactory.Make("cairooverlay", "overlay" +
playerId);
            queueElement = ElementFactory.Make("queue", "queue" + playerId);

            if (overlayElement != null)
            {
                overlayElement.Connect("draw", DrawOverlay);
                overlayElement.Connect("caps-changed", PrepareOverlay);
            }

     ŠŠ // other stuff here for initialization of the playbin/pipeline

                Bin pipelineBin = (Bin)pipeline;

                pipelineBin.Add(sourceElement, decodeElement,
convertElement, overlayElement, queueElement, sinkElement);
                Element.Link(sourceElement, decodeElement, convertElement,
overlayElement, queueElement, sinkElement);

And then my signal functions are:

        private static void PrepareOverlay(object o, GLib.SignalArgs args)
        {
            Console.WriteLine(args);
        }

        private static void DrawOverlay(object o, GLib.SignalArgs args)
        {
            Console.WriteLine(args);
        }

My breakpoints inside the signal functions never hit.

Hopefully someone can help me out!

Thanks,
PIyush


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150113/a1918b16/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5213 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150113/a1918b16/attachment.bin>


More information about the gstreamer-devel mailing list