<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 09/15/2014 08:56 PM, Prabhakar Lad
wrote:<br>
</div>
<blockquote
cite="mid:CA+V-a8tJ8Y6g-Qyn-5+R=SSqPsVqNGTQr6s6SjNTd=BFXefVEw@mail.gmail.com"
type="cite">
<pre wrap="">Hi Tim,
Thanks for your response!
On Mon, Sep 15, 2014 at 6:01 PM, Tim Müller <a class="moz-txt-link-rfc2396E" href="mailto:tim@centricular.com"><tim@centricular.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, 2014-09-15 at 17:03 +0100, Prabhakar Lad wrote:
Hi,
What GStreamer version are you using?
</pre>
</blockquote>
<pre wrap="">I am using GStreamer-1.0
</pre>
<blockquote type="cite">
<pre wrap="">Perhaps you could distill this into a minimal test case that
demonstrates the issue?
</pre>
</blockquote>
<pre wrap="">I attaching the c file test-case and also pasting the code, so
that its easier to review.</pre>
</blockquote>
<br>
How do you stop the program? With Ctrl-C? You should send an EOS to
the pipeline before stopping to ensure the queue is flushed.<br>
Stefan<br>
<br>
<blockquote
cite="mid:CA+V-a8tJ8Y6g-Qyn-5+R=SSqPsVqNGTQr6s6SjNTd=BFXefVEw@mail.gmail.com"
type="cite">
<pre wrap="">
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
/* to compile gcc gst.c -o test_case -Wall `pkg-config --cflags --libs
gstreamer-1.0` */
GstElement *pipeline = NULL;
static GMainLoop *loop;
int mygetch ( void )
{
int ch;
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
static gboolean bus_handler (GstBus *bus, GstMessage *msg, gpointer data)
{
GMainLoop *loop;
loop = (GMainLoop*)data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR:
{
gchar *debug;
GError *error;
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_STATE_CHANGED:
{
GstState state;
gst_message_parse_state_changed (msg, NULL, &state, NULL);
break;
}
default:
break;
}
return TRUE;
}
int main(int argc, char *argv[])
{
GstElement *avimux, *filesink, *v4l2src ,*rlvvalve, *rlvideoqueue;
GstBus *bus;
guint bus_id;
gst_init (NULL, NULL);
loop = g_main_loop_new (NULL, FALSE);
pipeline = gst_pipeline_new ("test_pipeline");
v4l2src = gst_element_factory_make ("v4l2src", "v4l2src");
avimux = gst_element_factory_make ("avimux", "avimux");
filesink = gst_element_factory_make ("filesink", "filesink");
rlvvalve = gst_element_factory_make ("valve", "rlvvalve");
rlvideoqueue = gst_element_factory_make ("queue", "rlvideoqueue");
if (!pipeline || !avimux || !filesink || !v4l2src ||
!rlvideoqueue || !rlvvalve) {
printf ("Could not create all gstreamer elements.\n");
return 0;
}
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
bus_id = gst_bus_add_watch (bus, bus_handler, loop);
gst_object_unref (bus);
g_object_set (G_OBJECT (filesink), "location", "test.avi",
"async", FALSE, NULL);
gst_bin_add_many (GST_BIN (pipeline), avimux, filesink, v4l2src,
rlvideoqueue,
rlvvalve, NULL);
/* v4l2src ! queue ! valve ! avimux ! filesink location=test.avi */
gst_element_link_many (v4l2src, rlvideoqueue, rlvvalve, avimux,
filesink, NULL);
/* initially set the drop to TRUE */
g_object_set (G_OBJECT (rlvvalve), "drop", (gboolean)TRUE, NULL);
/* configure to hold 15 seconds of data */
g_object_set (G_OBJECT (rlvideoqueue), "min-threshold-time",
(guint64)15000000000, NULL);
g_object_set (G_OBJECT (rlvideoqueue), "min-threshold-buffers",
(guint64)0, NULL);
g_object_set (G_OBJECT (rlvideoqueue), "min-threshold-bytes",
(guint64)0, NULL);
g_object_set (G_OBJECT (rlvideoqueue), "max-size-bytes", (guint64)0, NULL);
g_object_set (G_OBJECT (rlvideoqueue), "max-size-buffers",
(guint64)0, NULL);
g_object_set (G_OBJECT (rlvideoqueue), "max-size-time",
(guint64)150000000000, NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* wait for a key press */
mygetch();
/* attach the valve back to pipeline */
g_object_set (G_OBJECT (rlvvalve), "drop", (gboolean)FALSE, NULL);
printf("Writing to file now!!!\n");
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
g_source_remove (bus_id);
g_main_loop_unref (loop);
gst_deinit ();
return 0;
}
Thanks,
--Prabhakar
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>