{"id":289,"date":"2022-01-31T16:56:36","date_gmt":"2022-01-31T08:56:36","guid":{"rendered":"http:\/\/192.168.0.122:8088\/?p=289"},"modified":"2022-06-11T03:20:05","modified_gmt":"2022-06-10T19:20:05","slug":"ffmpeg%e6%ba%90%e7%a0%81%e5%88%86%e6%9e%90-parse_optgroup","status":"publish","type":"post","link":"https:\/\/www.xianwaizhiyin.net\/?p=289","title":{"rendered":"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup"},"content":{"rendered":"\n<p>\u672c\u7cfb\u5217 \u4ee5 ffmpeg4.2 \u6e90\u7801\u4e3a\u51c6\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a\u94fe\u63a5\uff1a<a href=\"https:\/\/pan.baidu.com\/s\/1VpUvpLhew-nuq4Dns80mOw\">\u767e\u5ea6\u7f51\u76d8<\/a> \u63d0\u53d6\u7801\uff1ag3k8<\/p>\n\n\n\n<p>ffmpeg \u6e90\u7801\u5206\u6790\u7cfb\u5217\u4ee5\u4e00\u6761\u7b80\u5355\u7684\u547d\u4ee4\u5f00\u59cb\uff0c<code class=\"prettyprint\" >ffmpeg -i a.mp4 b.flv<\/code>\uff0c\u5206\u6790\u5176\u5185\u90e8\u903b\u8f91\u3002<\/p>\n\n\n\n<p>a.mp4\u4e0b\u8f7d\u94fe\u63a5\uff1a<a href=\"https:\/\/pan.baidu.com\/s\/1RN1xRsQDGx65MGyB_T1IzA\">\u767e\u5ea6\u7f51\u76d8<\/a>\uff0c\u63d0\u53d6\u7801\uff1anl0s \u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u672c\u6587\u4e3b\u8981\u5206\u6790 <code class=\"prettyprint\" >parse_optgroup()<\/code> \u7684\u5185\u90e8\u903b\u8f91\uff0c\u51fd\u6570\u8c03\u7528\u7528\u6d41\u7a0b\u56fe\u5982\u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1656\" height=\"382\" src=\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png\" alt=\"\" class=\"wp-image-292\"\/><\/figure>\n\n\n\n<p><code class=\"prettyprint\" >parse_optgroup(void *optctx, OptionGroup *g)<\/code> \u8fd9\u4e2a\u51fd\u6570\u7684 <code>optgroup<\/code> \u5176\u5b9e\u662f <code>OptionGroup<\/code> \u7684\u7f29\u5199\u3002\u770b\u51fd\u6570\u540d\u5b57\u8ddf\u5f62\u53c2\uff0c\u5c31\u77e5\u9053\u8fd9\u4e2a\u51fd\u6570\u5e72\u7684\u6d3b\u5c31\u662f\u628a<code>OptionGroup<\/code> \u89e3\u6790\u7ed9 <code>optctx<\/code>\u3002\u8fd9\u91cc\u7684 <code>optctx<\/code> \u662f\u4e00\u4e2a\u65b0\u7684\u7ed3\u6784\u4f53 <code>OptionsContext<\/code>\uff0c\u4e4b\u524d\u6ca1\u6709\u4ecb\u7ecd\u8fc7\u3002<\/p>\n\n\n\n<p>\u90a3 <code class=\"prettyprint\" >OptionGroup *g<\/code> \u662f\u4ece\u54ea\u91cc\u6765\u7684\u5462\uff1f\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5168\u90e8\u90fd\u5728<code>OptionParseContext octx<\/code> \u8fd9\u4e2a\u53d8\u91cf\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1045\" height=\"666\" src=\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-2.png\" alt=\"\" class=\"wp-image-293\"\/><\/figure>\n\n\n\n<p>\u5982\u524d\u9762\u4e00\u7ae0\u6240\u8bf4\uff0c<code class=\"prettyprint\" >split_commandline()<\/code> \u5df2\u7ecf\u628a cli \u547d\u4ee4\u884c\u53c2\u6570\u5168\u5c40\u89e3\u6790 \u5230 <code>OptionParseContext octx<\/code> \u8fd9\u4e2a\u53d8\u91cf\u4e86\u3002<\/p>\n\n\n\n<p><code class=\"prettyprint\" >OptionGroup<\/code> \u5176\u5b9e\u662f\u6709\u591a\u4e2a\u7684\uff0c\u5206\u522b\u5b58\u653e\u5728 <code>octx<\/code> \u76843\u4e2a\u5730\u65b9\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code class=\"prettyprint\" >octx.global_opts<\/code> \uff0c\u5b58\u653e\u5168\u5c40\u53c2\u6570\u7684 <code>OptionGroup<\/code>\u3002<\/li><li><code>octx.groups[1]-&gt;groups[0]<\/code> \uff0c \u8fd9\u91cc\u4e5f\u662f <code>OptionGroup<\/code>\uff0c\u5b58\u653e\u7684\u662f\u8f93\u5165\u6587\u4ef6\u7684 <code>OptionGroup<\/code>\uff0c<code>octx.groups[1]-&gt;nb_groups<\/code> \u4ee3\u8868\u6709\u591a\u5c11\u4e2a <code>OptionGroup<\/code>\uff0c\u4e4b\u524d\u8bf4\u8fc7\uff0c\u4e00\u4e2a\u8f93\u5165\u6216\u8f93\u51fa\u6587\u4ef6\uff0c\u5bf9\u5e94\u4e00\u4e2a <code>OptionGroup<\/code>\u3002<\/li><li><code>octx.groups[0]-&gt;groups[0]<\/code> \uff0c\u8f93\u51fa\u6587\u4ef6 <code>OptionGroup<\/code> \uff0c\u4e0e\u8f93\u5165\u540c\u7406\u3002<\/li><\/ol>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5206\u6790 <code class=\"prettyprint\" >parse_optgroup()<\/code> \u662f\u5982\u4f55\u628a <code>octx<\/code> \u91cc\u9762\u90a3\u4e48\u591a <code>OptionGroup<\/code> \u4e00\u4e2a\u4e00\u4e2a\u89e3\u6790\u7ed9 <code>OptionsContext<\/code> \u7684\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>ffmpeg_opt.c:3309\u884c\uff0c\u89e3\u6790\u5168\u5c40\u53d8\u91cf\uff0c<code class=\"prettyprint\" >parse_optgroup(NULL, &amp;octx.global_opts)<\/code> \u8fd9\u91cc\u662f\u4e2a\u4f8b\u5916\uff0c\u6ca1\u6709\u4f20\u9012 <code>OptionsContext<\/code>\uff0c\u6240\u4ee5\u4f1a\u628a <code>octx.global_opt<\/code> \u89e3\u6790\u5230\u5168\u5c40\u53d8\u91cf\uff0c\u770b <code>parse_optgroup<\/code> \u7684\u4ee3\u7801\u5b9e\u73b0\u5c31\u77e5\u9053\u4e86\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u5728 <code>write_option()<\/code>\uff0c\u8fd9\u4e2a\u7a0d\u540e\u5206\u6790\u3002<\/li><li>ffmpeg_opt.c:3319\u884c\uff0c\u5229\u7528 <code>open_files()<\/code> \u51fd\u6570\u89e3\u6790\u8f93\u5165\u6587\u4ef6\u7684 <code>OptionGroup<\/code>\uff0c<code>open_files()<\/code> \u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f <code>OptionGroupList<\/code> \uff0c\u662f\u8f93\u5165\u6587\u4ef6\u7684 <code>OptionGroup<\/code> \u96c6\u5408\u3002\u5982\u679c\u67093\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c<code>OptionGroupList-&gt;nb_groups<\/code> \u5c31\u662f3\uff0c\u901a\u8fc7\u904d\u5386 <code>OptionGroupList-&gt;nb_groups<\/code> \uff0c\u4e0d\u65ad\u8c03\u7528<code>parse_optgroup()<\/code>\u628a\u5404\u4e2a\u8f93\u5165\u6587\u4ef6\u7684 <code>OptionGroup<\/code> \u89e3\u6790\u5230 <code>OptionsContext<\/code>\u3002<\/li><li>fmpeg_opt.c:3333\u884c\uff0c\u4e5f\u662f\u8c03 <code>open_files()<\/code>\uff0c\u4e0d\u8fc7\u8fd9\u91cc\u5904\u7406\u7684\u662f\u8f93\u51fa\u6587\u4ef6\u7684 <code>OptionGroup<\/code>\uff0c\u8ddf\u7b2c\u4e8c\u70b9\u539f\u7406\u4e00\u6837\u3002<\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>google_ads_content<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u7531\u6b64\u53ef\u89c1 <code class=\"prettyprint\" >parse_optgroup()<\/code> \u4e3b\u8981\u505a\u4e24\u4ef6\u4e8b\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u89e3\u6790 <code class=\"prettyprint\" >OptionGroup<\/code> \u7ed3\u6784\u5230\u5168\u5c40\u53d8\u91cf\uff0c\u8fd9\u4e2a\u4e0d\u7528\u8bf4\u4e86\uff0c\u81ea\u5df1\u5728\u4ee3\u7801\u91cc\u641c\u4e00\u4e0b\u5168\u5c40\u53d8\u91cf\uff0c\u5c31\u77e5\u9053\u67d0\u4e9b\u5168\u5c40\u53d8\u91cf\u5728\u54ea\u91cc\u7528\u5230\u3002<\/li><li>\u8f6c\u6362 <code>OptionGroup<\/code> \u7ed3\u6784\u6210 <code>OptionsContext<\/code>\uff0c\u8fd9\u4e2a <code>OptionsContext<\/code> \u4e5f\u662f\u5bf9\u5e94\u4e00\u4e2a\u8f93\u5165\u6587\u4ef6\u6216\u8005\u8f93\u51fa\u6587\u4ef6\u3002\u4e00\u4e2a\u8f93\u5165\u6587\u4ef6\u7684\u53c2\u6570\uff0c\u547d\u4ee4\u884c <code>-i<\/code> \u524d\u9762\u7684\u8fd9\u4e9b <code>-vcodec<\/code>\uff0c<code>-itsoffset<\/code> \u7b49\u7b49\u53c2\u6570\uff0c\u6700\u540e\u90fd\u4f1a\u5b58\u5230 <code>OptionsContext<\/code> \u91cc\u3002<\/li><\/ol>\n\n\n\n<p>\u8981\u7406\u89e3 <code class=\"prettyprint\" >parse_optgroup()<\/code> \u7684\u5185\u90e8\u903b\u8f91 \u5c31\u9700\u8981\u7406\u89e3 <code>OptionsContext<\/code> \u8fd9\u4e2a\u7ed3\u6784\uff0c\u8fd8\u6709\u5185\u90e8\u7684 <code>write_option()<\/code> \u51fd\u6570\u3002<\/p>\n\n\n\n<p>\u6211\u753b\u4e86\u4e2a\u56fe\uff0c<code class=\"prettyprint\" >OptionsContext<\/code> \u8fd9\u4e2a\u7ed3\u6784 \u592a\u5927\u4e86\uff0c\u4f1a\u7701\u7565\u67d0\u4e00\u90e8\u5206\u6210\u5458\u53c2\u6570\uff0c\u539f\u7406\u662f\u4e00\u6837\u7684\uff0c\u8bf7\u770b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"570\" src=\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-3.png\" alt=\"\" class=\"wp-image-294\"\/><\/figure>\n\n\n\n<p>\u636e\u672c\u4eba\u7edf\u8ba1\uff0c<code class=\"prettyprint\" >OptionsContext<\/code> \u91cc\u9762\u7684\u6210\u5458\u53c2\u6570\u670950\u4e2a\u4ee5\u4e0a\uff0c\u975e\u5e38\u5e9e\u5927\u3002\u4f46\u5176\u5b9e\uff0c\u4ed6\u7684\u6210\u5458\u53c2\u6570\u5c31\u53ea\u67093\u79cd\u7c7b\u578b\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code class=\"prettyprint\" >OptionGroup *g<\/code>\uff0c\u8fd9\u91cc\u4e5f\u6709 <code>OptionGroup<\/code>\uff0c<code>OptionsContext<\/code>\u7684<code>OptionGroup<\/code> \u662f\u76f4\u63a5\u62f7\u8d1d\u4f20\u9012\u8fdb\u6765\u7684 <code>OptionGroup<\/code>\uff0c\u4ee3\u7801\u5728 <code>ffmpeg_opt.c:3269<\/code> \u884c\uff0c<code>o.g = g;<\/code><\/li><li>\u5e38\u89c4\u7c7b\u578b\uff0c<code>int<\/code>\uff0c<code>int64_t<\/code>\uff0c<code>cha*<\/code> \u7b49\u7b49C\u8bed\u8a00\u7684\u7c7b\u578b\u3002<\/li><li><code>SpecifierOpt<\/code>\uff0c\u8fd9\u4e2a\u7c7b\u578b\u7279\u522b\u91cd\u8981\uff0c\u4e0d\u8fc7\u53ea\u6709\u4e24\u4e2a\u6210\u5458\u53c2\u6570\u3002char *specifier \u901a\u5e38\u662f 'a','v',''\uff0c\u4ee3\u8868\u8fd9\u662f\u4e00\u4e2a\u89c6\u9891\u6216\u97f3\u9891\uff0c\u6216\u8005\u4e0d\u533a\u5206\u97f3\u89c6\u9891\u7684\u53c2\u6570\u3002\u540e\u9762\u7684 <code>union str<\/code> \u662f\u4e00\u4e2a\u8054\u5408\u4f53\uff0c\u53ef\u4ee5\u662f \u5b57\u7b26\u4e32\uff0cint\uff0c\u6d6e\u70b9\u6570\u3002\u6ce8\u610f\uff0c\u6bcf\u4e00\u4e2a <code>SpecifierOpt xxx<\/code> \u540e\u9762\u90fd\u6709\u4e00\u4e2a <code>SpecifierOpt nb_xxx<\/code>\uff0c\u4ee3\u8868\u6709\u591a\u5c11\u4e2a<code>SpecifierOpt<\/code>\u3002\u4f8b\u5982 nb_codec_names \u7b49\u4e8e2\uff0c\u5c31\u4ee3\u8868\u6709\u4e24\u4e2a codec\uff0c\u5206\u522b\u662f <code>codec_names[0]<\/code> \u548c <code>codec_names[1]<\/code>\u3002\u867d\u7136\u4e00\u4e2a\u8f93\u5165\u6587\u4ef6\u901a\u5e38\u53ea\u4f1a\u6307\u5b9a\u4e00\u4e2a\u89e3\u7801\u5668\uff0c\u4f46 <code>ffmpeg<\/code> \u4e3a\u4e86\u901a\u7528\u6027\uff0c\u6bcf\u4e2a <code>SpecifierOpt<\/code>\u540e\u9762\u90fd\u4f1a\u6709\u4e00\u4e2a\u6570\u91cf\u53c2\u6570 <code>nb_xxx<\/code>\u3002<\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><code class=\"prettyprint\" >OptionsContext<\/code>\u5df2\u7ecf\u5206\u6790\u5b8c\u4e86\uff0c\u63a5\u4e0b\u6765\u8bb2\u8bb2 <code>write_option()<\/code> \u8fd9\u4e2a\u51fd\u6570\u7684\u5185\u90e8\u903b\u8f91\u3002<\/p>\n\n\n\n<p><code class=\"prettyprint\" >write_option()<\/code> \u7684\u8c03\u7528\u5728 cmdutils.c:437\u884c\uff0c<code>write_option(optctx, o-&gt;opt, o-&gt;key, o-&gt;val)<\/code>\u3002<\/p>\n\n\n\n<p><code class=\"prettyprint\" >write_option()<\/code> \u662f <code>parse_optgroup()<\/code> \u7684\u5185\u90e8\u51fd\u6570\uff0c\u4ece cmdutils.c:437\u884c \u7684\u4f20\u53c2\u53ef\u4ee5\u770b\u51fa\uff0c<code>parse_optgroup()<\/code> \u4e0d\u65ad\u904d\u5386 <code>OptionGroup::opts<\/code> \uff0c<\/p>\n\n\n\n<p>\u628a <code class=\"prettyprint\" >Option<\/code> \u4f20\u9012\u7ed9 <code>write_option()<\/code>\uff0c\u5199\u5230 <code>optctx<\/code> \u91cc\u9762\u3002<\/p>\n\n\n\n<p><code class=\"prettyprint\" >write_option()<\/code> \u7684\u5185\u90e8\u903b\u8f91\u76f8\u5bf9\u590d\u6742\uff0c\u8bf7\u7ed3\u5408\u6e90\u7801\u770b\u672c\u6587\u7ae0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"633\" height=\"156\" src=\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-4.png\" alt=\"\" class=\"wp-image-290\"\/><\/figure>\n\n\n\n<p>\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u7b2c\u4e00\u884c\u4ee3\u7801\u5c31\u662f\u521d\u6b65\u786e\u5b9a <code class=\"prettyprint\" >dst<\/code> \uff0c\u4e3a\u4ec0\u4e48\u8bf4\u662f\u521d\u6b65\uff0c\u56e0\u4e3a <code>dst<\/code> \u5728\u540e\u9762\u6709\u53ef\u80fd\u4f1a\u53d8\u5316\u3002\u7406\u89e3 <code>write_option()<\/code> \u9700\u8981\u5148\u89e3\u91ca\u4e00\u4e0b <code>OptionDef<\/code>\u8fd9\u4e2a\u7ed3\u6784\u7684\u4e00\u4e9b\u5e38\u89c1\u503c\u3002<\/p>\n\n\n\n<p>\u5728 <code class=\"prettyprint\" >ffmpeg_opt.c:3368<\/code>\u884c\u5b9a\u4e49\u4e86\u4e00\u4e2a <code>OptionDef<\/code>\u7684\u6570\u7ec4\u3002\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"235\" src=\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-5.png\" alt=\"\" class=\"wp-image-291\"\/><\/figure>\n\n\n\n<p><code class=\"prettyprint\" >OptionDef<\/code> \u67095\u4e2a\u6210\u5458 <code>char *name<\/code>\uff0c<code>int flags<\/code>, <code>union:u<\/code>\uff0c<code>char *help<\/code>\uff0c<code>char *argname<\/code>\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code class=\"prettyprint\" >char *name<\/code> \u5bf9\u5e94\u547d\u4ee4\u884c\u4e2d\u7684 <code>-xxx<\/code> \u7684 <code>xxx<\/code>\u3002<\/li><li><code>int flags<\/code> \uff0cflag\u503c\u7684\u4ecb\u7ecd\u5982\u4e0b\uff1a<ul><li><strong>HAS_ARG<\/strong> \uff1a\u4ee3\u8868\u8fd9\u4e2a<code>Option<\/code>\u5fc5\u987b\u6709value\uff0c\u5c31\u662f <code>-xxx<\/code> \u540e\u9762\u5fc5\u987b\u8fd8\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32\u53c2\u6570 \u4f8b\u5982 <code>-xxx yyy<\/code> \u5982\u679c\u6ca1\u6709 <code>yyy<\/code> \u5c31\u4f1a\u62a5\u9519\uff0c\u5177\u4f53\u4ee3\u7801\u5728 <code>cmd_utils.c:809<\/code>\u884c\u3002<\/li><li><strong>OPT_INT<\/strong> \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2a INT\uff0c\u4f1a\u628a \u4f20\u9012\u8fdb <code>write_option()<\/code> \u7684<code>Option::val<\/code> \u8f6c\u6362\u6210 <code>int<\/code> \u8d4b\u503c\u7ed9 <code>dst<\/code> \u3002\u8fd9\u4e2a\u65f6\u5019 <code>dst<\/code> \u6307\u5411\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf\uff0c\u6216\u8005 <code>OptionsContext<\/code> \u91cc\u9762\u7684\u67d0\u4e2a <code>int<\/code> \u6210\u5458\u3002<\/li><li>OPT_BOOL \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2aBOOL\uff0cC\u8bed\u8a00\u6ca1\u6709\u5e03\u5c14\uff0c\u7b49\u503c\u4e8e OPT_INT\uff0c <code>dst<\/code> \u88ab\u8bbe\u7f6e\u62100\u62161\u3002<\/li><li>OPT_FLOAT \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2a \u6d6e\u70b9\u6570\uff0c\u8ddfOPT_INT \u539f\u7406\u4e00\u6837<\/li><li>OPT_STRING \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2a char * , \u8ddfOPT_INT \u539f\u7406\u4e00\u6837\u3002<\/li><li>OPT_INT64 \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2a INT64 , \u8ddfOPT_INT \u539f\u7406\u4e00\u6837\u3002<\/li><li>OPT_DOUBLE\uff1a\u4ee3\u8868 <code>dst<\/code> \u662f\u4e00\u4e2a Double , \u8ddfOPT_INT \u539f\u7406\u4e00\u6837\u3002<\/li><li>OPT_EXIT : <code>write_option()<\/code> \u91cc\u9762\u5904\u7406\u5b8c\u8fd9\u4e2a\u6807\u5fd7\u7684 <code>Option<\/code> \u5c31\u9000\u51fa\u7a0b\u5e8f\uff0c\u5177\u4f53\u4ee3\u7801\u5728<code>cmd_utils.c:344<\/code>\u884c<\/li><li><strong>OPT_OFFSET<\/strong> \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f <code>OptionsContext<\/code> \u91cc\u9762\u7684 int float \u7b49\u666e\u901a\u6210\u5458\uff0c\u5177\u4f53\u662f\u54ea\u4e2a\u6210\u5458\uff0c\u901a\u8fc7 <code>u.off<\/code> \u504f\u79fb\u53d6\u5f97\u5730\u5740\uff0c<code>(uint8_t *)optctx + po-&gt;u.off<\/code><\/li><li><strong>OPT_SPEC<\/strong> \uff1a\u4ee3\u8868 <code>dst<\/code> \u662f <code>OptionsContext<\/code> \u91cc\u9762\u7684 <code>SpecifierOpt<\/code> \u6210\u5458\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u6570\u7ec4\uff0cdst \u4f1a\u6307\u5411\u6570\u7ec4\u7684\u67d0\u4e2a\u4e0b\u6807\u5730\u5740\u3002<\/li><li>OPT_TIME \uff1a\u4ee3\u8868\u4f20\u9012\u8fdb <code>write_option()<\/code> \u7684 <code>Option::val<\/code> \u662f\u4e00\u4e2a\u65f6\u95f4\u5b57\u7b26\u4e32 \"01:00\" \u4e4b\u7c7b\u7684\u3002\u4f1a\u8c03\u7528 <code>parse_time_or_die()<\/code> \u8f6c\u6362\u8fd9\u4e2a\u5b57\u7b26\u4e32\u6210Int64\uff0c\u7136\u540e \u8d4b\u503c\u7ed9<code>dst<\/code> \u3002OPT_INPUT<\/li><li>OPT_INPUT \uff1a\u4ee3\u8868\u6b64\u547d\u4ee4\u884c\u53c2\u6570\u662f\u8f93\u5165\u53c2\u6570\uff0c\u53ea\u80fd\u5728 <code>-i<\/code> \u524d\u9762\u51fa\u73b0\uff0c\u4e0d\u80fd\u5728 <code>-i<\/code> \u540e\u9762\u51fa\u73b0\u3002\u5982\u679c\u51fa\u73b0\u4f1a\u62a5\u9519\uff0c<code>cmd_utils.c:424<\/code>\u884c<\/li><li>OPT_OUTPUT \uff1a\u4ee3\u8868\u6b64\u547d\u4ee4\u884c\u53c2\u6570\u662f\u8f93\u51fa\u53c2\u6570\uff0c\u53ea\u80fd\u5728\u8f93\u51fa\u6587\u4ef6\u540d\u524d\u9762\u51fa\u73b0\uff0c\u4e0d\u80fd\u5728\u540e\u9762\u51fa\u73b0\u3002\u5982\u679c\u51fa\u73b0\u4f1a\u62a5\u9519\uff0c<code>cmd_utils.c:424<\/code>\u884c<\/li><li><strong>OPT_VIDEO<\/strong> \uff1a\u89c6\u9891\u6807\u793a\uff0c\u53ea\u662f\u4e00\u4e2a\u6807\u793a\uff0c\u53ef\u4ee5\u5728 show_help \u7684\u65f6\u5019\u6307\u5b9a flags \u4e3a OPT_VIDEO \uff0c\u53ea\u663e\u793a\u89c6\u9891\u76f8\u5173\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002<\/li><li>OPT_AUDIO \uff1a\u97f3\u9891\u6807\u793a\uff0c\u540cOPT_VIDEO \u3002<\/li><li>OPT_SUBTITLE \uff1a\u5b57\u5e55\u6807\u793a\uff0c\u540cOPT_VIDEO \u3002<\/li><li>OPT_DATA \uff1a\u6570\u636e\u6807\u793a\uff0c\u540cOPT_VIDEO \u3002<\/li><li>OPT_EXPERT \uff1a\u4e13\u5bb6\u6807\u793a\uff0c\u540cOPT_VIDEO \u3002<\/li><li>OPT_PERFILE \uff1a\u4e0d\u77e5\u9053\u5e72\u561b\u7684\u3002<\/li><\/ul><\/li><li><code>union:u<\/code>\uff0cu \u662f\u4e00\u4e2a\u8054\u5408\u4f53\uff0c\u5206\u522b\u6709 <code>void *dst_ptr<\/code> \uff0c<code>int (*func_arg){..}<\/code>\uff0c<code>size_t off<\/code><ul><li><code>void *dst_ptr<\/code> \uff1a\u8bbe\u7f6e\u4e86\u5c31\u4ee3\u8868 u \u6307\u5411\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf\u3002<\/li><li><code>int (*func_arg){..}<\/code> \uff1a\u8bbe\u7f6e\u4e86\u5c31\u4ee3\u8868 u \u6307\u5411 \u4e00\u4e2a\u51fd\u6570\u6307\u9488\uff0c<code>write_option()<\/code> \u91cc\u4f1a\u8c03\u7528\u6307\u5411\u7684\u90a3\u4e2a\u51fd\u6570<\/li><li><code>size_t off<\/code> \uff1a\u4ee3\u8868 <code>OptionsContext<\/code> \u7684OFFSET\uff0c\u7528\u6765\u786e\u5b9a <code>dst<\/code> \u8981\u6307\u5411 <code>OptionsContext<\/code>\u7684\u54ea\u4e2a\u6210\u5458\u53c2\u6570,<code>(uint8_t *)optctx + po-&gt;u.off<\/code>\u3002<\/li><\/ul><\/li><li><code>char *help<\/code>\uff0c\u547d\u4ee4\u884c\u53c2\u6570help\u3002<\/li><li><code>char *argname<\/code>\uff0c\u4e5f\u662fhelp\u7684\u65f6\u5019\u7528\u7684\u3002<\/li><\/ol>\n\n\n\n<p>\u81f3\u6b64\uff0c<code class=\"prettyprint\" >write_option()<\/code>\u4e5f\u5df2\u7ecf\u5206\u6790\u5b8c\u6bd5\u3002<code>FFmpeg<\/code> \u547d\u4ee4\u884c\u89e3\u6790\u6d41\u7a0b\u5206\u6790\u5df2\u7ecf\u5b8c\u6210\u4e00\u5927\u534a\uff0c\u6700\u540e\u505a\u4e0b\u5c0f\u603b\u7ed3\u3002<\/p>\n\n\n\n<p>\u4ece <code class=\"prettyprint\" >main()<\/code> \u5165\u53e3\u5f00\u59cb\uff0c\u5230 <code>split_command()<\/code> \u628a <code>argv<\/code> \u6240\u6709\u547d\u4ee4\u884c\u53c2\u6570\u8f6c\u6362\u6210 <code>OptionParseContext<\/code>\uff0c\u518d\u5230 <code>parse_optgroup(NULL, &amp;octx.global_opts)<\/code> \u628a<code>OptionParseContext::global_opts<\/code> \u89e3\u6790\u7ed9 \u5168\u5c40\u53d8\u91cf\u3002\u518d\u5230 <code>open_file()<\/code> \u6253\u5f00\u8f93\u5165\/\u8f93\u51fa\u6587\u4ef6\uff0c\u7136\u540e\u628a\u6bcf\u4e2a\u8f93\u5165\/\u8f93\u51fa\u6587\u4ef6\u7684\u4e13\u5c5e <code>OptionGroup<\/code> \u8f6c\u6362\u6210 <code>OptionsContext<\/code>\uff0c\u7136\u540e\u518d\u628a <code>OptionsContext<\/code>\u4e22\u7ed9 <code>open_input_file()<\/code> \u6216 <code>open_output_file()<\/code>\u3002<\/p>\n\n\n\n<p>\u4e0b\u4e00\u7ae0 \u4f1a\u4ecb\u7ecd <code class=\"prettyprint\" >open_input_file()<\/code> \u8ddf <code>open_output_file()<\/code>\u7684\u5185\u90e8\u5b9e\u73b0\u3002\u672c\u6587\u4ecb\u7ecd\u7684 <code>OptionGroup<\/code> \u5982\u4f55\u8f6c\u6210\u5168\u5c40\u53d8\u91cf\u8ddf <code>OptionsContext<\/code> \u5df2\u7ecf\u7ed3\u675f\u4e86\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u00a9\u7248\u6743\u6240\u5c5e\uff1a\u77e5\u8bc6\u661f\u7403\uff1a\u5f26\u5916\u4e4b\u97f3\uff0cQQ\uff1a2338195090\u3002<\/p>\n\n\n\n<p>\u7531\u4e8e\u7b14\u8005\u7684\u6c34\u5e73\u6709\u9650\uff0c \u52a0\u4e4b\u7f16\u5199\u7684\u540c\u65f6\u8fd8\u8981\u53c2\u4e0e\u5f00\u53d1\u5de5\u4f5c\uff0c\u6587\u4e2d\u96be\u514d\u4f1a\u51fa\u73b0\u4e00\u4e9b\u9519\u8bef\u6216\u8005\u4e0d\u51c6\u786e\u7684\u5730\u65b9\uff0c\u6073\u8bf7\u8bfb\u8005\u6279\u8bc4\u6307\u6b63\u3002\u5982\u679c\u8bfb\u8005\u6709\u4efb\u4f55\u5b9d\u8d35\u610f\u89c1\uff0c\u53ef\u4ee5\u52a0\u6211\u5fae\u4fe1 Loken1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7cfb\u5217 \u4ee5 ffmpeg4.2 \u6e90\u7801\u4e3a\u51c6\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a\u94fe\u63a5\uff1a\u767e\u5ea6\u7f51\u76d8 \u63d0\u53d6\u7801\uff1ag3k8 ffmpeg \u6e90\u7801\u5206\u6790\u7cfb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,14],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-ffmpeg","category-ffmpeg-canshu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.xianwaizhiyin.net\/?p=289\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u7cfb\u5217 \u4ee5 ffmpeg4.2 \u6e90\u7801\u4e3a\u51c6\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a\u94fe\u63a5\uff1a\u767e\u5ea6\u7f51\u76d8 \u63d0\u53d6\u7801\uff1ag3k8 ffmpeg \u6e90\u7801\u5206\u6790\u7cfb [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.xianwaizhiyin.net\/?p=289\" \/>\n<meta property=\"og:site_name\" content=\"\u5f26\u5916\u4e4b\u97f3\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-31T08:56:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-10T19:20:05+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/.\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"loken\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#website\",\"url\":\"https:\/\/www.xianwaizhiyin.net\/\",\"name\":\"\u5f26\u5916\u4e4b\u97f3\",\"description\":\"FFmpeg\u3001WebRTC\uff0cSRS \u97f3\u89c6\u9891\u3001\u6d41\u5a92\u4f53\u6280\u672f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.xianwaizhiyin.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=289#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png\",\"contentUrl\":\".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=289#webpage\",\"url\":\"https:\/\/www.xianwaizhiyin.net\/?p=289\",\"name\":\"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3\",\"isPartOf\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=289#primaryimage\"},\"datePublished\":\"2022-01-31T08:56:36+00:00\",\"dateModified\":\"2022-06-10T19:20:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=289#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.xianwaizhiyin.net\/?p=289\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=289#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.xianwaizhiyin.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3\",\"name\":\"loken\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#personlogo\",\"inLanguage\":\"zh-Hans\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g\",\"caption\":\"loken\"},\"sameAs\":[\"https:\/\/www.xianwaizhiyin.net\/\"],\"url\":\"https:\/\/www.xianwaizhiyin.net\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.xianwaizhiyin.net\/?p=289","og_locale":"zh_CN","og_type":"article","og_title":"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3","og_description":"\u672c\u7cfb\u5217 \u4ee5 ffmpeg4.2 \u6e90\u7801\u4e3a\u51c6\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a\u94fe\u63a5\uff1a\u767e\u5ea6\u7f51\u76d8 \u63d0\u53d6\u7801\uff1ag3k8 ffmpeg \u6e90\u7801\u5206\u6790\u7cfb [&hellip;]","og_url":"https:\/\/www.xianwaizhiyin.net\/?p=289","og_site_name":"\u5f26\u5916\u4e4b\u97f3","article_published_time":"2022-01-31T08:56:36+00:00","article_modified_time":"2022-06-10T19:20:05+00:00","og_image":[{"url":".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"loken","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.xianwaizhiyin.net\/#website","url":"https:\/\/www.xianwaizhiyin.net\/","name":"\u5f26\u5916\u4e4b\u97f3","description":"FFmpeg\u3001WebRTC\uff0cSRS \u97f3\u89c6\u9891\u3001\u6d41\u5a92\u4f53\u6280\u672f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.xianwaizhiyin.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"ImageObject","@id":"https:\/\/www.xianwaizhiyin.net\/?p=289#primaryimage","inLanguage":"zh-Hans","url":".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png","contentUrl":".\/wp-content\/uploads\/2022\/01\/ffmpeg_c-2-1.png"},{"@type":"WebPage","@id":"https:\/\/www.xianwaizhiyin.net\/?p=289#webpage","url":"https:\/\/www.xianwaizhiyin.net\/?p=289","name":"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup - \u5f26\u5916\u4e4b\u97f3","isPartOf":{"@id":"https:\/\/www.xianwaizhiyin.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.xianwaizhiyin.net\/?p=289#primaryimage"},"datePublished":"2022-01-31T08:56:36+00:00","dateModified":"2022-06-10T19:20:05+00:00","author":{"@id":"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3"},"breadcrumb":{"@id":"https:\/\/www.xianwaizhiyin.net\/?p=289#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.xianwaizhiyin.net\/?p=289"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.xianwaizhiyin.net\/?p=289#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.xianwaizhiyin.net\/"},{"@type":"ListItem","position":2,"name":"ffmpeg\u6e90\u7801\u5206\u6790-parse_optgroup"}]},{"@type":"Person","@id":"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3","name":"loken","image":{"@type":"ImageObject","@id":"https:\/\/www.xianwaizhiyin.net\/#personlogo","inLanguage":"zh-Hans","url":"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g","caption":"loken"},"sameAs":["https:\/\/www.xianwaizhiyin.net\/"],"url":"https:\/\/www.xianwaizhiyin.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289"}],"version-history":[{"count":2,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":2701,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions\/2701"}],"wp:attachment":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}