Can not play double-image screen

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can not play double-image screen

744 Views
Tico
Contributor II

gst-launch filesrc location=/path/test.ts ! tee name=t t. ! mpegtsdemux ! queue ! vpudec ! \

mfw_isink disp-width=640 disp-height=480 axis-left=0 t. ! mpegtsdemux ! queue ! ccdecoder ! colorspace \

! mfw_isink disp-width=640 disp-height=480 axis-left=660

The following command is what I play a video, recorded by the DVB-T signal.

There are several channels in this movie, I think the two channels while playing content.

Here is my code, but has not performed well, could you please help me check to see which side is out of the question.

#include <gst/gst.h>

  

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

  GstElement *pipeline, *file_source, *tee, demuxer_1, *vqueue1, *vdecoder_1, *vsink1;

  GstElement *demuxer_2, *vqueue2, *vdecoder_2, *vsink2;

  GstBus *bus;

  GstMessage *msg;

  GstPadTemplate *tee_src_pad_template;

  GstPad *tee_v_pad, *tee_video_pad;

  GstPad *queue_v_pad, *queue_video_pad;

  

  /* Initialize GStreamer */

  gst_init (&argc, &argv);

  

  /* Create the elements */

  file_source = gst_element_factory_make ("filesrc", "file_source");

  tee = gst_element_factory_make ("tee", "tee");

  demuxer_1 = gst_element_factory_make ("mpegtsdemux", "demux1");

  vqueue1 = gst_element_factory_make ("queue", "vqueue1");

  vdecoder_1 = gst_element_factory_make ("vpudec", "vdec1");

  vsink1 = gst_element_factory_make ("mfw_isink", "vsink1");

  demuxer_2 = gst_element_factory_make ("mpegtsdemux", "demux2");

  vqueue2 = gst_element_factory_make ("queue", "vqueue2");

  vdecoder_2 = gst_element_factory_make ("vpudec", "vdec2");

  visual = gst_element_factory_make ("wavescope", "visual");

  video_convert = gst_element_factory_make ("ffmpegcolorspace", "csp");

  vsink2 = gst_element_factory_make ("mfw_isink", "vsink2");

  

  /* Create the empty pipeline */

  pipeline = gst_pipeline_new ("test-pipeline");

  

  if (!pipeline || !file_source || !tee || !demuxer_1 || !vqueue1 || !vdecoder_1 || !vsink1 ||

      !demuxer_2 ||!vqueue2 || !vdecoder_2 || !vsink2) {

    g_printerr ("Not all elements could be created.\n");

    return -1;

  }

  

  /* Configure elements */

  g_object_set (file_source, "location", "/path/test.ts", NULL);

  g_object_set (demuxer_1, "pid", "1001:1002:100", NULL);

  g_object_set (demuxer_2, "pid", "1011:1012:101", NULL);

  

  /* Link all elements that can be automatically linked because they have "Always" pads */

  gst_bin_add_many (GST_BIN (pipeline), file_source, tee, demuxer_1, vqueue1, vdecoder_1, vsink1,

      demuxer_2, vqueue2, vdecoder_2, vsink2, NULL);

  if (gst_element_link_many (file_source, tee, NULL) != TRUE ||

      gst_element_link_many (demuxer_1, vqueue1, vdecoder_1, vsink1, NULL) != TRUE ||

      gst_element_link_many (demuxer_2, vqueue2, vdecoder_2, vsink2, NULL) != TRUE) {

    g_printerr ("Elements could not be linked.\n");

    gst_object_unref (pipeline);

    return -1;

  }

  

  /* Manually link the Tee, which has "Request" pads */

  tee_src_pad_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (tee), "src%d");

  tee_v_pad = gst_element_request_pad (tee, tee_src_pad_template, NULL, NULL);

  g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_v_pad));

  queue_v_pad = gst_element_get_static_pad (demuxer_1, "sink");

  tee_video_pad = gst_element_request_pad (tee, tee_src_pad_template, NULL, NULL);

  g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));

  queue_video_pad = gst_element_get_static_pad (demuxer_2, "sink");

  if (gst_pad_link (tee_v_pad, queue_v_pad) != GST_PAD_LINK_OK ||

      gst_pad_link (tee_video_pad, queue_video_pad) != GST_PAD_LINK_OK) {

    g_printerr ("Tee could not be linked.\n");

    gst_object_unref (pipeline);

    return -1;

  }

  gst_object_unref (queue_v_pad);

  gst_object_unref (queue_video_pad);

  

  /* Start playing the pipeline */

  gst_element_set_state (pipeline, GST_STATE_PLAYING);

  

  /* Wait until error or EOS */

  bus = gst_element_get_bus (pipeline);

  msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

  

  /* Release the request pads from the Tee, and unref them */

  gst_element_release_request_pad (tee, tee_v_pad);

  gst_element_release_request_pad (tee, tee_video_pad);

  gst_object_unref (tee_v_pad);

  gst_object_unref (tee_video_pad);

  

  /* Free resources */

  if (msg != NULL)

    gst_message_unref (msg);

  gst_object_unref (bus);

  gst_element_set_state (pipeline, GST_STATE_NULL);

  

  gst_object_unref (pipeline);

  return 0;

}

0 Kudos
Reply
2 Replies

577 Views
joanxie
NXP TechSupport
NXP TechSupport

could you tell me what board  you  use? did  you try to use unit test? and what error do you have?

0 Kudos
Reply

577 Views
Wlodek_D_
Senior Contributor II

Hello,

Thank you for your post, however please consider moving it to the right community place (e.g. i.MX Community )  to get it visible for active members.

For details please see general advice Where to post a Discussion?

Thank you for using Freescale Community.

0 Kudos
Reply