当前位置:网站首页>-v parameter of GST launch
-v parameter of GST launch
2022-07-05 19:40:00 【Hui's technical notes】
-v Parameters
Let's start with a simple example :
gst-launch Of pipeline, increase -v Parameters can be output caps Details of , Including what we want codec_data, that , This -v How parameters are output , You need to trace the code in depth , Because this output is not affected GST_DEBUG The control of , Yes direct output to terminal Of .
$ gst-launch-1.0 filesrc location=~/h264.mp4 ! qtdemux ! fakesink -v
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, \
level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba1000000300100000030320f183196001000568ebecb22c, \
width=(int)1280, height=(int)720, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.001151180
Setting pipeline to NULL ...
Freeing pipeline ...
stay gst-launch In the code of ,-v The function of parameters is to output status information and Attribute Notification , If there is verbose Parameters , Will increase first deep_notify Processing function :
{
"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
N_("Output status information and property notifications"), NULL},
if (verbose) {
deep_notify_id =
gst_element_add_property_deep_notify_watch (pipeline, NULL, TRUE);
}
gst_element_property_deep_notify_cb
gst_element_property_deep_notify_cb
Here it is. deep_notify
Signal callback function :
gulong
gst_element_add_property_deep_notify_watch (GstElement * element,
const gchar * property_name, gboolean include_value)
{
const gchar *sep;
gchar *signal_name;
gulong id;
g_return_val_if_fail (GST_IS_ELEMENT (element), 0);
sep = (property_name != NULL) ? "::" : NULL;
signal_name = g_strconcat ("deep-notify", sep, property_name, NULL);
id = g_signal_connect (element, signal_name,
G_CALLBACK (gst_element_property_deep_notify_cb),
GINT_TO_POINTER (include_value));
g_free (signal_name);
return id;
}
Tracking into gst_element_property_deep_notify_cb function ,gst_message_new_property_notify Will first create a new property news , then post message.
gst_message_new_property_notify
gst_message_new_property_notify Middle structure MESSAGE_PROPERTY_NOTIFY
Type of message,message post after , Will be in gst-launch Medium receiving and processing .
GstMessage *
gst_message_new_property_notify (GstObject * src, const gchar * property_name,
GValue * val)
{
GstStructure *structure;
GValue name_val = G_VALUE_INIT;
g_return_val_if_fail (property_name != NULL, NULL);
structure = gst_structure_new_id_empty (GST_QUARK (MESSAGE_PROPERTY_NOTIFY));
g_value_init (&name_val, G_TYPE_STRING);
/* should already be interned, but let's make sure */
g_value_set_static_string (&name_val, g_intern_string (property_name));
gst_structure_id_take_value (structure, GST_QUARK (PROPERTY_NAME), &name_val);
if (val != NULL)
gst_structure_id_take_value (structure, GST_QUARK (PROPERTY_VALUE), val);
return gst_message_new_custom (GST_MESSAGE_PROPERTY_NOTIFY, src, structure);
}
gst-lauch And GST_MESSAGE_PROPERTY_NOTIFY
stay gst-launch In the middle ,GST_MESSAGE_PROPERTY_NOTIFY Processing branch of , Will first parse message Of val, And then pass at the end gst_print Print out , This is why by increasing -v Parameters can be obtained codec_data 了 .
case GST_MESSAGE_PROPERTY_NOTIFY:{
const GValue *val;
const gchar *name;
GstObject *obj;
gchar *val_str = NULL;
gchar **ex_prop, *obj_name;
if (quiet)
break;
gst_message_parse_property_notify (message, &obj, &name, &val);
/* Let's not print anything for excluded properties... */
ex_prop = exclude_args;
while (ex_prop != NULL && *ex_prop != NULL) {
if (strcmp (name, *ex_prop) == 0)
break;
ex_prop++;
}
if (ex_prop != NULL && *ex_prop != NULL)
break;
obj_name = gst_object_get_path_string (GST_OBJECT (obj));
if (val != NULL) {
if (G_VALUE_HOLDS_STRING (val))
val_str = g_value_dup_string (val);
else if (G_VALUE_TYPE (val) == GST_TYPE_CAPS)
val_str = gst_caps_to_string (g_value_get_boxed (val));
else if (G_VALUE_TYPE (val) == GST_TYPE_TAG_LIST)
val_str = gst_tag_list_to_string (g_value_get_boxed (val));
else if (G_VALUE_TYPE (val) == GST_TYPE_STRUCTURE)
val_str = gst_structure_to_string (g_value_get_boxed (val));
else
val_str = gst_value_serialize (val);
} else {
val_str = g_strdup ("(no value)");
}
gst_print ("%s: %s = %s\n", obj_name, name, val_str);
g_free (obj_name);
g_free (val_str);
break;
alike , stay codec-select In the code of , Yes deep_notify
Signal callback function gst_object_default_deep_notify:
gst-plugins-base/tests/examples/dynamic/codec-select.c
g_signal_connect (pipeline, "deep_notify",
G_CALLBACK (gst_object_default_deep_notify), NULL);
gst_object_default_deep_notify:
void
gst_object_default_deep_notify (GObject * object, GstObject * orig,
GParamSpec * pspec, gchar ** excluded_props)
{
GValue value = {
0, }; /* the important thing is that value.type = 0 */
gchar *str = NULL;
gchar *name = NULL;
if (pspec->flags & G_PARAM_READABLE) {
/* let's not print these out for excluded properties... */
while (excluded_props != NULL && *excluded_props != NULL) {
if (strcmp (pspec->name, *excluded_props) == 0)
return;
excluded_props++;
}
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
if (G_VALUE_HOLDS_STRING (&value))
str = g_value_dup_string (&value);
else
str = gst_value_serialize (&value);
name = gst_object_get_path_string (orig);
// Print -v Parameters
g_print ("%s: %s = %s\n", name, pspec->name, str);
g_free (name);
g_free (str);
g_value_unset (&value);
} else {
name = gst_object_get_path_string (orig);
g_warning ("Parameter %s not readable in %s.", pspec->name, name);
g_free (name);
}
}
边栏推荐
- 软件测试工程师是做什么的?待遇前景怎么样?
- 【obs】libobs-winrt :CreateDispatcherQueueController
- C#应用程序界面开发基础——窗体控制(6)——菜单栏、工具栏和状态栏控件
- third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl
- [hard core dry goods] which company is better in data analysis? Choose pandas or SQL
- vagrant2.2.6支持virtualbox6.1版本
- Fuzor 2020 software installation package download and installation tutorial
- 软件测试是干什么的?学习有啥要求?
- What do software test engineers do? How about the prospect of treatment?
- 关于 Notion-Like 工具的反思和畅想
猜你喜欢
Apprentissage du projet MMO I: préchauffage
Fuzor 2020軟件安裝包下載及安裝教程
Hiengine: comparable to the local cloud native memory database engine
What does software testing do? What are the requirements for learning?
如何在2022年更明智地应用智能合约?
微波雷达感应模块技术,实时智能检测人体存在,静止微小动静感知
Django uses mysqlclient service to connect and write to the database
100million single men and women supported an IPO with a valuation of 13billion
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
Fuzor 2020 software installation package download and installation tutorial
随机推荐
软件测试工程师是做什么的?待遇前景怎么样?
C application interface development foundation - form control (5) - grouping control
Add data to excel small and medium-sized cases through poi
Common operators and operator priority
毫米波雷达人体感应器,智能感知静止存在,人体存在检测应用
Password reset of MariaDB root user and ordinary user
How to apply smart contracts more wisely in 2022?
How to choose the notion productivity tools? Comparison and evaluation of notion, flowus and WOLAI
通过POI追加数据到excel中小案例
vagrant2.2.6支持virtualbox6.1版本
集合
id选择器和类选择器的区别
使用 RepositoryProvider简化父子组件的传值
通配符选择器
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
IBM大面积辞退40岁+的员工,掌握这十个搜索技巧让你的工作效率至上提高十倍
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
Common - Hero Minesweeper
Fuzor 2020軟件安裝包下載及安裝教程
5 years of experience, 27 days of Android programmer interview, 2022 programmer advanced classic