PDA

View Full Version : GStreamer, Qt4, QDevelop and C++



midiangr
12th March 2009, 20:49
Hello to all!
I am new here. At the time, I am trying to make a window application on Linux, on QDevelop, using gui's created on Qt4. This app will use gstreamer to record and play avi's.

I have some questions, because i am stuck! If anyone can help...

1. Is there any good sample, tutorial on how to use gstreamer on a c++ application (sinks, elements), just to record and play, apart from gst doc? I haven't found anywhere something to explain how to simply click a button on a Qt app and play a video using gstreamer.

2. How exactly can I view a list of strings in a table widget in a window and then choose an entry and get a value from it?

3. Where should I create an object in QDevelop, so as to use this one object in the entire application?
In simple words, I have to do sth like this RecorderComm rm = new RecorderComm(ip,port), and then, on the whole application, in all of its window, i will have to use functions of RecorderComm (rm.func1, and so on..)

As you may have understood, my app will connect to a server to get the video to be played.

Thank you in advance!

I am a computer engineering student from Greece, who just got to know gstreamer, Qt4 and QDevelop!

wysota
12th March 2009, 21:58
1. Playing video is easy using Phonon, recording can't be done this way, unfortunately...

2. QListWidget or QListView and QStringListModel.

3. You should create the object in your application, not in QDevelop ;) Seriously, you have two choices - either a global variable or a singleton class. I'm sure you can google up these terms if you don't know them.

midiangr
12th March 2009, 22:53
Thanks a lot for your advice!

I finally used QTable-because i need to show there elements that come from a database with multiple fiellds- and it seems to work well.

About Phonon, I have read about, but I'd rather use just plain gstreamer-that's the specs.

I will try to use your advice about singleton class.

midiangr
2nd April 2009, 20:59
Going on with the applications, I have the following problem:

I am trying to make pipelines, so as to record and playback video with sound.
How exactly can I find the "properties needed to pass to the pipeline to make it work(eg the sound source etc)

I was given a sample code to do this, I have tried to make changes and adapt it to my machine, but nothing...Any ideas? Is there any way to find all these options somewhere?

This is the code for creating three pipelines:



const char* PLAYBACK =
"filesrc location=foo.avi !"
"avidemux name=demx ! ffdec_mpeg2video ! queue !"
"xvimagesink name=x11w demx. ! queue ! ffdec_mp3 ! alsasink";

const char* RECORD = "alsasrc device=plughw:1,0 ! tee name=sndsrc !"
"queue name=sndqueue max-size-buffers=100 ! audiorate !"
" audio/x-raw-int,width=8,rate=16000 ! audioconvert ! ffenc_mp2 ! "
"mx. v4lsrc typefind=true ! tee name=vidsrc ! queue name=vidqueue !"
" videorate ! video/x-raw-yuv,framerate=25/1,width=640,height=480 !"
" ffenc_mpeg2video ! avimux name=mx ! filesink location=foo.avi sndsrc. "
"! queue ! alsasink vidsrc.! queue ! xvimagesink name=x11w";

const char* VIEW = "alsasrc device=plughw:1,0 ! "
"queue name=sndqueue max-size-buffers=100 ! audiorate !"
" audio/x-raw-int,width=8,rate=16000 ! alsasink v4lsrc typefind=true"
" ! queue name=vidqueue ! videorate !"
" video/x-raw-yuv,framerate=25/1,width=640,height=480 ! "
"queue ! xvimagesink name=x11w";

//code
//code
//code

void GstFrame::create_pipeline()
{
if(pipeline) destroy_pipeline();

GError *err=0;
pipeline = gst_parse_launch(pipmode,&err);

if (err != NULL) {
/* Report error to user, and free error */
cerr << "Unable to create pipeline: " << err->message << endl;
return;
} else {
assert(pipeline!=0);
}
xvimagesink = gst_bin_get_by_name(GST_BIN(pipeline), "x11w");
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvimage sink), gstframe->winId());

bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
bus_poll_timer->start(50);

pipeline_state = GST_STATE_NULL;
set_eos(false);
}
When I come to run this code, i get pipeline=0, and assert fails.
no element alsasrc found


sorry if the post is misplaced, or it is a trivial question, but I have never programmed that stuff before...
:) thanks!

midiangr
28th April 2009, 18:30
Another question please, thanks in advance!

How can I get an entire row from a TableWidget, by just clicking on it?

When I click on a row, I need the data inside to be returned so as to pick what I want...

wysota
28th April 2009, 19:46
How can I get an entire row from a TableWidget, by just clicking on it?

When I click on a row, I need the data inside to be returned so as to pick what I want...

What did you already try?