×
Namespaces

Variants
Actions

How to use gstreamer with Qt

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): N900
Compatibility
Platform(s): Maemo, MeeGo
Article
Keywords: GStreamer
Created: gnuton (31 Dec 2010)
Last edited: hamishwillee (11 Oct 2012)

Introduction

GStreamer is a pipeline-based multimedia framework written in the C programming language with the type system based on GObject. GStreamer allows a programmer to create a variety of media-handling components, including simple audio playback, audio and video playback, recording, streaming and editing. The pipeline design serves as a base to create many types of multimedia applications such as video editors, streaming media broadcasters, and media players. Even if most used use cases are covered by Qt Mobility, for instance camera and video/audio player, the developers have still to use GStreamer for sme other use cases as live streaming.

Code

Here it is a "hello world" gstreamer application which simply plays the video stream coming from the videotestsrc.

#include <QtCore/QCoreApplication>
#include <gst/gst.h>
 
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
 
gst_init (NULL,NULL);
 
GstElement *bin = gst_pipeline_new ("pipeline");
g_assert(bin);
 
GstElement *testSrc = gst_element_factory_make("videotestsrc", "source");
g_assert(testSrc);
 
GstElement *videoOut = gst_element_factory_make("autovideosink", "video out");
g_assert(videoOut);
 
gst_bin_add_many(GST_BIN(bin), testSrc, videoOut, NULL);
gst_element_link_many(testSrc, videoOut, NULL);
 
gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
 
return a.exec();
}

Here tit is the project file needed to compile the code above

QT       += core
QT -= gui
 
TARGET = untitled
CONFIG += console
CONFIG -= app_bundle
 
TEMPLATE = app
 
SOURCES += main.cpp
 
unix {
CONFIG += link_pkgconfig
PKGCONFIG += gstreamer-0.10
}
This page was last modified on 11 October 2012, at 01:17.
252 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×