AnsweredAssumed Answered

gstreamer Can't play

Question asked by 俊 李 on Apr 29, 2014
Latest reply on Aug 14, 2014 by Yuri Muhin

cmd:gst-launch filesrc location=/1.avi typefind=true ! aiurdemux ! vpudec ! mfw_v4lsink device=/dev/video16

code:main.c

#include <gst/gst.h>

#include <glib.h>

#include <signal.h>

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <fcntl.h>

#include <sys/ioctl.h>

#include <linux/types.h>

 

void on_signal(int sign_no)

{

  if(sign_no == SIGINT)

  {

  g_print("Get CTRONL-C signal to termanite app\n");

  exit(0);

  }

}

 

 

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

{

 

 

 

  GstBus *bus;

  GError *error = NULL;

  GMainLoop *loop;

  GstElement *video_sink;

    GstElement *typefind;

  GstElement *audio_sink;

    GstElement *demuxers;

  GstElement *convertors;

    GstElement* filesrc;

  GstElement* pipeline;

  signal(SIGINT, on_signal);

  loop = g_main_loop_new (NULL, FALSE);

  gst_init (&argc, &argv);

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

  g_object_set (G_OBJECT (filesrc), "location","/1.avi", NULL);

  g_object_set (G_OBJECT (filesrc), "typefind",TRUE, NULL);

  demuxers = gst_element_factory_make("aiurdemux", "aiurdemux0");

  convertors = gst_element_factory_make("vpudec", "vpudec0");

  video_sink = gst_element_factory_make("mfw_v4lsink", "mfw_v4lsink0");

  g_object_set (G_OBJECT (video_sink), "device","/dev/video16", NULL);

  pipeline = gst_pipeline_new ("pipeline");

  gst_bin_add_many (GST_BIN (pipeline),video_sink,demuxers,convertors,filesrc, NULL);

  gst_element_link_many (filesrc, demuxers, convertors,video_sink, NULL);

  gst_element_link (filesrc, demuxers);

  gst_element_link (convertors, video_sink);

  gst_element_set_state (pipeline, GST_STATE_NULL);

  gst_element_set_state (pipeline, GST_STATE_PLAYING);

  g_main_loop_run(loop);

}

Outcomes