Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ebc29519
Commit
ebc29519
authored
May 08, 2014
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hwaccel: Support specific frame allocators
It would reduce the boilerplate code users have to write.
parent
a871ef0c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
avcodec.h
libavcodec/avcodec.h
+5
-0
utils.c
libavcodec/utils.c
+7
-0
No files found.
libavcodec/avcodec.h
View file @
ebc29519
...
@@ -2946,6 +2946,11 @@ typedef struct AVHWAccel {
...
@@ -2946,6 +2946,11 @@ typedef struct AVHWAccel {
*/
*/
struct
AVHWAccel
*
next
;
struct
AVHWAccel
*
next
;
/**
* Allocate a custom buffer
*/
int
(
*
alloc_frame
)(
AVCodecContext
*
avctx
,
AVFrame
*
frame
);
/**
/**
* Called at the beginning of each frame or field picture.
* Called at the beginning of each frame or field picture.
*
*
...
...
libavcodec/utils.c
View file @
ebc29519
...
@@ -604,6 +604,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
...
@@ -604,6 +604,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
int
ff_get_buffer
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
int
flags
)
int
ff_get_buffer
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
int
flags
)
{
{
const
AVHWAccel
*
hwaccel
=
avctx
->
hwaccel
;
int
override_dimensions
=
1
;
int
override_dimensions
=
1
;
int
ret
;
int
ret
;
...
@@ -657,6 +658,11 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
...
@@ -657,6 +658,11 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
if
(
hwaccel
&&
hwaccel
->
alloc_frame
)
{
ret
=
hwaccel
->
alloc_frame
(
avctx
,
frame
);
goto
end
;
}
#if FF_API_GET_BUFFER
#if FF_API_GET_BUFFER
FF_DISABLE_DEPRECATION_WARNINGS
FF_DISABLE_DEPRECATION_WARNINGS
/*
/*
...
@@ -775,6 +781,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -775,6 +781,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
ret
=
avctx
->
get_buffer2
(
avctx
,
frame
,
flags
);
ret
=
avctx
->
get_buffer2
(
avctx
,
frame
,
flags
);
end
:
if
(
avctx
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
!
override_dimensions
)
{
if
(
avctx
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
!
override_dimensions
)
{
frame
->
width
=
avctx
->
width
;
frame
->
width
=
avctx
->
width
;
frame
->
height
=
avctx
->
height
;
frame
->
height
=
avctx
->
height
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment