having problem with jpegdec

iszaidy ismail anak_jatiperlis at yahoo.com
Mon Dec 31 22:45:26 PST 2012


hi, 


Could you please help me to solve this problem?
I tried so many times but still had the same problem.
The result exited with code 0 like below.
 
/home/iesx/Desktop/imageOnly/imageonly exited with code 0

The code is like below.Please somebody help me solve this problem.


imageonly.pro file 


QT       += core
QT       -= gui

TARGET = imageonly
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += gstreamer-0.10
}



main.cpp file 


#include <QtCore/QCoreApplication>
#include <pthread.h>
#include <string.h>
#include <gst/gst.h>
#include <glib.h>

int main(int argc , char* argv[])
{
    GMainLoop *loop;

   loop=g_main_loop_new(NULL,FALSE);

    GstElement *pipeline, *source, *jpg_decoder, *freeze, *colorspace, *sink;

      /* Initialisation */
    gst_init (&argc, &argv);

    /* Create gstreamer elements */
    pipeline = gst_pipeline_new ("image-player");
    if(!pipeline)
    {
        g_printerr ("Pipeline could not be created. Exiting.\n");
        return -1;
    }

      source   = gst_element_factory_make ("filesrc",       "file-source");
      //set the location of the file to the argv[1]
      //QString url = imagePath;
      g_object_set (G_OBJECT (source), "location", "capture1.jpeg", NULL);
    if(!source)
    {
        g_printerr ("File could not be created. Exiting.\n");
        return -1;
    }

    jpg_decoder  = gst_element_factory_make ("jpegdec", "jpg-decoder");
    if(!jpg_decoder)
    {
        g_printerr ("Jpg Decoder could not be created. Exiting.\n");
        return -1;
    }

    freeze = gst_element_factory_make("imagefreeze", "freeze");
    if(!freeze)
    {
        g_printerr ("ImageFreeze could not be created. Exiting.\n");
        return -1;
    }

    colorspace = gst_element_factory_make("ffmpegcolorspace", "colorspace");
    if(!colorspace)
    {
        g_printerr ("Colorspace could not be created. Exiting.\n");
        return -1;
    }

    sink     = gst_element_factory_make ("xvimagesink", "imagesink");
    if(!sink)
    {
        g_printerr ("Image sink could not be created. Exiting.\n");
        return -1;
    }

    /* file-source | jpg-decoder | image-freeze | colorspace | sink */
    gst_bin_add_many (GST_BIN (pipeline), source, jpg_decoder, freeze, colorspace, sink, NULL);
    gst_element_link_many (source, jpg_decoder, freeze, colorspace, sink, NULL);

    /* Set the pipeline to "playing" state*/
    g_print ("Now playing:     \n");
    gst_element_set_state (pipeline, GST_STATE_PLAYING);

    /* Out of the main loop, clean up nicely */
    g_print ("Returned, stopping playback\n");
    gst_element_set_state (pipeline, GST_STATE_NULL);

    g_print ("Deleting pipeline\n");
    gst_object_unref (GST_OBJECT (pipeline));

    return 0;
}



 


 






Regards , 

.............................
( ISZAIDY ISMAIL )
anak_jatiperlis at yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20121231/01b74953/attachment-0001.html>


More information about the gstreamer-devel mailing list