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
dd2d3b76
Commit
dd2d3b76
authored
Mar 06, 2014
by
Anton Khirnov
Committed by
Luca Barbato
May 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: Add hwaccel private data and init/uninit callbacks
parent
ebc29519
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
4 deletions
+59
-4
avcodec.h
libavcodec/avcodec.h
+23
-0
internal.h
libavcodec/internal.h
+5
-0
pthread_frame.c
libavcodec/pthread_frame.c
+1
-0
utils.c
libavcodec/utils.c
+30
-4
No files found.
libavcodec/avcodec.h
View file @
dd2d3b76
...
...
@@ -2999,6 +2999,29 @@ typedef struct AVHWAccel {
* AVCodecContext.release_buffer().
*/
int
frame_priv_data_size
;
/**
* Initialize the hwaccel private data.
*
* This will be called from ff_get_format(), after hwaccel and
* hwaccel_context are set and the hwaccel private data in AVCodecInternal
* is allocated.
*/
int
(
*
init
)(
AVCodecContext
*
avctx
);
/**
* Uninitialize the hwaccel private data.
*
* This will be called from get_format() or avcodec_close(), after hwaccel
* and hwaccel_context are already uninitialized.
*/
int
(
*
uninit
)(
AVCodecContext
*
avctx
);
/**
* Size of the private data to allocate in
* AVCodecInternal.hwaccel_priv_data.
*/
int
priv_data_size
;
}
AVHWAccel
;
/**
...
...
libavcodec/internal.h
View file @
dd2d3b76
...
...
@@ -95,6 +95,11 @@ typedef struct AVCodecInternal {
* packet into every function.
*/
AVPacket
*
pkt
;
/**
* hwaccel-specific private data
*/
void
*
hwaccel_priv_data
;
}
AVCodecInternal
;
struct
AVCodecDefault
{
...
...
libavcodec/pthread_frame.c
View file @
dd2d3b76
...
...
@@ -206,6 +206,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
dst
->
hwaccel
=
src
->
hwaccel
;
dst
->
hwaccel_context
=
src
->
hwaccel_context
;
dst
->
internal
->
hwaccel_priv_data
=
src
->
internal
->
hwaccel_priv_data
;
}
if
(
for_user
)
{
...
...
libavcodec/utils.c
View file @
dd2d3b76
...
...
@@ -893,16 +893,37 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
if
(
!
desc
)
return
AV_PIX_FMT_NONE
;
if
(
avctx
->
hwaccel
&&
avctx
->
hwaccel
->
uninit
)
avctx
->
hwaccel
->
uninit
(
avctx
);
av_freep
(
&
avctx
->
internal
->
hwaccel_priv_data
);
avctx
->
hwaccel
=
NULL
;
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_HWACCEL
)
{
avctx
->
hwaccel
=
find_hwaccel
(
avctx
->
codec_id
,
ret
);
if
(
!
avctx
->
hwaccel
)
{
AVHWAccel
*
hwaccel
;
int
err
;
hwaccel
=
find_hwaccel
(
avctx
->
codec_id
,
ret
);
if
(
!
hwaccel
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Could not find an AVHWAccel for the pixel format: %s"
,
desc
->
name
);
return
AV_PIX_FMT_NONE
;
}
}
else
{
avctx
->
hwaccel
=
NULL
;
if
(
hwaccel
->
priv_data_size
)
{
avctx
->
internal
->
hwaccel_priv_data
=
av_mallocz
(
hwaccel
->
priv_data_size
);
if
(
!
avctx
->
internal
->
hwaccel_priv_data
)
return
AV_PIX_FMT_NONE
;
}
if
(
hwaccel
->
init
)
{
err
=
hwaccel
->
init
(
avctx
);
if
(
err
<
0
)
{
av_freep
(
&
avctx
->
internal
->
hwaccel_priv_data
);
return
AV_PIX_FMT_NONE
;
}
}
avctx
->
hwaccel
=
hwaccel
;
}
return
ret
;
...
...
@@ -1688,6 +1709,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
pool
->
pools
);
i
++
)
av_buffer_pool_uninit
(
&
pool
->
pools
[
i
]);
av_freep
(
&
avctx
->
internal
->
pool
);
if
(
avctx
->
hwaccel
&&
avctx
->
hwaccel
->
uninit
)
avctx
->
hwaccel
->
uninit
(
avctx
);
av_freep
(
&
avctx
->
internal
->
hwaccel_priv_data
);
av_freep
(
&
avctx
->
internal
);
}
...
...
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