/*
* Copyright (c) 2000-2003 Fabrice Bellard
*
* 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
*/
/**
* @file
* multimedia converter based on the FFmpeg libraries
*/
#include "config.h"
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include "stdatomic.h"
#include <stdint.h>
#if HAVE_IO_H
#include <io.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswresample/swresample.h"
#include "libavutil/opt.h"
#include "libavutil/channel_layout.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/fifo.h"
#include "libavutil/hwcontext.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/display.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/timestamp.h"
#include "libavutil/bprint.h"
#include "libavutil/time.h"
#include "libavutil/thread.h"
#include "libavutil/threadmessage.h"
//#include "libavcodec/mathops.h"
//#include "libavformat/os_support.h"
# include "libavfilter/avfilter.h"
# include "libavfilter/buffersrc.h"
# include "libavfilter/buffersink.h"
/* median of 3 */
#ifndef mid_pred
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c)
{
if (a > b) {
if (c > b) {
if (c > a) b = a;
else b = c;
}
}
else {
if (b > c) {
if (c > a) b = c;
else b = a;
}
}
return b;
}
#endif
void DestoryFrameDataBGRA();
#if HAVE_SYS_RESOURCE_H
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#elif HAVE_GETPROCESSTIMES
#include <windows.h>
#endif
#if HAVE_GETPROCESSMEMORYINFO
#include <windows.h>
#include <psapi.h>
#endif
#if HAVE_SETCONSOLECTRLHANDLER
#include <windows.h>
#endif
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#if HAVE_TERMIOS_H
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <termios.h>
#elif HAVE_KBHIT
#include <conio.h>
#endif
#include <time.h>
#include "ffmpeg.h"
#include "cmdutils.h"
#include "libavutil/avassert.h"
const char program_name[] = "ffmpeg";
const int program_birth_year = 2000;
static FILE *vstats_file;
const char *const forced_keyframes_const_names[] = {
"n",
"n_forced",
"prev_forced_n",
"prev_forced_t",
"t",
NULL
};
typedef struct BenchmarkTimeStamps {
int64_t real_usec;
int64_t user_usec;
int64_t sys_usec;
} BenchmarkTimeStamps;
static void do_video_stats(OutputStream *ost, int frame_size);
static BenchmarkTimeStamps get_benchmark_time_stamps(void);
static int64_t getmaxrss(void);
static int ifilter_has_all_input_formats(FilterGraph *fg);
static int run_as_daemon = 0;
static int nb_frames_dup = 0;
static unsigned dup_warning = 1000;
static int nb_frames_drop = 0;
static int64_t decode_error_stat[2];
static int want_sdp = 1;
static BenchmarkTimeStamps current_time;
AVIOContext *progress_avio = NULL;
static uint8_t *subtitle_out;
InputStream **input_streams = NULL;
int nb_input_streams = 0;
InputFile **input_files = NULL;
int nb_input_files = 0;
OutputStream **output_streams = NULL;
int nb_output_streams = 0;
OutputFile **output_files = NULL;
int nb_output_files = 0;
FilterGraph **filtergraphs;
int nb_filtergraphs;
#if HAVE_TERMIOS_H
/* init terminal so that we can grab keys */
static struct termios oldtty;
static int restore_tty;
#endif
#if HAVE_THREADS
static void free_input_threads(void);
#endif
/* sub2video hack:
Convert subtitles to video with alpha to insert them in filter graphs.
This is a temporary solution until libavfilter gets real subtitles support.
*/
static int sub2video_get_blank_frame(InputStream *ist)
{
int ret;
AVFrame *frame = ist->sub2video.frame;
av_frame_unref(frame);
ist->sub2video.frame->width = ist->dec_ctx->width ? ist->dec_ctx->width : ist->sub2video.w;
ist->sub2video.frame->height = ist->dec_ctx->height ? ist->dec_ctx->height : ist->sub2video.h;
ist->sub2video.frame->format = AV_PIX_FMT_RGB32;
if ((ret = av_frame_get_buffer(frame, 0)) < 0)
return ret;
memset(frame->data[0], 0, frame->height * frame->linesize[0]);
return 0;
}
static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h,
AVSubtitleRect *r)
{
uint32_t *pal, *dst2;
uint8_t *src, *src2;
int x, y;
if (r->type != SUBTITLE_BITMAP) {
av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");
return;
}
if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {
av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle (%d %d %d %d) overflowing %d %d\n",
r->x, r->y, r->w, r->h, w, h
);
return;
}
dst += r->y * dst_linesize + r->x * 4;
src = r->data[0];
pal = (uint32_t *)r->data[1];
for (y = 0; y < r->h; y++) {
dst2 = (uint32_t *)dst;
src2 = src;
for (x = 0; x < r->w; x++)
*(dst2++) = pal[*(src2++)];
dst += dst_linesize;
src += r->linesize[0];
}
}
static void sub2video_push_ref(InputStream *ist, int64_t pts)
{
AVFrame *frame = ist->sub2video.frame;
int i;
int ret;
av_assert1(frame->data[0]);
ist->sub2video.last_pts = frame->pts = pts;
for (i = 0; i < ist->nb_filters; i++) {
ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
AV_BUFFERSRC_FLAG_KEEP_REF |
AV_BUFFERSRC_FLAG_PUSH);
if (ret != AVERROR_EOF && ret < 0)
av_log(NULL, AV_LOG_WARNING, "Error while add the frame to buffer source(%s).\n",
av_err2str(ret));
}
}
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
{
AVFrame *frame = ist->sub2video.frame;
int8_t *dst;
int dst_linesize;
int num_rects, i;
int64_t pts, end_pts;
if (!frame)
return;
if (sub) {
pts = av_rescale_q(sub->pts + sub->start_display_time * 1000LL,
AV_TIME_BASE_Q, ist->st->time_base);
end_pts = av_rescale_q(sub->pts + sub->end_display_time * 1000LL,
AV_TIME_BASE_Q, ist->st->time_base);
num_rects = sub->num_rects;
} else {
/* If we are initializing the system, utilize current heartbeat
PTS as the start time, and show until the following subpicture
is received. Otherwise, utilize the previous subpicture's end time
as the fall-back value. */
pts = ist->sub2video.initialize ?
heartbeat_pts : ist->sub2video.end_pts;
end_pts = INT64_MAX;
num_rects = 0;
}
if (sub2video_get_blank_frame(ist) < 0) {
av_log(ist->dec_ctx, AV_LOG_ERROR,
"Impossible to get a blank canvas.\n");
return;
}
dst = frame->data [0];
dst_linesize = frame->linesize[0];
for (i = 0; i < num_rects; i++)
sub2vid
没有合适的资源?快使用搜索试试~ 我知道了~
ffmpeg.exe可调试用VS2019编译源码
共186个文件
h:157个
dll:10个
lib:9个
需积分: 50 45 下载量 26 浏览量
2020-11-06
13:54:45
上传
评论 1
收藏 8.98MB RAR 举报
温馨提示
使用当前2020最新版ffmpeg编译好的lib包,vs2019可编译的ffmpeg.exe的源码.下载后可直接编译调试,了解ffmpeg.exe实现的原理。 打印版本号: ffmpeg version N-99305-gbc0e776 Copyright (c) 2000-2020 the FFmpeg developers built with 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.27.29112 版
资源详情
资源评论
资源推荐
收起资源包目录
ffmpeg.exe可调试用VS2019编译源码 (186个子文件)
ffmpeg.c 173KB
ffmpeg_opt.c 152KB
cmdutils.c 75KB
ffmpeg_filter.c 45KB
ffmpeg_hw.c 16KB
avcodec-58.dll 13.76MB
avfilter-7.dll 3.95MB
avformat-58.dll 2.97MB
libx264-161.dll 1.83MB
avutil-56.dll 1.24MB
swscale-5.dll 1MB
avdevice-58.dll 612KB
avresample-4.dll 574KB
swresample-3.dll 554KB
postproc-55.dll 467KB
ffmpeg.exe 215KB
ffmpeg.vcxproj.filters 2KB
avcodec.h 145KB
avcodec.h 145KB
avformat.h 115KB
config.h 81KB
avfilter.h 41KB
opt.h 36KB
pixfmt.h 34KB
pixfmt.h 34KB
frame.h 32KB
avio.h 32KB
hwcontext.h 24KB
cmdutils.h 23KB
mem.h 23KB
mem.h 23KB
packet.h 23KB
packet.h 23KB
swresample.h 21KB
avresample.h 21KB
ffmpeg.h 20KB
intreadwrite.h 18KB
common.h 18KB
avdevice.h 17KB
codec.h 16KB
codec.h 16KB
pixdesc.h 16KB
codec_id.h 15KB
codec_id.h 15KB
avstring.h 14KB
libm.h 14KB
log.h 13KB
log.h 13KB
hdr_dynamic_metadata.h 12KB
imgutils.h 12KB
swscale.h 12KB
buffer.h 11KB
internal.h 11KB
bsf.h 11KB
bsf.h 11KB
channel_layout.h 10KB
samplefmt.h 10KB
avutil.h 9KB
hash.h 8KB
dict.h 8KB
dict.h 8KB
buffersink.h 8KB
spherical.h 8KB
mathematics.h 8KB
mathematics.h 8KB
bprint.h 8KB
parseutils.h 7KB
hwcontext_vulkan.h 7KB
codec_par.h 7KB
codec_par.h 7KB
timecode.h 7KB
encryption_info.h 7KB
buffersrc.h 6KB
eval.h 6KB
hwcontext_d3d11va.h 6KB
thread.h 6KB
rational.h 6KB
xvmc.h 6KB
audio_fifo.h 6KB
fifo.h 6KB
timer.h 6KB
vdpau.h 6KB
video_enc_params.h 6KB
cpu.h 6KB
cpu.h 6KB
stdatomic.h 6KB
error.h 5KB
tree.h 5KB
w32pthreads.h 5KB
stereo3d.h 5KB
version.h 5KB
version.h 5KB
version.h 5KB
version.h 5KB
attributes.h 5KB
attributes.h 5KB
hwcontext_drm.h 5KB
version.h 4KB
tx.h 4KB
dirac.h 4KB
共 186 条
- 1
- 2
橙枫L
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0