<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div>Dear all,</div><div><br></div><div>Appart from include the "-e" option to de pipeline to insert a EOS signal when you perform the ctrl+c, you can try to close properly the file.</div>
<div><br></div><div>/* Now set to playing and iterate. */</div><div>g_print ("Setting to PLAYING\n");</div><div>gst_element_set_state (pipeline, GST_STATE_PLAYING);</div><div>g_print ("Running\n");</div>
</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
:</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
/* clean up nicely */</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">gst_element_send_event (pipeline, gst_event_new_eos ());</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<div><br></div><div>/* wait for EOS message on the pipeline bus */</div><div>msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),</div><div>GST_MESSAGE_EOS | GST_MESSAGE_ERROR, GST_CLOCK_TIME_NONE);</div><div> </div>
<div>/* should check if we got an error message here or an eos */</div><div>gst_element_set_state (pipeline, GST_STATE_NULL);</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">g_print ("Deleting pipeline\n");</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
gst_object_unref (GST_OBJECT (pipeline));</div><div><br></div><div><br></div><div><br></div><div>Best,</div><div><br></div><div>Angel</div><br><div class="gmail_quote">2012/11/30 Bernhard Graaf <span dir="ltr"><<a href="mailto:bernhard.graaf@gmx.de" target="_blank">bernhard.graaf@gmx.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tim,<br>
<br>
Great idea. I'll check it and come back with results.<br>
<div class="im"><br>
Bernhard<br>
-----Ursprüngliche Nachricht-----<br>
Von: gstreamer-devel-bounces+bernhard.graaf=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a><br>
[mailto:<a href="mailto:gstreamer-devel-bounces%2Bbernhard.graaf">gstreamer-devel-bounces+bernhard.graaf</a>=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a>]<br>
</div>Im Auftrag von Tim-Philipp Müller<br>
Gesendet: Freitag, 30. November 2012 20:02<br>
<div class="im HOEnZb">An: <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
Betreff: Re: AW: TS-File not seekable<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Fri, 2012-11-30 at 19:19 +0100, Bernhard Graaf wrote:<br>
<br>
Hi Bernhard,<br>
<br>
> Don't work as expected. The pipe with using 'gst_parse_launch' is running<br>
> well, but the result is the same. Normal playing not a problem but seeking<br>
> has a problem.<br>
> In the meantime I've got an error message: 'GStreamer-CRITICAL **:<br>
> gst_segment_do_seek: assertion `segment->format == format' failed'.<br>
> If I do the same seeking with other files (f.e. with 'gst-launch' on<br>
command<br>
> line), I have no problems with that. So the ts-file has a problem.<br>
><br>
> I've also tried to reduce the pipe (dvbbasebin ! queue ! filesink) without<br>
> any additional parameter, but the result is the same.<br>
><br>
> I've no idea where to search to fix it. I've also no idea where the<br>
> different is between command line and gst_parse_launch. There should be a<br>
> different because of different results.<br>
><br>
> Any additional ideas? Could the DVB-Card be the problem (Conexant<br>
> CX24123/CX24109 Chipset)?<br>
> You make me happy if you have any ideas to fix it!<br>
<br>
If gst-launch-1.0 ... works differently than gst_parse_launch() linked<br>
against libgstreamer-1.0, that's rather unexpected I would say,<br>
especially in a case like this where the extra send_event(EOS) shouldn't<br>
really make a difference.<br>
<br>
Note that 'gst-launch' == gst-launch-0.10 not gst-launch-1.0.<br>
<br>
Another thing to check is whether you actually configure the properties<br>
on the dvb source correctly in your program. Perhaps you got the<br>
argument order on the command line wrong, or a property type, or<br>
somesuch.<br>
<br>
What you could do is add a GST_MESSAGE_ASYNC_DONE case block to your<br>
message handler, in which you call<br>
<br>
  case GST_MESSAGE_ASYNC_DONE:<br>
      GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),<br>
          GST_DEBUG_GRAPH_SHOW_ALL, "pipeline-dump.dot");<br>
      break;<br>
<br>
in your code and then take a snapshot and create an image of the setup<br>
as described here:<br>
<a href="http://gstreamer.freedesktop.org/wiki/DumpingPipelineGraphs" target="_blank">http://gstreamer.freedesktop.org/wiki/DumpingPipelineGraphs</a><br>
and here:<br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstr
eamer-GstInfo.html#GST-DEBUG-BIN-TO-DOT-FILE:CAPS" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstr<br>
eamer-GstInfo.html#GST-DEBUG-BIN-TO-DOT-FILE:CAPS</a><br>
<br>
Cheers<br>
 -Tim<br>
<br>
<br>
> -----Ursprüngliche Nachricht-----<br>
> Von: gstreamer-devel-bounces+bernhard.graaf=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a><br>
><br>
[mailto:<a href="mailto:gstreamer-devel-bounces%2Bbernhard.graaf">gstreamer-devel-bounces+bernhard.graaf</a>=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a>]<br>
> Im Auftrag von Bernhard Graaf<br>
> Gesendet: Freitag, 30. November 2012 10:56<br>
> An: <a href="mailto:krzysztof.konopko@youview.com">krzysztof.konopko@youview.com</a>; 'Discussion of the development of and<br>
> with GStreamer'<br>
> Betreff: AW: TS-File not seekable<br>
><br>
> Hi Kris,<br>
><br>
> Thanks a lot for your answer.<br>
> I'll check it with using 'gst_parse_launch'. That's a good idea.<br>
><br>
> For the problem I have:<br>
> The timing information of the TS-File seams to be corrupt, because in a<br>
> second program (using tsdemux or playbin) the playback is hanging after<br>
try<br>
> to seek using gst_element_seek. If I open another file (generated by<br>
> gst-launch) its OK. Therefore I believe that there is a problem with the<br>
> file not with the seeking program.<br>
><br>
> Thanks again. I will follow your idea and give you the result of my test.<br>
><br>
> Bernhard<br>
><br>
><br>
> -----Ursprüngliche Nachricht-----<br>
> Von: gstreamer-devel-bounces+bernhard.graaf=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a><br>
><br>
[mailto:<a href="mailto:gstreamer-devel-bounces%2Bbernhard.graaf">gstreamer-devel-bounces+bernhard.graaf</a>=<a href="mailto:gmx.de@lists.freedesktop.org">gmx.de@lists.freedesktop.org</a>]<br>
> Im Auftrag von Krzysztof Konopko<br>
> Gesendet: Freitag, 30. November 2012 10:38<br>
> An: <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> Betreff: Re: TS-File not seekable<br>
><br>
> Hi Bernhard,<br>
><br>
> What do you mean by "different results" and "problem with seeking"?<br>
> Could you be more specific? Does your program produce non empty file?<br>
><br>
> Why do you need tsparse if you writing to a file? Are you going to<br>
> handle some messages from tsparse?<br>
><br>
> In the first instance you don't have to force EOS in your app. Just stop<br>
> your program on the command line by pressing Ctrl+C and the default<br>
> signal handler will do the job. You can improve it later.<br>
><br>
> You can learn more about your program behaviour if you set GST_DEBUG<br>
> variable when running it, e. g.:<br>
><br>
> GST_DEBUG=4 ./your-app<br>
><br>
> See gst-launch-1.0 manual to learn more about debugging levels.<br>
><br>
> I'd recommend making your app simpler so you can evolve it later. Use<br>
> gst_parse_launch() instead of gst_element_factory_make(). Less code,<br>
> less oportunity to make a mistake and you can always refer to any<br>
> element in the pipe by its name (use 'name' property):<br>
><br>
> GError *error;<br>
> GstElement *dvb_pipe = gst_parse_launch ("dvbbasebin name=dvb"<br>
>                                          " ! queue ! tsparse "<br>
>                                          " ! filesink qos=TRUE",<br>
>                                          &error);<br>
><br>
> if (!dvb_pipe) {<br>
>   g_printerr ("Failed to create the pipeline: %s\n",<br>
>               error ? error->message : "(unknown error)");<br>
>     return FALSE;<br>
> }<br>
><br>
> dvb_bus = gst_pipeline_get_bus (GST_PIPELINE (dvb_pipe));<br>
> gst_bus_add_watch (dvb_bus, dvb_bus_call, NULL);<br>
> gst_object_unref (dvb_bus);<br>
><br>
> Return gboolean instead of int unless you have a good reason to return<br>
int.<br>
><br>
> You can use g_object_set() to set multiple properties:<br>
> dvb_source   = gst_bin_get_by_name (GST_BIN (dvb_pipe), "dvb");<br>
><br>
> g_object_set (G_OBJECT (dvb_source),<br>
>               "adapter", atoi(argv[3]),<br>
>               "frontend", atoi(argv[6]),<br>
>               "frequency", atoi(freq),<br>
>               "program_numbers", argv[7],<br>
>               "polarity", argv[9],<br>
>               "symbol-rate", atoi(argv[5]),<br>
>               NULL);<br>
><br>
> Cheers,<br>
> Kris<br>
><br>
> On 30/11/12 08:03, Bernhard Graaf wrote:<br>
> > I've made some test to finish the pipe:<br>
> ><br>
> > Direct call of 'g_main_loop_quit (loop)' ore parsing message with<br>
> > 'gst_element_send_event (dvb_pipe, gst_event_new_eos())' and handle the<br>
> > loop_quit in the message loop function, but all with the same result.<br>
> ><br>
> > My question is now: Where is the different between gst-launch and my own<br>
> > program in the ts-file results? What do gst-launch more then I do?<br>
> ><br>
> ><br>
> ><br>
> > If someone could help me, I will be very happy!<br>
> ><br>
> ><br>
> ><br>
> > Thanks a lot<br>
> ><br>
> > Bernhard<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > ---------------------------------------------------------------------<br>
> ><br>
> ><br>
> ><br>
> > Hi @ all,<br>
> ><br>
> ><br>
> ><br>
> > I've an issue with my own program using dvbbasebin:<br>
> ><br>
> > The pipe: gst-launch-1.0 dvbbasebin adapter=1 frequency=12544000<br>
> > program-numbers="17501" polarity="h" symbol-rate=22000 ! queue ! tsparse<br>
!<br>
> > filesink location=test_ts.mpg<br>
> ><br>
> > Results a file that has no problem with seeking<br>
> ><br>
> > But my own program:<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
**************************************************************************<br>
> ><br>
> > #include <stdio.h><br>
> ><br>
> > #include <unistd.h><br>
> ><br>
> > #include <sys/types.h><br>
> ><br>
> > #include <sys/stat.h><br>
> ><br>
> > #include <fcntl.h><br>
> ><br>
> > #include <stdlib.h><br>
> ><br>
> > #include <string.h><br>
> ><br>
> > #include <errno.h><br>
> ><br>
> > #include <gst/gst.h><br>
> ><br>
> > #include <glib.h><br>
> ><br>
> > #include <syslog.h><br>
> ><br>
> > #include <sys/time.h><br>
> ><br>
> > #include <sys/select.h><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > GstElement *dvb_pipe, *dvb_source,  *dvb_sink, *dvb_queue, *dvb_parse;<br>
> ><br>
> > GstBus *dvb_bus;<br>
> ><br>
> > GMainLoop *loop;<br>
> ><br>
> ><br>
> ><br>
> > static gboolean<br>
> ><br>
> > dvb_bus_call (GstBus     *tmp_bus,<br>
> ><br>
> >           GstMessage *msg,<br>
> ><br>
> >           gpointer    data)<br>
> ><br>
> > {<br>
> ><br>
> ><br>
> ><br>
> >   char tmp_str[254];<br>
> ><br>
> ><br>
> ><br>
> >   switch (GST_MESSAGE_TYPE (msg)) {<br>
> ><br>
> ><br>
> ><br>
> >     case GST_MESSAGE_EOS:<br>
> ><br>
> >       g_print ("End of stream\n");<br>
> ><br>
> >       g_main_loop_quit (loop);<br>
> ><br>
> >       break;<br>
> ><br>
> ><br>
> ><br>
> >     case GST_MESSAGE_ERROR: {<br>
> ><br>
> >       gchar  *debug;<br>
> ><br>
> >       GError *error;<br>
> ><br>
> ><br>
> ><br>
> >       gst_message_parse_error (msg, &error, &debug);<br>
> ><br>
> >       g_free (debug);<br>
> ><br>
> ><br>
> ><br>
> >       sprintf(tmp_str, "Error: %s\n", error->message);<br>
> ><br>
> >       g_printerr ("%s\n", tmp_str);<br>
> ><br>
> >       syslog(LOG_ERR, "%s\n",tmp_str);<br>
> ><br>
> >       g_error_free (error);<br>
> ><br>
> >       g_main_loop_quit (loop);<br>
> ><br>
> ><br>
> ><br>
> >       break;<br>
> ><br>
> >     }<br>
> ><br>
> >     default:<br>
> ><br>
> >       break;<br>
> ><br>
> >   }<br>
> ><br>
> ><br>
> ><br>
> >   return TRUE;<br>
> ><br>
> > }<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > int init_gst_tv()<br>
> ><br>
> > {<br>
> ><br>
> ><br>
> ><br>
> >   gst_init (0, NULL);<br>
> ><br>
> ><br>
> ><br>
> >   dvb_pipe = gst_pipeline_new ("DVB-Streamer");<br>
> ><br>
> >   dvb_source   = gst_element_factory_make ("dvbbasebin", "dvb-source");<br>
> ><br>
> >   dvb_queue     = gst_element_factory_make ("queue",      "dvb-queue");<br>
> ><br>
> >   dvb_parse     = gst_element_factory_make ("tsparse",    "dvb-parse");<br>
> ><br>
> >   dvb_sink     = gst_element_factory_make ("filesink",   "dvb-sink");<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> >   if (!dvb_pipe || !dvb_source || !dvb_queue || !dvb_parse || !dvb_sink)<br>
<br>
> ><br>
> >   {<br>
> ><br>
> >     g_printerr ("One element could not be created. Exiting.\n");<br>
> ><br>
> >     syslog(LOG_ERR, "Ein Pipe-Element nicht erstellt --><br>
> > Programmabbruch\n");<br>
> ><br>
> >     if(!dvb_pipe) g_printerr("DVB-Pipeline not created\n");<br>
> ><br>
> >     else if(!dvb_source) g_printerr("DVB-Source not created\n");<br>
> ><br>
> >     else if(!dvb_queue) g_printerr("DVB-Queue not created\n");<br>
> ><br>
> >     else if(!dvb_parse) g_printerr("DVB-Parse not created\n");<br>
> ><br>
> >     else if(!dvb_sink) g_printerr("DVB-Sink not created\n");<br>
> ><br>
> >     return -1;<br>
> ><br>
> >   }<br>
> ><br>
> ><br>
> ><br>
> >   dvb_bus = gst_pipeline_get_bus (GST_PIPELINE (dvb_pipe));<br>
> ><br>
> >   gst_bus_add_watch (dvb_bus, dvb_bus_call, NULL);<br>
> ><br>
> >   gst_object_unref (dvb_bus);<br>
> ><br>
> ><br>
> ><br>
> >   gst_bin_add_many (GST_BIN (dvb_pipe), dvb_source, dvb_queue,<br>
dvb_parse,<br>
> > dvb_sink, NULL);<br>
> ><br>
> >   gst_element_link_many (dvb_source, dvb_queue, dvb_parse, dvb_sink,<br>
> NULL);<br>
> ><br>
> ><br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_sink),    "qos",           TRUE, NULL);<br>
> ><br>
> ><br>
> ><br>
> >   return 1;<br>
> ><br>
> > }<br>
> ><br>
> ><br>
> ><br>
> > int main (int argc, char **argv)<br>
> ><br>
> > {<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> >   char tmp_str[254], freq[40], file_name[254], rec_pids[25];<br>
> ><br>
> >   char np_name[254];<br>
> ><br>
> >   int pid = 0;<br>
> ><br>
> >   int fd;<br>
> ><br>
> ><br>
> ><br>
> >   sprintf(freq,"%s000", argv[4]);<br>
> ><br>
> >   sprintf(file_name, "test.mpg");<br>
> ><br>
> ><br>
> ><br>
> >   loop = g_main_loop_new (NULL, FALSE);<br>
> ><br>
> ><br>
> ><br>
> >   init_gst_tv();<br>
> ><br>
> ><br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "adapter", atoi(argv[3]), NULL);<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "frontend", atoi(argv[6]), NULL);<br>
<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "frequency", atoi(freq), NULL);<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "program_numbers", argv[7],<br>
NULL);<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "polarity", argv[9], NULL);<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_source), "symbol-rate", atoi(argv[5]),<br>
> NULL);<br>
> ><br>
> >   g_object_set (G_OBJECT (dvb_sink), "location", file_name, NULL);<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> >   gst_element_set_state (dvb_pipe, GST_STATE_PLAYING);<br>
> ><br>
> ><br>
> ><br>
> >   g_print ("Running...\n");<br>
> ><br>
> >   g_main_loop_run (loop);<br>
> ><br>
> ><br>
> ><br>
> >   gst_element_set_state (dvb_pipe, GST_STATE_NULL);<br>
> ><br>
> ><br>
> ><br>
> >   g_print ("Deleting pipeline\n");<br>
> ><br>
> >   gst_object_unref (GST_OBJECT (dvb_pipe));<br>
> ><br>
> ><br>
> ><br>
> > return 1;<br>
> ><br>
> > }<br>
> ><br>
> ><br>
><br>
****************************************************************************<br>
> > *<br>
> ><br>
> ><br>
> ><br>
> > Is the result not seekable!<br>
> ><br>
> ><br>
> ><br>
> > Something missing to generate a seekable ts-file?<br>
> ><br>
> ><br>
> ><br>
> > Thanks a lot and sorry for this long mail!<br>
> ><br>
> > Bernhard<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > gstreamer-devel mailing list<br>
> > <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> > <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
> ><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>