/*
* ffmpeg option parsing
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <stdint.h>
#if HAVE_SYS_RESOURCE_H
#include <sys/time.h>
#include <sys/resource.h>
#endif
#include "ffmpeg.h"
#include "fopen_utf8.h"
#include "cmdutils.h"
#include "opt_common.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
#include "libavfilter/avfilter.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
#define SPECIFIER_OPT_FMT_str "%s"
#define SPECIFIER_OPT_FMT_i "%i"
#define SPECIFIER_OPT_FMT_i64 "%"PRId64
#define SPECIFIER_OPT_FMT_ui64 "%"PRIu64
#define SPECIFIER_OPT_FMT_f "%f"
#define SPECIFIER_OPT_FMT_dbl "%lf"
static const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
static const char *const opt_name_audio_channels[] = {"ac", NULL};
static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", "ch_layout", NULL};
static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
static const char *const opt_name_frame_rates[] = {"r", NULL};
static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL};
static const char *const opt_name_frame_sizes[] = {"s", NULL};
static const char *const opt_name_frame_pix_fmts[] = {"pix_fmt", NULL};
static const char *const opt_name_ts_scale[] = {"itsscale", NULL};
static const char *const opt_name_hwaccels[] = {"hwaccel", NULL};
static const char *const opt_name_hwaccel_devices[] = {"hwaccel_device", NULL};
static const char *const opt_name_hwaccel_output_formats[] = {"hwaccel_output_format", NULL};
static const char *const opt_name_autorotate[] = {"autorotate", NULL};
static const char *const opt_name_autoscale[] = {"autoscale", NULL};
static const char *const opt_name_max_frames[] = {"frames", "aframes", "vframes", "dframes", NULL};
static const char *const opt_name_bitstream_filters[] = {"bsf", "absf", "vbsf", NULL};
static const char *const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL};
static const char *const opt_name_sample_fmts[] = {"sample_fmt", NULL};
static const char *const opt_name_qscale[] = {"q", "qscale", NULL};
static const char *const opt_name_forced_key_frames[] = {"forced_key_frames", NULL};
static const char *const opt_name_fps_mode[] = {"fps_mode", NULL};
static const char *const opt_name_force_fps[] = {"force_fps", NULL};
static const char *const opt_name_frame_aspect_ratios[] = {"aspect", NULL};
static const char *const opt_name_rc_overrides[] = {"rc_override", NULL};
static const char *const opt_name_intra_matrices[] = {"intra_matrix", NULL};
static const char *const opt_name_inter_matrices[] = {"inter_matrix", NULL};
static const char *const opt_name_chroma_intra_matrices[] = {"chroma_intra_matrix", NULL};
static const char *const opt_name_top_field_first[] = {"top", NULL};
static const char *const opt_name_presets[] = {"pre", "apre", "vpre", "spre", NULL};
static const char *const opt_name_copy_initial_nonkeyframes[] = {"copyinkf", NULL};
static const char *const opt_name_copy_prior_start[] = {"copypriorss", NULL};
static const char *const opt_name_filters[] = {"filter", "af", "vf", NULL};
static const char *const opt_name_filter_scripts[] = {"filter_script", NULL};
static const char *const opt_name_reinit_filters[] = {"reinit_filter", NULL};
static const char *const opt_name_fix_sub_duration[] = {"fix_sub_duration", NULL};
static const char *const opt_name_canvas_sizes[] = {"canvas_size", NULL};
static const char *const opt_name_pass[] = {"pass", NULL};
static const char *const opt_name_passlogfiles[] = {"passlogfile", NULL};
static const char *const opt_name_max_muxing_queue_size[] = {"max_muxing_queue_size", NULL};
static const char *const opt_name_muxing_queue_data_threshold[] = {"muxing_queue_data_threshold", NULL};
static const char *const opt_name_guess_layout_max[] = {"guess_layout_max", NULL};
static const char *const opt_name_apad[] = {"apad", NULL};
static const char *const opt_name_discard[] = {"discard", NULL};
static const char *const opt_name_disposition[] = {"disposition", NULL};
static const char *const opt_name_time_bases[] = {"time_base", NULL};
static const char *const opt_name_enc_time_bases[] = {"enc_time_base", NULL};
static const char *const opt_name_bits_per_raw_sample[] = {"bits_per_raw_sample", NULL};
#define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
{\
char namestr[128] = "";\
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
for (i = 0; opt_name_##name[i]; i++)\
av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[i], opt_name_##name[i+1] ? (opt_name_##name[i+2] ? ", " : " or ") : "");\
av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
}
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
int i, ret, matches = 0;\
SpecifierOpt *so;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
outvar = o->name[i].u.type;\
so = &o->name[i];\
matches++;\
} else if (ret < 0)\
exit_program(1);\
}\
if (matches > 1)\
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
}
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
{\
int i;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if (!strcmp(spec, mediatype))\
outvar = o->name[i].u.type;\
}\
}
HWDevice *filter_hw_device;
char *vstats_filename;
char *sdp_filename;
float audio_drift_threshold = 0.1;
float dts_delta_threshold = 10;
float dts_error_threshold = 3600*30;
int audio_volume = 256;
int audio_sync_method = 0;
enum VideoSyncMethod video_sync_method = VSYNC_AUTO;
float frame_drop_threshold = 0;
int do_benchmark = 0;
int do_benchmark_all = 0;
int do_hex_dump = 0;
int do_pkt_dump = 0;
int copy_ts = 0;
int start_at_zero = 0;
int copy_tb = -1;
int debug_ts = 0;
int exit_on_error = 0;
int abort_on_flag
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
FFmpeg-5.1.1-iOS-13.0-Lite.zip (155个子文件)
libavcodec.a 17.26MB
libavformat.a 4.68MB
libavutil.a 2.28MB
libswscale.a 1.58MB
libavfilter.a 833KB
libswresample.a 399KB
libavdevice.a 167KB
ffmpeg_opt.c 163KB
ffmpeg.c 157KB
opt_common.c 47KB
ffmpeg_filter.c 43KB
cmdutils.c 31KB
ffmpeg_hw.c 17KB
ffmpeg_mux.c 10KB
.DS_Store 8KB
.DS_Store 6KB
avcodec.h 111KB
avformat.h 111KB
avfilter.h 43KB
pixfmt.h 36KB
opt.h 36KB
frame.h 31KB
avio.h 31KB
channel_layout.h 31KB
swresample.h 25KB
hwcontext.h 24KB
config.h 23KB
packet.h 23KB
mem.h 23KB
ffmpeg.h 21KB
intreadwrite.h 18KB
avdevice.h 18KB
common.h 17KB
codec_id.h 17KB
swscale.h 15KB
avstring.h 15KB
pixdesc.h 15KB
cmdutils.h 15KB
fifo.h 15KB
codec.h 13KB
imgutils.h 13KB
log.h 12KB
hdr_dynamic_metadata.h 12KB
buffer.h 12KB
bsf.h 11KB
opt_common.h 10KB
samplefmt.h 10KB
avutil.h 10KB
hwcontext_vulkan.h 9KB
film_grain_params.h 8KB
hash.h 8KB
hdr_dynamic_vivid_metadata.h 8KB
dict.h 8KB
buffersink.h 8KB
spherical.h 8KB
mathematics.h 8KB
timecode.h 8KB
bprint.h 8KB
dovi_meta.h 7KB
codec_par.h 7KB
parseutils.h 7KB
encryption_info.h 7KB
buffersrc.h 7KB
hwcontext_d3d11va.h 7KB
eval.h 6KB
xvmc.h 6KB
rational.h 6KB
video_enc_params.h 6KB
audio_fifo.h 6KB
tx.h 6KB
cpu.h 5KB
error.h 5KB
tree.h 5KB
defs.h 5KB
stereo3d.h 5KB
vdpau.h 5KB
uuid.h 5KB
attributes.h 5KB
hwcontext_drm.h 5KB
version.h 4KB
dirac.h 4KB
videotoolbox.h 4KB
mastering_display_metadata.h 4KB
threadmessage.h 4KB
codec_desc.h 4KB
hwcontext_vaapi.h 4KB
qsv.h 4KB
dv_profile.h 4KB
murmur3.h 3KB
display.h 3KB
detection_bbox.h 3KB
mediacodec.h 3KB
hwcontext_videotoolbox.h 3KB
csp.h 3KB
downmix_info.h 3KB
crc.h 3KB
avfft.h 3KB
hwcontext_opencl.h 3KB
hmac.h 3KB
bswap.h 3KB
共 155 条
- 1
- 2
资源评论
卟败灬筱龙
- 粉丝: 68
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功