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
097a909e
Commit
097a909e
authored
Aug 29, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frame_thread_encoder: pass private options
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
028b6d2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
frame_thread_encoder.c
libavcodec/frame_thread_encoder.c
+7
-3
frame_thread_encoder.h
libavcodec/frame_thread_encoder.h
+1
-1
utils.c
libavcodec/utils.c
+1
-1
No files found.
libavcodec/frame_thread_encoder.c
View file @
097a909e
...
...
@@ -113,7 +113,7 @@ end:
return
NULL
;
}
int
ff_frame_thread_encoder_init
(
AVCodecContext
*
avctx
){
int
ff_frame_thread_encoder_init
(
AVCodecContext
*
avctx
,
AVDictionary
*
options
){
int
i
=
0
;
ThreadContext
*
c
;
...
...
@@ -151,6 +151,7 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx){
pthread_cond_init
(
&
c
->
finished_task_cond
,
NULL
);
for
(
i
=
0
;
i
<
avctx
->
thread_count
;
i
++
){
AVDictionary
*
tmp
=
NULL
;
AVCodecContext
*
thread_avctx
=
avcodec_alloc_context3
(
avctx
->
codec
);
if
(
!
thread_avctx
)
goto
fail
;
...
...
@@ -165,10 +166,13 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx){
thread_avctx
->
thread_count
=
1
;
thread_avctx
->
active_thread_type
&=
~
FF_THREAD_FRAME
;
//FIXME pass private options to encoder
if
(
avcodec_open2
(
thread_avctx
,
avctx
->
codec
,
NULL
)
<
0
)
{
av_dict_copy
(
&
tmp
,
options
,
0
);
av_dict_set
(
&
tmp
,
"threads"
,
"1"
,
0
);
if
(
avcodec_open2
(
thread_avctx
,
avctx
->
codec
,
&
tmp
)
<
0
)
{
av_dict_free
(
&
tmp
);
goto
fail
;
}
av_dict_free
(
&
tmp
);
av_assert0
(
!
thread_avctx
->
internal
->
frame_thread_encoder
);
thread_avctx
->
internal
->
frame_thread_encoder
=
c
;
if
(
pthread_create
(
&
c
->
worker
[
i
],
NULL
,
worker
,
thread_avctx
))
{
...
...
libavcodec/frame_thread_encoder.h
View file @
097a909e
...
...
@@ -20,7 +20,7 @@
#include "avcodec.h"
int
ff_frame_thread_encoder_init
(
AVCodecContext
*
avctx
);
int
ff_frame_thread_encoder_init
(
AVCodecContext
*
avctx
,
AVDictionary
*
options
);
void
ff_frame_thread_encoder_free
(
AVCodecContext
*
avctx
);
int
ff_thread_video_encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
int
*
got_packet_ptr
);
libavcodec/utils.c
View file @
097a909e
...
...
@@ -874,7 +874,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
av_log
(
avctx
,
AV_LOG_WARNING
,
"Warning: not compiled with thread support, using thread emulation
\n
"
);
entangled_thread_counter
--
;
//we will instanciate a few encoders thus kick the counter to prevent false detection of a problem
ret
=
ff_frame_thread_encoder_init
(
avctx
);
ret
=
ff_frame_thread_encoder_init
(
avctx
,
options
?
*
options
:
NULL
);
entangled_thread_counter
++
;
if
(
ret
<
0
)
goto
free_and_end
;
...
...
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