{"id":1124,"date":"2023-12-03T11:49:29","date_gmt":"2023-12-03T03:49:29","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1124"},"modified":"2023-12-03T16:54:33","modified_gmt":"2023-12-03T08:54:33","slug":"%e6%8e%a2%e9%92%88%e8%ae%a9%e4%bd%a0%e6%98%8e%e5%af%9f%e7%a7%8b%e8%b1%aa","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1124","title":{"rendered":"\u63a2\u9488\u8ba9\u4f60\u660e\u5bdf\u79cb\u8c6a"},"content":{"rendered":"<h1>Probes \u63a2\u9488<\/h1>\n<blockquote>\n<p>Probes are callbacks that can be installed by the application and will notify the application about the states of the dataflow.<\/p>\n<\/blockquote>\n<p>\u63a2\u9488\u5c31\u662f\u4e00\u4e9b\u56de\u8c03\u51fd\u6570\uff0c\u5b83\u53ef\u4ee5\u88c5\u8f7d\u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u7531\u5e94\u7528\u7a0b\u5e8f\u56de\u8c03\u8fd9\u4e9b\u51fd\u6570\uff0c\u4ee5\u901a\u77e5\u6570\u636e\u6d41\u7684\u72b6\u6001\u4fe1\u606f\u3002<\/p>\n<h2>\u9700\u6c42<\/h2>\n<p>\u5e94\u7528\u7a0b\u5e8f\u5e94\u8be5\u80fd\u591f\u76d1\u89c6\u548c\u63a7\u5236 pads \u4e0a\u7684\u6570\u636e\u6d41\u3002 \u6709\u4ee5\u4e0b\u9700\u6c42\uff1a<\/p>\n<ul>\n<li>\n<p>\u5f53 pad \u7a7a\u95f2\u65f6\u6536\u5230\u901a\u77e5\uff0c\u5e76\u786e\u4fdd pad \u4fdd\u6301\u7a7a\u95f2\u72b6\u6001\u3002 \u8fd9\u5bf9\u4e8e\u80fd\u591f\u5728\u4e0d\u7834\u574f\u6570\u636e\u6d41\u7684\u60c5\u51b5\u4e0b\u5b9e\u73b0\u5143\u7d20\u7684\u52a8\u6001\u91cd\u65b0\u94fe\u63a5\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f53\u6570\u636e\u3001\u4e8b\u4ef6 event \u6216\u67e5\u8be2 query \u5728 pad \u4e0a\u63a8\u9001\u6216\u53d1\u9001\u65f6\u6536\u5230\u901a\u77e5\u3002 \u8fd8\u5e94\u8be5\u53ef\u4ee5\u68c0\u67e5\u548c\u4fee\u6539\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>\u80fd\u591f\u6839\u636e\u56de\u8c03\u7684\u7ed3\u679c\u4e22\u5f03 drop\u3001\u4f20\u9012 pass \u548c\u963b\u585e block \u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>\u80fd\u591f\u6839\u636e\u5e94\u7528\u7a0b\u5e8f\u7ebf\u7a0b\u6267\u884c\u7684\u65b9\u6cd5\u5728\u963b\u585e\u7684 pad \u4e0a\u4e22\u5f03\u6216\u4f20\u9012\u6570\u636e\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>\u6982\u8ff0<\/h2>\n<p>\u51fd\u6570 gst_pad_add_probe() \u7528\u4e8e\u5411 pad \u6dfb\u52a0 probe\uff0c\u53c2\u6570\u4e3a\u63a2\u9488\u7c7b\u578b\u63a9\u7801\u548c\u4e00\u4e2a\u56de\u8c03\u51fd\u6570<\/p>\n<pre><code>    gulong  gst_pad_add_probe    (GstPad *pad,\n                                  GstPadProbeType mask,\n                                  GstPadProbeCallback callback,\n                                  gpointer user_data,\n                                  GDestroyNotify destroy_data);<\/code><\/pre>\n<p>\u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a gulong \u6765\u552f\u4e00\u6807\u8bc6 probe, \u53ef\u4ee5\u7528 <code>gst_pad_remove_probe()<\/code> \u6765\u79fb\u9664\u63a2\u9488 <\/p>\n<pre><code>    void    gst_pad_remove_probe (GstPad *pad, gulong id);<\/code><\/pre>\n<p>\u7c7b\u578b\u63a9\u7801\u4e2d\u7684\u6bd4\u7279\u503c\u542b\u4e49\u5982\u4e0b<\/p>\n<pre><code>typedef enum\n{\n  GST_PAD_PROBE_TYPE_INVALID          = 0,\n\n  \/* flags to control blocking *\/\n  GST_PAD_PROBE_TYPE_IDLE             = (1 &lt;&lt; 0),\n  GST_PAD_PROBE_TYPE_BLOCK            = (1 &lt;&lt; 1),\n\n  \/* flags to select datatypes *\/\n  GST_PAD_PROBE_TYPE_BUFFER           = (1 &lt;&lt; 4),\n  GST_PAD_PROBE_TYPE_BUFFER_LIST      = (1 &lt;&lt; 5),\n  GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 &lt;&lt; 6),\n  GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   = (1 &lt;&lt; 7),\n  GST_PAD_PROBE_TYPE_EVENT_FLUSH      = (1 &lt;&lt; 8),\n  GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 &lt;&lt; 9),\n  GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   = (1 &lt;&lt; 10),\n\n  \/* flags to select scheduling mode *\/\n  GST_PAD_PROBE_TYPE_PUSH             = (1 &lt;&lt; 12),\n  GST_PAD_PROBE_TYPE_PULL             = (1 &lt;&lt; 13),\n} GstPadProbeType;<\/code><\/pre>\n<p>\u5f53\u4ee5 IDLE \u6216 BLOCK \u6807\u5fd7\u6dfb\u52a0\u4e00\u4e2a\u63a2\u9488\uff0c \u8fd9\u4e2a\u63a2\u9488\u5c31\u4f1a\u53d8\u6210\u4e00\u4e2a\u963b\u585e\u63a2\u9488\uff0c \u5426\u5219\u8fd9\u4e2a\u63a2\u9488\u5c31\u4f1a\u53d8\u6210\u6570\u636e\u63a2\u9488 (DATA probe)<\/p>\n<p>\u6570\u636e\u7c7b\u578b\u548c\u8c03\u5ea6\u9009\u62e9\u5668\u6807\u5fd7 (scheduling selector flags)\u7528\u4e8e\u9009\u62e9\u56de\u8c03\u51fd\u6570\u4e2d\u6240\u5141\u8bb8\u7684\u6570\u636e\u7c7b\u578b\u548c\u8c03\u5ea6\u6a21\u5f0f\u3002<\/p>\n<p>\u963b\u585e\u6807\u5fd7\u5fc5\u987b\u4e0e\u89e6\u53d1\u7684\u63a2\u9488\u5b8c\u5168\u5339\u914d\u3002<\/p>\n<p>\u63a2\u9488\u56de\u8c03\u5b9a\u4e49\u5982\u4e0b:<\/p>\n<pre><code>GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,\n    gpointer user_data);<\/code><\/pre>\n<p>\u63a2\u6d4b\u4fe1\u606f\u7ed3\u6784 GstPadProbeInfo \u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\uff0c\u8981\u4fdd\u8bc1\u5176\u7c7b\u578b\u4e0e\u7528\u4e8e\u6ce8\u518c\u56de\u8c03\u7684\u63a9\u7801\u5339\u914d\u3002 GstPadProbeInfo \u4e2d\u7684\u6570\u636e\u9879\u5305\u542b\u7c7b\u578b\u7279\u5b9a\u7684\u6570\u636e\uff0c\u901a\u5e38\u662f\u88ab\u963b\u585e\u7684\u6570\u636e\u9879\uff0c\u6216\u8005\u5f53\u4e0d\u5b58\u5728\u6570\u636e\u9879\u65f6\u4e3aNULL\u3002<\/p>\n<p>\u63a2\u9488\u53ef\u8fd4\u56de\u4ee5\u4e0b\u8fd4\u56de\u7c7b\u578b<\/p>\n<pre><code>typedef enum\n{\n  GST_PAD_PROBE_DROP,\n  GST_PAD_PROBE_OK,\n  GST_PAD_PROBE_REMOVE,\n  GST_PAD_PROBE_PASS,\n  GST_PAD_PROBE_HANDLED\n} GstPadProbeReturn;<\/code><\/pre>\n<ul>\n<li>\n<p>GST_PAD_PROBE_OK \u662f\u901a\u5e38\u7684\u8fd4\u56de\u7c7b\u578b<\/p>\n<\/li>\n<li>\n<p>GST_PAD_PROBE_DROP \u5c06\u5220\u9664\u5f53\u524d\u6b63\u5728\u63a2\u6d4b\u7684\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>GST_PAD_PROBE_REMOVE\uff1a\u4ece\u63a2\u6d4b\u5668\u5217\u8868\u4e2d\u5220\u9664\u5f53\u524d\u6b63\u5728\u6267\u884c\u7684\u63a2\u9488\u3002<\/p>\n<\/li>\n<li>\n<p>GST_PAD_PROBE_PASS \u4e0e\u963b\u585e\u63a2\u9488\u76f8\u5173\uff0c\u4f1a\u6682\u65f6\u89e3\u9664\u5bf9 pad \u7684\u963b\u585e\u5e76\u8ba9\u6570\u636e\u901a\u8fc7\uff0c\u7136\u540e\u5b83\u5c06\u518d\u6b21\u963b\u585e\u4e0b\u4e00\u4e2a\u6570\u636e\u3002<\/p>\n<\/li>\n<\/ul>\n<h1>\u963b\u585e\u63a2\u9488<\/h1>\n<p>\u963b\u585e\u63a2\u9488\u662f\u8bbe\u7f6e\u4e86 BLOCK \u6216 IDLE \u6807\u5fd7\u7684\u63a2\u9488\u3002 \u5b83\u4eec\u603b\u662f\u4f1a\u6839\u636e\u4ee5\u4e0b\u89c4\u5219\u963b\u585e\u6570\u636e\u6d41\u5e76\u89e6\u53d1\u56de\u8c03\uff1a<\/p>\n<p>\u5f53\u8bbe\u7f6e IDLE \u6807\u5fd7\u65f6\uff0c\u4e00\u65e6\u6ca1\u6709\u6570\u636e\u6d41\u8fc7 pad\uff0c\u5c31\u4f1a\u8c03\u7528\u63a2\u9488\u7684\u56de\u8c03\u3002 \u5982\u679c\u5728\u63a2\u9488\u6ce8\u518c\u65f6\uff0cpad \u7a7a\u95f2\uff0c\u5219\u5c06\u4ece\u5f53\u524d\u7ebf\u7a0b\u7acb\u5373\u8c03\u7528\u56de\u8c03\u3002 \u5426\u5219\uff0c\u4e00\u65e6 pad \u5728\u6d41\u7ebf\u7a0b\u4e2d\u7a7a\u95f2\uff0c\u56de\u8c03\u5c31\u4f1a\u88ab\u8c03\u7528\u3002<\/p>\n<p>IDLE \u63a2\u9488\u5728\u6267\u884c\u52a8\u6001\u94fe\u63a5 dynamic linking \u65f6\u5f88\u6709\u7528\uff0c\u5b83\u5141\u8bb8\u5e94\u7528\u7a0b\u5e8f\u7b49\u5f85 \u94fe\u63a5\/\u53d6\u6d88\u94fe\u63a5\u64cd\u4f5c\u7684\u6b63\u786e\u6267\u884c\u3002 \u7531\u4e8e\u63a2\u9488\u662f\u963b\u585e\u63a2\u9488\uff0c\u56e0\u6b64\u5b83\u8fd8\u5c06\u786e\u4fdd pad \u4fdd\u6301\u7a7a\u95f2\u72b6\u6001\uff0c\u76f4\u5230\u63a2\u9488\u88ab\u79fb\u9664\u3002<\/p>\n<p>\u5f53\u8bbe\u7f6e\u4e86 BLOCK \u6807\u5fd7\u65f6\uff0c\u5f53\u65b0\u6570\u636e\u5230\u8fbe pad \u65f6\u4ee5\u53ca pad \u8fdb\u5165\u963b\u585e\u72b6\u6001\u4e4b\u524d\uff0c\u5c06\u8c03\u7528\u63a2\u9488\u7684\u56de\u8c03\u51fd\u6570\u3002 \u56e0\u6b64\uff0c\u4ec5\u5f53 pad \u4e0a\u6709\u65b0\u6570\u636e\u65f6\u624d\u4f1a\u8c03\u7528\u6b64\u56de\u8c03\u3002<\/p>\n<p>\u963b\u585e\u63a2\u9488\u53ef\u901a\u8fc7 <code>gst_pad_remove_probe()<\/code> \u79fb\u9664\uff0c\u6216\u8005\u5f53\u56de\u8c03\u51fd\u6570\u8fd4\u56de <code>GST_PAD_PROBE_REMOVE<\/code>. <\/p>\n<p>\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u8fd9\u662f pad \u4e0a\u6700\u540e\u4e00\u4e2a\u963b\u585e\u63a2\u9488\uff0c\u5219 pad \u5c06\u88ab\u89e3\u9501\u5e76\u4e14\u6570\u636e\u6d41\u53ef\u4ee5\u7ee7\u7eed\u3002<\/p>\n<h1>\u975e\u963b\u585e\u63a2\u9488<\/h1>\n<p>\u975e\u963b\u585e\u63a2\u9488\u6216\u6570\u636e\u63a2\u9488\u662f\u6570\u636e\u6d41\u8fc7 pad \u65f6\u89e6\u53d1\u7684\u63a2\u9488\u3002 \u5b83\u4eec\u5728\u963b\u585e\u63a2\u9488\u8fd0\u884c\u540e\u88ab\u8c03\u7528\uff0c\u5e76\u4e14\u59cb\u7ec8\u5e26\u6709\u6570\u636e\u3002<\/p>\n<h2>\u53c2\u8003\u8d44\u6599<\/h2>\n<ul>\n<li><a href=\"https:\/\/gstreamer.freedesktop.org\/documentation\/additional\/design\/probes.html?gi-language=c\">https:\/\/gstreamer.freedesktop.org\/documentation\/additional\/design\/probes.html?gi-language=c<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Probes \u63a2\u9488 Probes are callbacks that can be installed by the application and will notify the application about the states of the dataflow. \u63a2\u9488\u5c31\u662f\u4e00\u4e9b\u56de\u8c03\u51fd\u6570\uff0c\u5b83\u53ef\u4ee5\u88c5\u8f7d\u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u7531\u5e94\u7528\u7a0b\u5e8f\u56de\u8c03\u8fd9\u4e9b\u51fd\u6570\uff0c\u4ee5\u901a\u77e5\u6570\u636e\u6d41\u7684\u72b6\u6001\u4fe1\u606f\u3002 \u9700\u6c42 \u5e94\u7528\u7a0b\u5e8f\u5e94\u8be5\u80fd\u591f\u76d1\u89c6\u548c\u63a7\u5236 pads \u4e0a\u7684\u6570\u636e\u6d41\u3002 \u6709\u4ee5\u4e0b\u9700\u6c42\uff1a \u5f53 pad \u7a7a\u95f2\u65f6\u6536\u5230\u901a\u77e5\uff0c\u5e76\u786e\u4fdd pad \u4fdd\u6301\u7a7a\u95f2\u72b6\u6001\u3002 \u8fd9\u5bf9\u4e8e\u80fd\u591f\u5728\u4e0d\u7834\u574f\u6570\u636e\u6d41\u7684\u60c5\u51b5\u4e0b\u5b9e\u73b0\u5143\u7d20\u7684\u52a8\u6001\u91cd\u65b0\u94fe\u63a5\u81f3\u5173\u91cd\u8981\u3002 \u5f53\u6570\u636e\u3001\u4e8b\u4ef6 event \u6216\u67e5\u8be2 query \u5728 pad \u4e0a\u63a8\u9001\u6216\u53d1\u9001\u65f6\u6536\u5230\u901a\u77e5\u3002 \u8fd8\u5e94\u8be5\u53ef\u4ee5\u68c0\u67e5\u548c\u4fee\u6539\u6570\u636e\u3002 \u80fd\u591f\u6839\u636e\u56de\u8c03\u7684\u7ed3\u679c\u4e22\u5f03 drop\u3001\u4f20\u9012 pass \u548c\u963b\u585e block \u6570\u636e\u3002 \u80fd\u591f\u6839\u636e\u5e94\u7528\u7a0b\u5e8f\u7ebf\u7a0b\u6267\u884c\u7684\u65b9\u6cd5\u5728\u963b\u585e\u7684 pad \u4e0a\u4e22\u5f03\u6216\u4f20\u9012\u6570\u636e\u3002 \u6982\u8ff0 \u51fd\u6570 gst_pad_add_probe() [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1124\" title=\"Permanent Link to: \u63a2\u9488\u8ba9\u4f60\u660e\u5bdf\u79cb\u8c6a\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1124","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1124"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1124"}],"version-history":[{"count":9,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1124\/revisions"}],"predecessor-version":[{"id":1133,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1124\/revisions\/1133"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}