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

市场营销策划ppt免费模板网站优化的文章

市场营销策划ppt免费模板,网站优化的文章,四川观察最新新闻,杭州专业网站设计制作公司运行效果(音频) 简介 上一个教程演示了GStreamer 概念。本教程中的管在它设置为 playing 状态之前完全构建。这没关系。如果 我们没有采取进一步的行动,数据会到达 pipeline 的 pipeline 和 pipeline 将生成错误消息并停止。但 我们将采取进一…
运行效果(音频)

在这里插入图片描述

简介

     上一个教程演示了GStreamer 概念。本教程中的管在它设置为 playing 状态之前完全构建。这没关系。如果 我们没有采取进一步的行动,数据会到达 pipeline 的 pipeline 和 pipeline 将生成错误消息并停止。但 我们将采取进一步的行动…,它允许“动态”构建管道,如 信息变得可用,而不是拥有整体式管道 在应用程序开始时定义。您将掌握开始播放教程所需的知识。审查的要点 这将是:

          • 如何在链接元素时实现更精细的控制。

          • 如何收到有趣事件的通知,以便您及时做出反应。

          • 元素可以处于的各种状态。

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 <QCoreApplication>
#include <QDebug>#include "gst.h"/* 结构包含我们所有的信息,这样我们就可以将其传递给回调函数 */
typedef struct _CustomData
{GstElement *pipeline;GstElement *source;GstElement *convert;GstElement *resample;GstElement *sink;
} CustomData;/* 附加信号处理器 */
static void pad_added_handler (GstElement *src, GstPad *pad, CustomData *data);int main(int argc, char *argv[])
{/* 初始化GStreamer */gst_init (&argc, &argv);/* 创建元素 */CustomData data;data.source = gst_element_factory_make ("uridecodebin", "source");data.convert = gst_element_factory_make ("audioconvert", "convert");data.resample = gst_element_factory_make ("audioresample", "resample");data.sink = gst_element_factory_make ("autoaudiosink", "sink");/* 创建空管道 */data.pipeline = gst_pipeline_new ("test-pipeline");if (!data.pipeline || !data.source || !data.convert || !data.resample || !data.sink) { g_printerr ("Not all elements could be created.\n"); return -1; }/* 建造管道 */gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.convert, data.resample, data.sink, NULL);if (!gst_element_link_many (data.convert, data.resample, data.sink, NULL)){g_printerr ("Elements could not be linked.\n");gst_object_unref (data.pipeline); return -1;}/* 设置播放的URI(需带有音频) *///g_object_set (data.source, "uri", "https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm", NULL);g_object_set (data.source, "uri", "rtsp://192.168.1.200", NULL);/* 连接到pad-add信号 */g_signal_connect (data.source, "pad-added", G_CALLBACK (pad_added_handler), &data);/* 开始播放 */GstStateChangeReturn ret = gst_element_set_state (data.pipeline, 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.pipeline); return -1;}GstMessage *msg;gboolean terminate = FALSE;/* 从bus监听消息 */GstBus *bus = gst_element_get_bus (data.pipeline);do {// 从bus总线中获取下一个满足特定条件的消息msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS));/* 解析消息 */if (msg != NULL){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);terminate = TRUE;break;case GST_MESSAGE_EOS:g_print ("End-Of-Stream reached.\n");terminate = TRUE;break;case GST_MESSAGE_STATE_CHANGED:/* 我们只对管道中的状态更改消息感兴趣 */if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data.pipeline)){GstState old_state, new_state, pending_state;gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);g_print ("Pipeline state changed from %s to %s:\n", gst_element_state_get_name (old_state), gst_element_state_get_name (new_state));}break;default:/* 我们不应该来这里 */g_printerr ("Unexpected message received.\n");break;}gst_message_unref (msg);}} while (!terminate);/* Free resources */gst_object_unref (bus);gst_element_set_state (data.pipeline, GST_STATE_NULL);gst_object_unref (data.pipeline);return 0;
}/* 此函数将由添加了hanle的信号调用 */
/*当source element最后获得足够的数据时,它就会自动生成source pad,并且触令“pad-added”信号。这样回调就会被调用了;static void pad_added handler (GstElement *src, GstPad *new_pad, CustomData *data)说明: src是触发这个信号的GstElement。在这个例子中就是uridecodebin,也是我们唯一注册的信号。new_pad是加到src上的pad。通常来说,是我们需要连接的pad。data指针是跟随信号一起过来的参数,在这个例子中传递的是CustomData指针。
*/
static void pad_added_handler (GstElement *src, GstPad *new_pad, CustomData *data)
{GstPad *sink_pad = gst_element_get_static_pad (data->convert, "sink");g_print ("Received new pad '%s' from '%s':", GST_PAD_NAME (new_pad), GST_ELEMENT_NAME (src));/* 如果我们的转换器已经链接,我们在这里什么也不用做 */if (gst_pad_is_linked (sink_pad)) { g_print ("We are already linked. Ignoring.\n"); goto exit; }/* 检查新pad的类型 */GstCaps *new_pad_caps = gst_pad_get_current_caps (new_pad);GstStructure *new_pad_struct = gst_caps_get_structure (new_pad_caps, 0);const gchar *new_pad_type = gst_structure_get_name (new_pad_struct);if (!g_str_has_prefix (new_pad_type, "audio/x-raw")) {  g_print ("It has type '%s' which is not raw audio. Ignoring.\n", new_pad_type); goto exit;  }/* 尝试链接 */GstPadLinkReturn ret = gst_pad_link (new_pad, sink_pad);if (GST_PAD_LINK_FAILED (ret)){g_print ("Type is '%s' but link failed.\n", new_pad_type);}else{g_print ("Link succeeded (type '%s').\n", new_pad_type);}exit:/* 如果我们有新pad的caps,请不要参考 */if (new_pad_caps != NULL){gst_caps_unref (new_pad_caps);}/* 减小引用计数sink_pad */gst_object_unref (sink_pad);
}

关注

笔者 - jxd


文章转载自:

http://kFunujXT.hjrjy.cn
http://5e1nNYrT.hjrjy.cn
http://zl4fp8Gr.hjrjy.cn
http://7HqzXRxL.hjrjy.cn
http://qfQ7lwd6.hjrjy.cn
http://nBLUbt2h.hjrjy.cn
http://eL7xsnQK.hjrjy.cn
http://aE2pBgn6.hjrjy.cn
http://JXW6GMjA.hjrjy.cn
http://pxyhrV88.hjrjy.cn
http://YmEejHON.hjrjy.cn
http://DTN1axGy.hjrjy.cn
http://gQUqkKRh.hjrjy.cn
http://WM6KKn9k.hjrjy.cn
http://Uieik8X3.hjrjy.cn
http://Put0nXM3.hjrjy.cn
http://YFf2ejCY.hjrjy.cn
http://2p58ZVS6.hjrjy.cn
http://11bpvf6q.hjrjy.cn
http://45cZKzBD.hjrjy.cn
http://OLncsJdW.hjrjy.cn
http://BK63lYvB.hjrjy.cn
http://vQVEDGYv.hjrjy.cn
http://111IPqKz.hjrjy.cn
http://1vTDWmk5.hjrjy.cn
http://nyVHLPPE.hjrjy.cn
http://tBDxnprO.hjrjy.cn
http://Krrb5Oem.hjrjy.cn
http://pQwqxpQ8.hjrjy.cn
http://YFQxWEQe.hjrjy.cn
http://www.dtcms.com/wzjs/639941.html

相关文章:

  • 企业网站怎么扣费的青海住房与建设厅网站
  • 邢台高端网站建设重庆网站建设cq
  • 未备案网站查询阿里巴巴做网站需要多少钱
  • 课堂资源管理网站开发需求分析企业网站公示怎么做
  • 重庆模板网站哪个好网站怎么做才是对搜索引擎友好
  • 做简单网站怎么做.tv可以做门户网站不
  • 旅游商务网站开发好用的wordpress编辑器
  • 公司的网站的设计网站制作时间代码
  • 做企业网站需要买什么资料湖南网站建设公司 尖端磐石网络
  • 大连网站开发公司电话朋友 合同 网站制作
  • dw做网站乱码wordpress 板块
  • 网站后台设置关键词在哪设网站app封装怎么做
  • 商务网站模板下载公司网站如何做宣传
  • 潮动九州网站建设网站开发技术流程
  • 凡科做的网站手机版织梦网站栏目如何做下拉
  • 国外在线代理服务器免费吉林seo推广系统
  • 微网站域名惠州网络问政平台官网
  • 网站开发需要怎么做平面广告设计行业
  • 网站建设方案可以乱写吗简单描述一下网站制作的流程
  • wordpress 文章标签调用seo营销培训咨询
  • 论文网站建设格式辽宁建设厅查询网站首页
  • 如何做视频卖给网站电子网站
  • 网站建设的流程图示网站流量太高 如何做负载均衡
  • 公众号里链接的网站怎么做的网站建设的重要性
  • 宁波公司做网站美食网站建设内容规划
  • 网站连锁店查询怎么做郴州刚刚发生的事
  • wordpress直播网站主题目前最好的找工作平台
  • 网站建设与管理职责ui网页设计学院
  • 网站建设售后服务承诺顶尖文案网站
  • 国外自助建站肇庆建设工程备案的网站