Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
d8b9c5b1
Unverified
Commit
d8b9c5b1
authored
Feb 17, 2022
by
Xiaofeng Wang
Committed by
GitHub
Feb 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新 FFmpeg API 支持 FFmpeg 5 (#1434)
parent
cb00dbab
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
6 行删除
+10
-6
player/FFMpegDecoder.cpp
+10
-6
没有找到文件。
player/FFMpegDecoder.cpp
查看文件 @
d8b9c5b1
...
...
@@ -33,10 +33,10 @@ std::shared_ptr<AVPacket> alloc_av_packet(){
//////////////////////////////////////////////////////////////////////////////////////////
template
<
bool
decoder
=
true
,
typename
...
ARGS
>
AVCodec
*
getCodec
(
ARGS
...
names
);
const
AVCodec
*
getCodec
(
ARGS
...
names
);
template
<
bool
decoder
=
true
>
AVCodec
*
getCodec
(
const
char
*
name
)
{
const
AVCodec
*
getCodec
(
const
char
*
name
)
{
auto
codec
=
decoder
?
avcodec_find_decoder_by_name
(
name
)
:
avcodec_find_encoder_by_name
(
name
);
if
(
codec
)
{
InfoL
<<
(
decoder
?
"got decoder:"
:
"got encoder:"
)
<<
name
;
...
...
@@ -45,7 +45,7 @@ AVCodec *getCodec(const char *name) {
}
template
<
bool
decoder
=
true
>
AVCodec
*
getCodec
(
enum
AVCodecID
id
)
{
const
AVCodec
*
getCodec
(
enum
AVCodecID
id
)
{
auto
codec
=
decoder
?
avcodec_find_decoder
(
id
)
:
avcodec_find_encoder
(
id
);
if
(
codec
)
{
InfoL
<<
(
decoder
?
"got decoder:"
:
"got encoder:"
)
<<
avcodec_get_name
(
id
);
...
...
@@ -54,7 +54,7 @@ AVCodec *getCodec(enum AVCodecID id) {
}
template
<
bool
decoder
=
true
,
typename
First
,
typename
...
ARGS
>
AVCodec
*
getCodec
(
First
first
,
ARGS
...
names
)
{
const
AVCodec
*
getCodec
(
First
first
,
ARGS
...
names
)
{
auto
codec
=
getCodec
<
decoder
>
(
names
...);
if
(
codec
)
{
return
codec
;
...
...
@@ -139,9 +139,11 @@ FFmpegFrame::Ptr FFmpegSwr::inputFrame(const FFmpegFrame::Ptr &frame) {
///////////////////////////////////////////////////////////////////////////
FFmpegDecoder
::
FFmpegDecoder
(
const
Track
::
Ptr
&
track
)
{
#if (LIBAVCODEC_VERSION_MAJOR < 58)
avcodec_register_all
();
AVCodec
*
codec
=
nullptr
;
AVCodec
*
codec_default
=
nullptr
;
#endif
const
AVCodec
*
codec
=
nullptr
;
const
AVCodec
*
codec_default
=
nullptr
;
switch
(
track
->
getCodecId
())
{
case
CodecH264
:
codec_default
=
getCodec
(
AV_CODEC_ID_H264
);
...
...
@@ -181,7 +183,9 @@ FFmpegDecoder::FFmpegDecoder(const Track::Ptr &track) {
}
//保存AVFrame的引用
#ifdef FF_API_OLD_ENCDEC
_context
->
refcounted_frames
=
1
;
#endif
_context
->
flags
|=
AV_CODEC_FLAG_LOW_DELAY
;
_context
->
flags2
|=
AV_CODEC_FLAG2_FAST
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论