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
2470851f
Commit
2470851f
authored
Oct 19, 2012
by
Ash Hughes
Committed by
Michael Niedermayer
Oct 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: enable recursively using avcodec_open2/close.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
7abf3948
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
internal.h
libavcodec/internal.h
+12
-0
utils.c
libavcodec/utils.c
+42
-0
No files found.
libavcodec/internal.h
View file @
2470851f
...
...
@@ -178,4 +178,16 @@ int ff_get_logical_cpus(AVCodecContext *avctx);
int
avpriv_h264_has_num_reorder_frames
(
AVCodecContext
*
avctx
);
/**
* Call avcodec_open2 recursively by decrementing counter, unlocking mutex,
* calling the function and then restoring again. Assumes the mutex is
* already locked
*/
int
ff_codec_open2_recursive
(
AVCodecContext
*
avctx
,
const
AVCodec
*
codec
,
AVDictionary
**
options
);
/**
* Call avcodec_close recursively, counterpart to avcodec_open2_recursive.
*/
int
ff_codec_close_recursive
(
AVCodecContext
*
avctx
);
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/utils.c
View file @
2470851f
...
...
@@ -798,6 +798,27 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
}
#endif
int
attribute_align_arg
ff_codec_open2_recursive
(
AVCodecContext
*
avctx
,
const
AVCodec
*
codec
,
AVDictionary
**
options
)
{
int
ret
=
0
;
entangled_thread_counter
--
;
/* Release any user-supplied mutex. */
if
(
ff_lockmgr_cb
)
{
(
*
ff_lockmgr_cb
)(
&
codec_mutex
,
AV_LOCK_RELEASE
);
}
ret
=
avcodec_open2
(
avctx
,
codec
,
options
);
/* If there is a user-supplied mutex locking routine, call it. */
if
(
ff_lockmgr_cb
)
{
if
((
*
ff_lockmgr_cb
)(
&
codec_mutex
,
AV_LOCK_OBTAIN
))
return
-
1
;
}
entangled_thread_counter
++
;
return
ret
;
}
int
attribute_align_arg
avcodec_open2
(
AVCodecContext
*
avctx
,
const
AVCodec
*
codec
,
AVDictionary
**
options
)
{
int
ret
=
0
;
...
...
@@ -1809,6 +1830,27 @@ void avsubtitle_free(AVSubtitle *sub)
memset
(
sub
,
0
,
sizeof
(
AVSubtitle
));
}
av_cold
int
ff_codec_close_recursive
(
AVCodecContext
*
avctx
)
{
int
ret
=
0
;
entangled_thread_counter
--
;
/* Release any user-supplied mutex. */
if
(
ff_lockmgr_cb
)
{
(
*
ff_lockmgr_cb
)(
&
codec_mutex
,
AV_LOCK_RELEASE
);
}
ret
=
avcodec_close
(
avctx
);
/* If there is a user-supplied mutex locking routine, call it. */
if
(
ff_lockmgr_cb
)
{
if
((
*
ff_lockmgr_cb
)(
&
codec_mutex
,
AV_LOCK_OBTAIN
))
return
-
1
;
}
entangled_thread_counter
++
;
return
ret
;
}
av_cold
int
avcodec_close
(
AVCodecContext
*
avctx
)
{
/* If there is a user-supplied mutex locking routine, call it. */
...
...
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