[Bug 755642] New: decklinkvideosrc: video fails to restart in ntsp-p mode

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Sep 25 11:32:10 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=755642

            Bug ID: 755642
           Summary: decklinkvideosrc: video fails to restart in ntsp-p
                    mode
    Classification: Platform
           Product: GStreamer
           Version: 1.5.91
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-bad
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: andersonjeffb33 at gmail.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 312162
  --> https://bugzilla.gnome.org/attachment.cgi?id=312162&action=edit
log output from application

The pipeline fails to start when the decklinkvideosrc mode is set to ntsp-p. 
Code to reproduce

#include <gst/gst.h>
#include <glib.h>

static gboolean
bus_call (GstBus     *bus,
          GstMessage *msg,
          gpointer    data)
{
  GMainLoop *loop = (GMainLoop *) data;

  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);

      g_printerr ("Error: %s\n", error->message);
      g_error_free (error);

      g_main_loop_quit (loop);
      break;
    }
    default:
      break;
  }

  return TRUE;
}

void printStateChange(GstStateChangeReturn value) {
  switch(value) {
    case GST_STATE_CHANGE_FAILURE:
      g_print("GST_STATE_CHANGE_FAILURE\n");
      break;
    case GST_STATE_CHANGE_SUCCESS:
      g_print("GST_STATE_CHANGE_SUCCESS\n");
      break;
    case GST_STATE_CHANGE_ASYNC:
      g_print("GST_STATE_CHANGE_ASYNC\n");
      break;
    case GST_STATE_CHANGE_NO_PREROLL:
      g_print("GST_STATE_CHANGE_NO_PREROLL\n");
      break;
    default:
      g_print("Unknown state\n");
      break;

      return;
  }
}

GstStateChangeReturn handleAsync(GstElement *element) {
  GstState *currentState = NULL, *pendingState = NULL;
  GstClockTime timeout = GST_CLOCK_TIME_NONE;
  GstStateChangeReturn result;

  g_print("handeling state\n");
  result = gst_element_get_state(element, currentState, pendingState, timeout);
  printStateChange(result);

  return result;
}

int
main (int   argc,
      char *argv[])
{
  GMainLoop *loop;

  GstElement *pipeline, *source, *conv, *sink;
  GstBus *bus;
  guint bus_watch_id;

  GstStateChangeReturn result;

  gst_init (&argc, &argv);

  loop = g_main_loop_new (NULL, FALSE);

  pipeline = gst_pipeline_new ("test");
  source   = gst_element_factory_make ("decklinkvideosrc", "source");
  conv     = gst_element_factory_make ("autovideoconvert",  "converter");
  sink     = gst_element_factory_make ("xvimagesink", "sink");

  if (!pipeline || !source || !conv || !sink) {
    g_printerr ("One element could not be created. Exiting.\n");
    return -1;
  }

//  gst_util_set_object_arg (G_OBJECT(source), "mode", "auto");
  gst_util_set_object_arg (G_OBJECT(source), "mode", "ntsc-p");
  gst_util_set_object_arg (G_OBJECT(source), "connection", "hdmi");

  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
  bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
  gst_object_unref (bus);

  gst_bin_add_many (GST_BIN (pipeline), source, conv, sink, NULL);
  gst_element_link_many (source, conv, sink, NULL);

  int delay = 2;
  g_print ("setting state: GST_STATE_PLAYING\n");
  result = gst_element_set_state (pipeline, GST_STATE_PLAYING);
  printStateChange(result);
  if(result == GST_STATE_CHANGE_ASYNC) {
    if(handleAsync(pipeline) == GST_STATE_CHANGE_FAILURE){
      return 0;
    }
  }

  g_print ("Returned, stopping playback\n");
  result = gst_element_set_state (pipeline, GST_STATE_NULL);
  printStateChange(result);
  if(result == GST_STATE_CHANGE_ASYNC) {
    if(handleAsync(pipeline) == GST_STATE_CHANGE_FAILURE){
      return 0;
    }
  }

  g_print ("Deleting pipeline\n");
  gst_object_unref (GST_OBJECT (pipeline));
  g_source_remove (bus_watch_id);
  g_main_loop_unref (loop);

  return 0;
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list