如何使用vscode在macOS平台调试ffmpeg
使用vscode调试ffmpeg准备知识:Debug C++ in Visual Studio Code ffmpeg 源码 https://github.com/FFmpeg/FFmpeg.git ffmpeg 配置, 使其支持调试关于-g3相关知识gcc-g-vs-g3-gdb-flag-what-is-the-difference 12./configure --disable-optimizations --disable-stripping --enable-debug=3 --disable-docmake -j `nproc` 以_g结尾的就是可以调试的程序ffmpeg_g, ffplay_g, ffprobe_g vscode配置 如下命令: 12# macOS上列出所有的音视频设备ffmpeg -f avfoundation -list_devices true -i "" launch.json 对应的配置 1234567891011121314151617181920{ // Use IntelliSense t...
Shell 变量
Shell 变量变量名The name of a variable can contain only letters (a to z or A to Z), numbers ( 0 to 9) or the underscore character ( _). By convention, Unix shell variables will have their names in UPPERCASE. 合法的变量 1234_ALITOKEN_AVAR_1VAR_2 非法变量 12342_VAR-VARIABLEVAR1-VAR2VAR_A! 定义变量1variable_name=variable_value 例如: 1NAME="Zara Ali" shell 允许变量存你想要的任何值, 例如 12VAR1="Zara Ali"VAR2=100 获取变量的值通过在变量前添加$来引用变量 1234#!/bin/shNAME="Zara Ali"echo $NAME 输出 1Zara Ali 只读变量在变量前添...
Shell 函数
shell 函数语法 123function_name () { list of commands} 示例 123456789#!/bin/sh# Define your function hereHello () { echo "Hello World"}# Invoke your functionHello 函数传参函数传参类似于脚本传参$1, $2..$n 123456789#!/bin/sh# Define your function hereHello () { echo "Hello World $1 $2"}# Invoke your functionHello Zara Ali 返回值123456789101112131415#!/bin/sh# Define your function hereHello () { echo "Hello World $1 $2" return 10}# Invo...
Shell 数组
Shell 数组参考: Shell中的数组及其相关操作_杰瑞的专栏-CSDN博客 应用场景: 求数组的长度 元素长度 遍历数组 元素切片 替换 删除 备注: Shell中的数组不像JAVA/C,只能是一维数组, 没有二维数组 数组元素大小无约束,也无需先定义数组的元素个数 索引从0开始 不像JAVA/C等强编程语言,在赋值前必须声明;SHELL只是弱编程语言,可事先声明也可不声明; 用unset来撤销数组,可用unset array_name[i]来删除里面的元素 声明1234declare -a array_name # 声明数组,也可不声明declare -a nums=(1 2 3 4) # 声明数组, 同时赋值unset array_name # 删除数组,撤销数组unset nums[0] # 删除数组中某个元素 定义12345678910111213141516171819#方式一:array_names=(value0valuelvalue2valu...
Shell 循环语句
shell 循环语句while 循环while 循环可以嵌套,语法如下 1234567891011while command1 ; # this is loop1, the outer loopdo Statement(s) to be executed if command1 is true while command2 ; # this is loop2, the inner loop do Statement(s) to be executed if command2 is true done Statement(s) to be executed if command1 is truedone 示例 1234567891011121314#!/bin/sha=0while [ "$a" -lt 10 ] # this is loop1do b="$a" while [ "$b" -ge 0 ] # this is loop2 do echo -n &q...
Shell 条件语句
shell 条件语句if123456if test-commands; then consequent-commands;[elif more-test-commands; then more-consequents;][else alternate-consequents;]fi case123case word in [ [(] pattern [| pattern]…) command-list ;;]…esac 示例 123456789echo -n "Enter the name of an animal: "read ANIMALecho -n "The $ANIMAL has "case $ANIMAL in horse | dog | cat) echo -n "four";; man | kangaroo ) echo -n "two";; *) echo -n "an unknown number of";;esacecho " l...
Shell 运算符
shell 运算符参考:Unix / Linux - Shell Basic Operators 算数运算符shell 本身不支持算数运算,使用awk 或者expr来实现。 示例: 两数相加 1234#!/bin/shval=`expr 2 + 2`echo "Total value : $val" 结果 1Total value : 4 假设a=10,b=20 运算符 描述 示例 + 加 expr $a + $b = 30 - 减 expr $a - $b = -10 * 乘 expr $a \* $b = 200 / 除 expr $b / $a = 2 % 求余 expr $b % $a = 0 = 赋值 a = $b == 判断相等 [ $a == $b ] != 不等 [ $a != $b ] 关系运算符假设a=10, b=20 运算符 ...
Shell 脚本,带名字的参数
shell 脚本,带名字的参数参考: bash - Passing named arguments to shell scripts - Unix & Linux Stack Exchange From 3.5.3 Shell Parameter Expansion of the GNU Bash manual: ${parameter:-word}If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted. 123456789101112131415161718192021222324252627#!/usr/bin/env bashwhile [ $# -gt 0 ]; do case "$1" in -p|-p_out|--p_out) p_out="$2" ;; -a|-arg_1|--arg_...
Shell 特殊变量
特殊变量$$当前 shell 的进程ID 1$echo $$ 输出当前进程的pid 12➜ ~ echo $$19248 $0 当前脚本的文件名 $n 当前脚本的参数,从1开始 $1第一个参数,$2第二个参数,$n第n个参数 $# 脚本参数的总个数 $* 脚本参数集合,所有的参数被双引号包裹。如果脚本2个参数,$*="$1 $2" $@ 脚本参数集合,每个参数被单独的双引号包裹。如果脚本2个参数,$*="$1" "$2" $? 上个命令的返回值。 $$ 当前shell 的进程ID。 $! The process number of the last background command. 示例 12345678#!/bin/shecho "File Name: $0"echo "First Parameter : $1"echo "Second Parameter : $2"echo "...
常用的shell语句
常用的shell语句判断软件是否安装 1234567#!/bin/bashif [ ! -x "$(command -v xcodeproj)" ]; then echo "xcodeproj is not installed. installing..." > &2 echo "run 'gem install xcodeproj'" gem install xcodeprojfi 当前shell脚本所在目录 1SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)";
