当前位置: 首页 > news >正文

网站建设的技术要求建设单位发包许可证网站

网站建设的技术要求,建设单位发包许可证网站,wordpress底部版权怎么添加,广州市白云区最新消息运行效果 介绍 我们已经使用了这个元素,它能够构建一个完整的播放管道,而无需做太多工作。 本教程介绍如何进一步自定义,以防其默认值不适合我们的特定需求。将学习: • 如何确定文件包含多少个流,以及如何切换 其中。…
运行效果

在这里插入图片描述

介绍

     我们已经使用了这个元素,它能够构建一个完整的播放管道,而无需做太多工作。 本教程介绍如何进一步自定义,以防其默认值不适合我们的特定需求。将学习:

          • 如何确定文件包含多少个流,以及如何切换 其中。

          • 如何收集有关每个流的信息。

     通常情况下,多个音频、视频和字幕流可以是嵌入在单个文件中。最常见的情况是常规电影,其中包含一个视频和音频流(立体声或 5.1 音轨被视为单个流)。它也越来越 常见查找具有一个视频和多个音频流的电影,以考虑不同的语言。在这种情况下,用户选择一个 audio 流,并且应用程序将仅播放该流。为了能够选择合适的流,用户需要知道有关他们的某些信息,例如他们的语言。这 信息以 “元数据” 的形式嵌入到流中 (附加的数据),本教程将介绍如何检索它。

GStreamer相关运行库
INCLUDEPATH += D:/Software/GStreamer/1.0/mingw_x86_64/include/gstreamer-1.0/gst
INCLUDEPATH += D:/Software/GStreamer/1.0/mingw_x86_64/include
INCLUDEPATH += D:/Software/GStreamer/1.0/mingw_x86_64/include/gstreamer-1.0
INCLUDEPATH += D:/Software/GStreamer/1.0/mingw_x86_64/include/glib-2.0
INCLUDEPATH += D:/Software/GStreamer/1.0/mingw_x86_64/lib/glib-2.0/includeLIBS += D:/Software/GStreamer/1.0/mingw_x86_64/lib/gstreamer-1.0.lib
LIBS += D:/Software/GStreamer/1.0/mingw_x86_64/lib/glib-2.0.lib
LIBS += D:/Software/GStreamer/1.0/mingw_x86_64/lib/gobject-2.0.lib

源码
#include <gst/gst.h>#include <iostream>
#include <stdio.h>typedef struct _CustomData
{GstElement *playbin;    /* 播放元素 */gint n_video;          /* 视频流数量 */gint n_audio;          /* 音频流数量 */gint n_text;           /* 字幕流数量 */gint current_video;    /* 当前正在播放视频流 */gint current_audio;    /* 当前正在播放音频流 */gint current_text;     /* 当前正在播放字母流*/GMainLoop *main_loop;  /* glib主循环 */
} CustomData;/* playbin flags */
typedef enum 
{GST_PLAY_FLAG_VIDEO         = (1 << 0), /* We want video output */GST_PLAY_FLAG_AUDIO         = (1 << 1), /* We want audio output */GST_PLAY_FLAG_TEXT          = (1 << 2)  /* We want subtitle output */
} GstPlayFlags;/* Forward definition for the message and keyboard processing functions */
static gboolean handle_message (GstBus *bus, GstMessage *msg, CustomData *data);
static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond, CustomData *data);int main(int argc, char *argv[])
{/* 初始化GStreamer */gst_init (&argc, &argv);/* 创建元素 */CustomData data;data.playbin = gst_element_factory_make ("playbin", "playbin");if (!data.playbin) { g_printerr ("Not all elements could be created.\n"); return -1;}/* 设置播放的uri */g_object_set (data.playbin, "uri", "https://gstreamer.freedesktop.org/data/media/sintel_cropped_multilingual.webm", NULL);/* 设置标志以显示音频和视频,但忽略字幕 */gint flags;g_object_get (data.playbin, "flags", &flags, NULL);flags |= GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO;flags &= ~GST_PLAY_FLAG_TEXT;g_object_set (data.playbin, "flags", flags, NULL);/* 设置连接速度。这将影响playbin的一些内部决策 */g_object_set (data.playbin, "connection-speed", 56, NULL);/* 添加bus监视,这样就可以在消息到达时收到通知 */GstBus *bus = gst_element_get_bus (data.playbin);gst_bus_add_watch (bus, (GstBusFunc)handle_message, &data);/* 添加键盘监视,以便我们收到按键通知 */
#ifdef G_OS_WIN32GIOChannel *io_stdin = g_io_channel_win32_new_fd (fileno (stdin));
#elseGIOChannel *io_stdin = g_io_channel_unix_new (fileno (stdin));
#endifg_io_add_watch (io_stdin, G_IO_IN, (GIOFunc)handle_keyboard, &data);/* 开始播放 */GstStateChangeReturn ret = gst_element_set_state (data.playbin, GST_STATE_PLAYING);if (ret == GST_STATE_CHANGE_FAILURE){g_printerr ("Unable to set the pipeline to the playing state.\n");gst_object_unref (data.playbin); return -1;}/* 创建GLib主循环并将其设置为运行 */data.main_loop = g_main_loop_new (NULL, FALSE);g_main_loop_run (data.main_loop);/* 释放资源 */g_main_loop_unref (data.main_loop);g_io_channel_unref (io_stdin);gst_object_unref (bus);gst_element_set_state (data.playbin, GST_STATE_NULL);gst_object_unref (data.playbin);return 0;
}/* 从流中提取一些元数据并将其打印在屏幕上 */
static void analyze_streams (CustomData *data)
{gchar *str;guint rate;/* 读取一些属性 */g_object_get (data->playbin, "n-video", &data->n_video, NULL);g_object_get (data->playbin, "n-audio", &data->n_audio, NULL);g_object_get (data->playbin, "n-text", &data->n_text, NULL);g_print ("%d video stream(s), %d audio stream(s), %d text stream(s)\n", data->n_video, data->n_audio, data->n_text);g_print ("\n");GstTagList *tags;for (gint i = 0; i < data->n_video; i++){tags = NULL;/* 检索流的视频标签 */g_signal_emit_by_name (data->playbin, "get-video-tags", i, &tags);if (tags){g_print ("video stream %d:\n", i);gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str);g_print ("  codec: %s\n", str ? str : "unknown");g_free (str);gst_tag_list_free (tags);}}g_print ("\n");for (gint i = 0; i < data->n_audio; i++){tags = NULL;/* 检索流的音频标签 */g_signal_emit_by_name (data->playbin, "get-audio-tags", i, &tags);if (tags){g_print ("audio stream %d:\n", i);if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)){g_print ("  codec: %s\n", str);g_free (str);}if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)){g_print ("  language: %s\n", str);g_free (str);}if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)){g_print ("  bitrate: %d\n", rate);}gst_tag_list_free (tags);}}g_print ("\n");for (gint i = 0; i < data->n_text; i++){tags = NULL;/* 检索流的字幕标签 */g_signal_emit_by_name (data->playbin, "get-text-tags", i, &tags);if (tags){g_print ("subtitle stream %d:\n", i);if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)){g_print ("  language: %s\n", str);g_free (str);}gst_tag_list_free (tags);}}g_object_get (data->playbin, "current-video", &data->current_video, NULL);g_object_get (data->playbin, "current-audio", &data->current_audio, NULL);g_object_get (data->playbin, "current-text", &data->current_text, NULL);g_print ("\n");g_print ("Currently playing video stream %d, audio stream %d and text stream %d\n", data->current_video, data->current_audio, data->current_text);g_print ("Type any number and hit ENTER to select a different audio stream\n");
}/* 处理GStreamer的消息 */
static gboolean handle_message (GstBus *bus, GstMessage *msg, CustomData *data)
{GError *err;gchar *debug_info;switch (GST_MESSAGE_TYPE (msg)){case GST_MESSAGE_ERROR:gst_message_parse_error (msg, &err, &debug_info);g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message);g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");g_clear_error (&err); g_free (debug_info); g_main_loop_quit (data->main_loop);break;case GST_MESSAGE_EOS:g_print ("End-Of-Stream reached.\n");g_main_loop_quit (data->main_loop);break;case GST_MESSAGE_STATE_CHANGED:{GstState old_state, new_state, pending_state;gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->playbin)){if (new_state == GST_STATE_PLAYING){/* 一旦我们进入播放状态,分析流 */analyze_streams (data);}}} break;}/* 继续收到消息 */return TRUE;
}/* 处理键盘输入 */
static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond, CustomData *data)
{gchar *str = NULL;if (g_io_channel_read_line (source, &str, NULL, NULL, NULL) == G_IO_STATUS_NORMAL){int index = g_ascii_strtoull (str, NULL, 0);if (index < 0 || index >= data->n_audio){g_printerr ("Index out of bounds\n");}else{/* 如果输入是有效的音频流索引,请设置当前音频流 */g_print ("Setting current audio stream to %d\n", index);g_object_set (data->playbin, "current-audio", index, NULL);}}g_free (str);return TRUE;
}

关注

笔者 - jxd

http://www.dtcms.com/a/448151.html

相关文章:

  • 9夜夜做新郎网站chrome下载
  • 上海徐汇网站建设小公司网站维护
  • 宁波专业制作网站适合发表个人文章的平台
  • 简单电商网站模板点评网站建设
  • 阿坝网站建设做网上竞彩网站合法吗
  • 悠悠我心个人网站模板成都网站建设哪家
  • 制作网页网站小说教程抖音代运营保证金
  • 潍城营销型网站建设怎么查询域名
  • 陕西免费网站建设网站流量被黑
  • 专业企业网站制作怎么做c2c电子商务
  • 北京网站优建设保证量身定制的营销型网站
  • 网页站点怎么命名编程自学教程入门
  • 网站代运营 如何纳税龙岗区网站建设公司
  • 建一个团购网站谷歌建站哪家好
  • 昆明专业网站排名推广做卖东西的网站多少钱
  • 做网站的用什么电脑好湖南网站建设 要上磐石网络
  • 外国网站英语要求泉州百度推广排名优化
  • 泰顺机械网站建设logo商标设计公司
  • 购物网站的目的和意义怎样在网站上做销售
  • 网站需要兼容哪些浏览器深圳网站建设的服务怎么样
  • 东台做网站找哪家好网站制作网站模板
  • 舟山网站建设开发青少年编程培训教育
  • 一款电脑定时关机软件工具
  • 薛城做网站东莞百度推广教程
  • 如何建设线报网站wordpress主题换图片不显示不出来
  • 网站产品介绍长图哪个软件做的域名解析服务器ip地址
  • 怎么用自己电脑做服务器发布网站吗免费h5源码资源源码站
  • wordpress禁止右键模板网站会影响网站优化吗
  • 网站 优化 教程wordpress获取当前分类名
  • 手机网站微信登录建晨网站建设