Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
91ebe760
Commit
91ebe760
authored
Apr 21, 2010
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davinci: Call CERuntimeInit() and CERuntimeExit() exactly only once.
parent
1cbcc4c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
4 deletions
+73
-4
modules/codec/davinci/davinci.c
modules/codec/davinci/davinci.c
+66
-0
modules/codec/davinci/davinci.h
modules/codec/davinci/davinci.h
+5
-1
modules/codec/davinci/encoder.c
modules/codec/davinci/encoder.c
+2
-3
No files found.
modules/codec/davinci/davinci.c
View file @
91ebe760
...
...
@@ -332,3 +332,69 @@ void davinci_PrintAvailableAlgorithms( vlc_object_t *p_this, const char *psz_eng
}
}
/* NOTE:
* CERuntime should be inited and exited only once per application.
*/
static
void
vlc_ceruntime_mutex
(
bool
acquire
)
{
static
vlc_mutex_t
lock
=
VLC_STATIC_MUTEX
;
if
(
acquire
)
vlc_mutex_lock
(
&
lock
);
else
vlc_mutex_unlock
(
&
lock
);
}
static
inline
void
vlc_ceruntime_lock
()
{
vlc_ceruntime_mutex
(
true
);
}
static
inline
void
vlc_ceruntime_unlock
()
{
vlc_ceruntime_mutex
(
false
);
}
static
bool
b_ceruntimeinit
=
false
;
static
uint32_t
ref_ceruntime
=
0
;
void
davinci_RuntimeInit
(
vlc_object_t
*
p_this
)
{
vlc_ceruntime_lock
();
ref_ceruntime
++
;
if
(
!
b_ceruntimeinit
)
{
/* Initialize the codec engine */
CERuntime_init
();
b_ceruntimeinit
=
true
;
msg_Dbg
(
p_this
,
"CERuntime initialized"
);
}
else
{
msg_Dbg
(
p_this
,
"CERuntime already initialized"
);
}
vlc_ceruntime_unlock
();
}
void
davinci_RuntimeExit
(
vlc_object_t
*
p_this
)
{
vlc_ceruntime_lock
();
ref_ceruntime
--
;
if
(
ref_ceruntime
==
0
)
{
/* Exit the codec engine */
CERuntime_exit
();
b_ceruntimeinit
=
false
;
msg_Dbg
(
p_this
,
"CERuntime exited"
);
}
else
{
msg_Dbg
(
p_this
,
"CERuntime exited (reference count %d)"
,
ref_ceruntime
);
}
vlc_ceruntime_unlock
();
}
modules/codec/davinci/davinci.h
View file @
91ebe760
...
...
@@ -99,7 +99,7 @@ void calculate_fps( encoder_t *p_enc );
const
char
*
davinci_GetExtendedError
(
XDAS_Int32
);
void
davinci_PrintAvailableAlgorithms
(
vlc_object_t
*
,
const
char
*
);
/* Davinci
FourCC
*/
/* Davinci
XDM Versions
*/
enum
davinci_xdm_version_e
{
DAVINCI_XDM0_9
=
0x09
,
...
...
@@ -112,6 +112,10 @@ bool GetDavinciEncoder( vlc_fourcc_t, int *, int *, const char **, const char **
bool
GetVlcFourcc
(
const
char
*
,
int
*
,
vlc_fourcc_t
*
,
const
char
**
);
XDAS_Int32
VlcChromaToXdm
(
vlc_fourcc_t
);
/* CE Runtime */
void
davinci_RuntimeInit
(
vlc_object_t
*
p_this
);
void
davinci_RuntimeExit
(
vlc_object_t
*
p_this
);
/* XDM 0.9 */
int
davinci_AllocateBuffer
(
XDAS_Int32
,
XDAS_Int32
*
,
XDM_BufDesc
*
);
void
davinci_FreeBuffer
(
XDM_BufDesc
*
);
...
...
modules/codec/davinci/encoder.c
View file @
91ebe760
...
...
@@ -88,7 +88,7 @@ int OpenEncoder( vlc_object_t *p_this )
}
/* Initialize the codec engine */
CERuntime_init
(
);
davinci_RuntimeInit
(
p_this
);
/* Create an engine handle */
p_sys
->
engine
=
Engine_open
(
p_sys
->
psz_ti_engine
,
NULL
/*&Engine_ATTRS*/
,
&
err
);
...
...
@@ -183,8 +183,7 @@ void CloseEncoder( vlc_object_t *p_this )
Engine_close
(
p_sys
->
engine
);
/* Exit the codec engine */
/* FIXME: Should this be done only once (if we have encoder + decoder runing) */
CERuntime_exit
();
davinci_RuntimeExit
(
p_this
);
free
(
p_sys
->
psz_ti_engine
);
free
(
p_sys
);
...
...
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