AW: TS-File not seekable

Angel Martin amartin at vicomtech.org
Mon Dec 3 02:05:31 PST 2012


Dear all,

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.

/* Now set to playing and iterate. */
g_print ("Setting to PLAYING\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("Running\n");

:

/* clean up nicely */
gst_element_send_event (pipeline, gst_event_new_eos ());

/* wait for EOS message on the pipeline bus */
msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
GST_MESSAGE_EOS | GST_MESSAGE_ERROR, GST_CLOCK_TIME_NONE);

/* should check if we got an error message here or an eos */
gst_element_set_state (pipeline, GST_STATE_NULL);

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



Best,

Angel

2012/11/30 Bernhard Graaf <bernhard.graaf at gmx.de>

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


More information about the gstreamer-devel mailing list