Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android VideoView GStreamer流媒体(MediaController不工作)_Android_Gstreamer_Android Videoview_Rtsp_Mediacontroller - Fatal编程技术网

Android VideoView GStreamer流媒体(MediaController不工作)

Android VideoView GStreamer流媒体(MediaController不工作),android,gstreamer,android-videoview,rtsp,mediacontroller,Android,Gstreamer,Android Videoview,Rtsp,Mediacontroller,我有一个小项目要把视频流到android设备上。流媒体已完成,但我在控制视频方面有问题。当我按下“暂停”按钮时,MediaController不工作,没有效果。VideoView.pause()也不起作用。流媒体服务器基于GStreamer(服务器是我朋友写的),我现在使用的是安卓2.2 CyanogenMod 这是服务器代码: #include <gst/gst.h> #include <gst/rtsp-server/rtsp-server.h> int main

我有一个小项目要把视频流到android设备上。流媒体已完成,但我在控制视频方面有问题。当我按下“暂停”按钮时,MediaController不工作,没有效果。VideoView.pause()也不起作用。流媒体服务器基于GStreamer(服务器是我朋友写的),我现在使用的是安卓2.2 CyanogenMod

这是服务器代码:

#include <gst/gst.h>

#include <gst/rtsp-server/rtsp-server.h>

int
main (int argc, char *argv[])
{
  GMainLoop *loop;
  GstRTSPServer *server;
  GstRTSPMediaMapping *mapping;
  GstRTSPMediaFactory *factory;
  gchar *str;

  gst_init (&argc, &argv);

  if (argc < 2) {
    g_message ("usage: %s <filename>", argv[0]);
    return -1;
  }

  loop = g_main_loop_new (NULL, FALSE);

  /* create a server instance */
  server = gst_rtsp_server_new ();

  /* get the mapping for this server, every server has a default mapper object
   * that be used to map uri mount points to media factories */
  mapping = gst_rtsp_server_get_media_mapping (server);

  str = g_strdup_printf ("( "
       "filesrc location=\"%s\" ! decodebin2 name=d "
       "d. ! queue ! videoscale ! video/x-raw-yuv, width=500, height=300 "
       "! ffenc_mpeg4 ! rtpmp4vpay name=pay0 "
       "d. ! queue ! audioconvert ! faac ! rtpmp4apay name=pay1"
       " )", argv[1]);

  /* make a media factory for a test stream. The default media factory can use
   * gst-launch syntax to create pipelines. 
   * any launch line works as long as it contains elements named pay%d. Each
   * element with pay%d names will be a stream */
  factory = gst_rtsp_media_factory_new ();
  gst_rtsp_media_factory_set_launch (factory, str);
  g_free (str);

  /* attach the test factory to the /test url */
  gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);

  /* don't need the ref to the mapper anymore */
  g_object_unref (mapping);

  /* attach the server to the default maincontext */
  gst_rtsp_server_attach (server, NULL);

  /* start serving */
  g_main_loop_run (loop);

  return 0;
}
#包括
#包括
int
main(int argc,char*argv[])
{
GMainLoop*循环;
GstRTSPServer*服务器;
GstRTSPMediaMapping*映射;
GstRTSPMediaFactory*工厂;
gchar*str;
gst_init(&argc,&argv);
如果(argc<2){
g_消息(“用法:%s”,argv[0]);
返回-1;
}
loop=g_main_loop_new(NULL,FALSE);
/*创建一个服务器实例*/
server=gst\u rtsp\u server\u new();
/*获取此服务器的映射,每个服务器都有一个默认映射器对象
*用于将uri装入点映射到媒体工厂的*/
映射=gst\u rtsp\u服务器\u获取\u媒体\u映射(服务器);
str=g_strdup_printf(“(”
“filesrc位置=\%s\!decodebin2 name=d”
d.!队列!视频缩放!视频/x-raw-yuv,宽度=500,高度=300
“!ffenc_mpeg4!rtpmp4vpay name=pay0”
“d.!队列!音频转换!faac!rtpmp4apay name=pay1”
”),argv[1]);
/*为测试流创建媒体工厂。默认媒体工厂可以使用
*用于创建管道的gst启动语法。
*只要包含名为pay%d的元素,任何发布行都可以工作。每个
*付款名称为%d的元素将是流*/
工厂=gst_rtsp_媒体_工厂_新();
gst、rtsp、媒体、工厂、集合、发布(工厂、str);
g_-free(str);
/*将测试工厂附加到/test url*/
gst\u rtsp\u介质\u映射\u添加\u工厂(映射,“/test”,工厂);
/*不再需要映射器的引用*/
g_object_unref(映射);
/*将服务器附加到默认的maincontext*/
gst\u rtsp\u服务器\u连接(服务器,空);
/*开始发球*/
g_主循环运行(循环);
返回0;
}

根据我收集的信息,android中的
视频视图只接受
h.264
提要,因此您需要在
h.264
中编码