如何使用Vala将GStreamer视频输出到Gdk.Pixbuf? [英] How to output GStreamer video to Gdk.Pixbuf using Vala?

查看:97
本文介绍了如何使用Vala将GStreamer视频输出到Gdk.Pixbuf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在程序中使用GStreamer 1.0播放文件中的视频.我想将其输出到Gdk.Pixbuf,将其添加到Image中以显示它.但是我不知道如何正确使用它.

I am using GStreamer 1.0 in my program to play video from file. And I want to output it to Gdk.Pixbuf to add it to Image to display it. But I can't figure out how to use it properly.

这是我尝试执行的操作,但无法编译:

Here is what I tried to do, but it won't compile:

this.pipeline = new Pipeline ("mypipeline");
this.src = ElementFactory.make ("filesrc", "video");
src.set("location", downloadFileName);
this.sink = ElementFactory.make ("gdkpixbufsink", "sink");
this.pipeline.add_many (this.src, this.sink);
this.src.link (this.sink);

this.pipeline.set_state (State.PLAYING);

this.videoPixbuf = sink.get("last-pixbuf") as Gdk.Pixbuf;

如果可以的话,您能建议我如何正确执行吗?还是我可以不使用Gdk.Pixbuf而以其他方式做到这一点?我只是不知道该怎么办.

Can you suggest me how to do it properly, if possible? Or how I can do it the other way, without using Gdk.Pixbuf? I just don't know what to do.

推荐答案

我不了解vala,但您应该在那看看:

I don't know about vala but you should have a look there:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html ,视频叠加层用法的C Gtk实现,应该可以轻松转换为Vala.

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html, look for the C Gtk implementation of videooverlay usage, this should be easily translatable to Vala.

这篇关于如何使用Vala将GStreamer视频输出到Gdk.Pixbuf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆