Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
70cf8109
Commit
70cf8109
authored
Jan 06, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make shine really not re-entrant
parent
2c7bc975
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
modules/codec/shine/shine_mod.c
modules/codec/shine/shine_mod.c
+30
-4
No files found.
modules/codec/shine/shine_mod.c
View file @
70cf8109
...
@@ -40,8 +40,8 @@
...
@@ -40,8 +40,8 @@
/* shine.c uses a lot of static variables, so we include the C file to keep
/* shine.c uses a lot of static variables, so we include the C file to keep
* the scope.
* the scope.
* Note that it makes this decoder non reentrant, this is why we
set
* Note that it makes this decoder non reentrant, this is why we
have the
*
b_reentrant to VLC_FALSE in the module initialisation
*/
*
struct entrant below
*/
#include "shine.c"
#include "shine.c"
struct
encoder_sys_t
struct
encoder_sys_t
...
@@ -68,6 +68,12 @@ vlc_module_begin();
...
@@ -68,6 +68,12 @@ vlc_module_begin();
set_callbacks
(
OpenEncoder
,
CloseEncoder
);
set_callbacks
(
OpenEncoder
,
CloseEncoder
);
vlc_module_end
();
vlc_module_end
();
static
struct
{
bool
busy
;
vlc_mutex_t
lock
;
}
entrant
=
{
false
,
VLC_STATIC_MUTEX
,
};
static
int
OpenEncoder
(
vlc_object_t
*
p_this
)
static
int
OpenEncoder
(
vlc_object_t
*
p_this
)
{
{
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
...
@@ -96,14 +102,24 @@ static int OpenEncoder( vlc_object_t *p_this )
...
@@ -96,14 +102,24 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc
->
fmt_out
.
i_bitrate
,
p_enc
->
fmt_out
.
audio
.
i_rate
,
p_enc
->
fmt_out
.
i_bitrate
,
p_enc
->
fmt_out
.
audio
.
i_rate
,
p_enc
->
fmt_out
.
audio
.
i_channels
);
p_enc
->
fmt_out
.
audio
.
i_channels
);
vlc_mutex_lock
(
&
entrant
.
lock
);
if
(
entrant
.
busy
)
{
msg_Err
(
p_enc
,
"encoder already in progress"
);
vlc_mutex_unlock
(
&
entrant
.
lock
);
return
VLC_EGENERIC
;
}
entrant
.
busy
=
true
;
vlc_mutex_unlock
(
&
entrant
.
lock
);
p_enc
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
p_enc
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
if
(
!
p_sys
)
if
(
!
p_sys
)
return
VLC_ENOMEM
;
goto
enomem
;
if
(
!
(
p_sys
->
p_fifo
=
block_FifoNew
()
)
)
if
(
!
(
p_sys
->
p_fifo
=
block_FifoNew
()
)
)
{
{
free
(
p_sys
);
free
(
p_sys
);
return
VLC_ENOMEM
;
goto
enomem
;
}
}
init_mp3_encoder_engine
(
p_enc
->
fmt_out
.
audio
.
i_rate
,
init_mp3_encoder_engine
(
p_enc
->
fmt_out
.
audio
.
i_rate
,
...
@@ -113,6 +129,12 @@ static int OpenEncoder( vlc_object_t *p_this )
...
@@ -113,6 +129,12 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc
->
fmt_out
.
i_cat
=
AUDIO_ES
;
p_enc
->
fmt_out
.
i_cat
=
AUDIO_ES
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
enomem:
vlc_mutex_lock
(
&
entrant
.
lock
);
entrant
.
busy
=
false
;
vlc_mutex_unlock
(
&
entrant
.
lock
);
return
VLC_ENOMEM
;
}
}
/* We split/pack PCM blocks to a fixed size: pcm_chunk_size bytes */
/* We split/pack PCM blocks to a fixed size: pcm_chunk_size bytes */
...
@@ -229,6 +251,10 @@ static void CloseEncoder( vlc_object_t *p_this )
...
@@ -229,6 +251,10 @@ static void CloseEncoder( vlc_object_t *p_this )
{
{
encoder_sys_t
*
p_sys
=
((
encoder_t
*
)
p_this
)
->
p_sys
;
encoder_sys_t
*
p_sys
=
((
encoder_t
*
)
p_this
)
->
p_sys
;
vlc_mutex_lock
(
&
entrant
.
lock
);
entrant
.
busy
=
false
;
vlc_mutex_unlock
(
&
entrant
.
lock
);
/* TODO: we should send the last PCM block padded with 0
/* TODO: we should send the last PCM block padded with 0
* But we don't know if other blocks will come before it's too late */
* But we don't know if other blocks will come before it's too late */
if
(
p_sys
->
i_buffer
)
if
(
p_sys
->
i_buffer
)
...
...
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