TS-File not seekable

Bernhard Graaf bernhard.graaf at gmx.de
Thu Nov 29 09:38:33 PST 2012


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20121129/11a10ef7/attachment-0001.html>


More information about the gstreamer-devel mailing list