您现在的位置是:首页 > 正文

Gstreamer利用category调试

2024-02-01 05:40:14阅读 3

之前总结过category的定义和使用,基于这个基础,发现利用gstreamer的categories和log系统,调试起来效率会提升很多。

首先,通过gst-launch-1.0 --help-gst可以列出来gstreamer支持命令行参数,比如--gst-debug-help 就可以打印出来所有的categories,这个在通过log来调试的时候非常方便。

$ gst-launch-1.0 --help-gst
Usage:
  gst-launch-1.0 [OPTION…] PIPELINE-DESCRIPTION

GStreamer Options
  --gst-version                     Print the GStreamer version
  --gst-fatal-warnings              Make all warnings fatal
  --gst-debug-help                  Print available debug categories and exit
  --gst-debug-level=LEVEL           Default debug level from 1 (only error) to 9 (anything) or 0 for no output
  --gst-debug=LIST                  Comma-separated list of category_name:level pairs to set specific levels for the individual categories. Example: GST_AUTOPLUG:5,GST_ELEMENT_*:3
  --gst-debug-no-color              Disable colored debugging output
  --gst-debug-color-mode            Changes coloring mode of the debug log. Possible modes: off, on, disable, auto, unix
  --gst-debug-disable               Disable debugging
  --gst-plugin-spew                 Enable verbose plugin loading diagnostics
  --gst-plugin-path=PATHS           Colon-separated paths containing plugins
  --gst-plugin-load=PLUGINS         Comma-separated list of plugins to preload in addition to the list stored in environment variable GST_PLUGIN_PATH
  --gst-disable-segtrap             Disable trapping of segmentation faults during plugin loading
  --gst-disable-registry-update     Disable updating the registry
  --gst-disable-registry-fork       Disable spawning a helper process while scanning the registry

通过gst-launch-1.0 --gst-debug-help可以列出所有的category,加上grep GST过滤后,列出来的就是GST_开头的categories:

$ gst-launch-1.0 --gst-debug-help | grep GST
GST_BUFFER            0   no description
GST_BUFFER_LIST       0   no description
GST_BUS               0   no description
GST_CALL_TRACE        0   no description
GST_CAPS              0   no description
GST_CLOCK             0   no description
GST_CONTEXT           0   no description
GST_DATAFLOW          0   dataflow inside pads
GST_DEBUG             0   debugging subsystem
GST_DEVICE_PROVIDER_FACTORY  0   device provider factories keep information about installed device providers
GST_DYNAMIC_TYPE_FACTORY  0   dynamic type factories allow automatically loading a type from a plugin
GST_ELEMENT_FACTORY   0   element factories keep information about installed elements
GST_ELEMENT_PADS      0   no description
GST_ERROR_SYSTEM      0   no description
GST_EVENT             0   no description
GST_INIT              0   no description
GST_LOCKING           0   locking
GST_MEMORY            0   memory
GST_MESSAGE           0   no description
GST_META              0   meta
GST_NEGOTIATION       0   no description
GST_PADS              0   no description
GST_PARAMS            0   no description
GST_PARENTAGE         0   no description
GST_PERFORMANCE       0   no description
GST_PIPELINE          0   no description
GST_PLUGIN_INFO       0   no description
GST_PLUGIN_LOADING    0   no description
GST_POLL              0   poll
GST_PROBE             0   pad probes
GST_PROPERTIES        0   no description
GST_PROTECTION        0   protection
GST_QOS               0   QoS
GST_REFCOUNTING       0   no description
GST_REGISTRY          0   registry
GST_SCHEDULING        0   no description
GST_SIGNAL            0   no description
GST_STATES            0   no description
GST_TRACER            0   tracing subsystem
GST_TYPEFIND          0   typefinding subsystem
GST_URI               0   handling of URIs

举个例子,如下,使用playbin播放http mp4的时候,我想知道都创建了那些element,通过指定GST_ELEMENT_FACTORY:5grep created过滤,就可以列出所有创建的lement:

GST_DEBUG=GST_ELEMENT_FACTORY:5 gst-play-1.0 http://192.168.31.124/mov/mp4/panda.mp4 2>&1 | grep created
0:00:00.129453815 12086   0x8c9980 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "playbin"
0:00:00.131668332 12086   0x8c9980 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "uridecodebin"
0:00:00.148187229 12086   0x8c9980 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "souphttpsrc"
0:00:00.151771407 12086   0x8c9980 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "typefind"
0:00:00.288990553 12086   0x8d1db0 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "typefind"
0:00:00.289591194 12086   0x8d1db0 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "decodebin"
0:00:00.290801143 12086   0x8d1db0 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "queue2"
0:00:00.471883367 12086 0xf6803260 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "qtdemux"
0:00:00.492200114 12086 0xf6803260 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "multiqueue"
0:00:00.520578784 12086 0xf6803260 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "h264parse"
0:00:00.544318831 12086 0xf6803260 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "capsfilter"
0:00:00.616704420 12086 0xf6803260 DEBUG    GST_ELEMENT_FACTORY gstelementfactory.c:391:gst_element_factory_create: created element "aacparse"

又比如GST_CONTEXT:5,观察context的创建:

$ GST_DEBUG=GST_CONTEXT:5 gst-play-1.0 http://192.168.31.124/mov/mp4/panda.mp4 2>&1 
Now playing http://192.168.31.124/mov/mp4/panda.mp4
0:00:00.171488200 11386  0x1fb0180 LOG              GST_CONTEXT gstcontext.c:174:gst_context_new: creating new context 0x1fb8580
0:00:00.171677162 11386  0x1fb0180 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<source> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.308191351 11386  0x1fb85b0 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<decodebin0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.308318895 11386  0x1fb85b0 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<typefind> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.309390123 11386  0x1fb85b0 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<queue2-0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;

0:00:00.503178186 11386 0xf6603260 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<qtdemux0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.526549903 11386 0xf6603260 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<multiqueue0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.540391154 11386 0xf6603260 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<h264parse0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.549850535 11386 0xf6603260 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<capsfilter0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;
0:00:00.597613528 11386 0xf6603260 DEBUG            GST_CONTEXT gstelement.c:3473:gst_element_set_context:<aacparse0> set context 0x1fb8580 context, session=(SoupSession)NULL, force=(boolean)false;

这两个例子都是Gstreamer中基础的部分,其他的element的category通过这个方法查找,再也不怕写错了。

网站文章

  • 基本算法之枚举.205.余数相同问题

    求余

    2024-02-01 05:40:07
  • selenium自动化截图的方式

    自动化截图的三种方式

    2024-02-01 05:39:37
  • idea基本建立工程与注意事项

    1.src–&gt;new–&gt;Package 2.File–&gt;New–&gt;Module 3.File–&gt;New–&gt;Project 4.File–&gt;Project Structure 5.具体包–&gt;New --&gt;Java Class 6.remove–&gt;delete后检查.idea下的modules.xml

    2024-02-01 05:39:31
  • BUUCTF:[watevrCTF-2019]Pickle Store

    BUUCTF:[watevrCTF-2019]Pickle Store

    题目地址:https://buuoj.cn/challenges#[watevrCTF-2019]Pickle%20Store Pickle反序列化 使用pickle.loads()和base64对这...

    2024-02-01 05:39:25
  • 阿里云网盘和百度网盘功能体验上谁更胜一筹呢?

    阿里云网盘和百度网盘功能体验上谁更胜一筹呢?

    阿里云网盘和百度网盘功能体验上谁更胜一筹呢?由阿里巴巴推出的阿里云网盘即将上线,相信这对于百度网盘来说将是一个强劲的对手,会流失许多的用户。那么阿里云网盘和百度网盘哪个好?这两个网盘在功能和体验上谁更...

    2024-02-01 05:39:18
  • Element级联选择器自定义value label

    Element级联选择器自定义value label

    实际项目中后端返回的数据属性可能不是以`label/value`等命名的,这时候数据就渲染不上去。我们需要利用`props`指定选项的值为选项对象的某个属性值。

    2024-02-01 05:38:47
  • LeetCode-160. 相交链表

    LeetCode-160. 相交链表

    于是有一个巧妙的思路诞生了,如果让短的先走完自己的再走长的,长的走完走短的,他俩就会正好对齐。如果让他们尾端队齐,那么从后面遍历就会很快找到第一个相交的点。

    2024-02-01 05:38:21
  • 2021-07-23

    2021-07-23

    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure遇到这个问题,刚开始很懵,于是疯狂百度,大多数都是让修改等待时间,但对我来说无济于事,然后就想着修改代码,于是,发现成功啦!上图:另:数据库版本和驱动jar包不一样,就在注册驱动时找到jdbc的上级目录为止...

    2024-02-01 05:37:47
  • 初学Java Web(3)——第一个Servlet

    初学Java Web(3)——第一个Servlet

    这学期 Java Web 课程的第一节课就简短复习了一下 Java 的一些基础知识,所以觉得 Java 的基础知识还是很重要的,但当我想要去写一篇 Java 回顾的文章的时候发现很难,因为坑实在太多了(一个头,两个大),只能另外找一些时间去写顺便巩固巩固自己的基础。——【1. 什么是 Servlet 】——学习一个东西就要先去了解它是什么东西。Servlet 取自两个单词:Se...

    2024-02-01 05:37:40
  • 杰理之mic 到dac功能【篇】

    杰理之mic 到dac功能【篇】

    8888

    2024-02-01 05:37:32