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
721e1cd9
Commit
721e1cd9
authored
Jul 10, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ffmpeg: some clean. Added a mutex to avoid multiple initialisation.
parent
b752c610
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
modules/codec/ffmpeg/audio.c
modules/codec/ffmpeg/audio.c
+9
-13
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+9
-1
modules/codec/ffmpeg/video.c
modules/codec/ffmpeg/video.c
+5
-6
No files found.
modules/codec/ffmpeg/audio.c
View file @
721e1cd9
...
...
@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.1
8 2003/04/25 18:57
:41 fenrir Exp $
* $Id: audio.c,v 1.1
9 2003/07/10 01:33
:41 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -115,12 +115,10 @@ int E_( InitThread_Audio )( adec_thread_t *p_adec )
if
(
(
p_adec
->
p_context
->
extradata_size
=
p_wf
->
cbSize
)
>
0
)
{
p_adec
->
p_context
->
extradata
=
malloc
(
p_wf
->
cbSize
);
p_adec
->
p_context
->
extradata
=
malloc
(
p_wf
->
cbSize
+
FF_INPUT_BUFFER_PADDING_SIZE
);
memcpy
(
p_adec
->
p_context
->
extradata
,
&
p_wf
[
1
],
p_wf
->
cbSize
);
memcpy
(
p_adec
->
p_context
->
extradata
,
&
p_wf
[
1
],
p_wf
->
cbSize
);
memset
(
&
((
uint8_t
*
)
p_adec
->
p_context
->
extradata
)[
p_wf
->
cbSize
],
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
/* ***** Open the codec ***** */
...
...
@@ -182,14 +180,14 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec )
if
(
i_frame_size
>
0
)
{
uint8_t
*
p_last
;
int
i_need
;
i_need
=
i_frame_size
+
16
+
p_adec
->
i_buffer
;
i_need
=
i_frame_size
+
FF_INPUT_BUFFER_PADDING_SIZE
+
p_adec
->
i_buffer
;
if
(
p_adec
->
i_buffer_size
<
i_need
)
{
p_last
=
p_adec
->
p_buffer
;
uint8_t
*
p_last
=
p_adec
->
p_buffer
;
p_adec
->
p_buffer
=
malloc
(
i_need
);
p_adec
->
i_buffer_size
=
i_need
;
if
(
p_adec
->
i_buffer
>
0
)
...
...
@@ -203,9 +201,7 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec )
i_frame_size
,
p_pes
);
/* make ffmpeg happier but I'm not sure it's needed for audio */
memset
(
p_adec
->
p_buffer
+
p_adec
->
i_buffer
+
i_frame_size
,
0
,
16
);
memset
(
p_adec
->
p_buffer
+
p_adec
->
i_buffer
+
i_frame_size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
input_DeletePES
(
p_adec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
while
(
i_frame_size
<=
0
);
...
...
@@ -242,7 +238,7 @@ usenextdata:
i_frame_size
-=
i_used
;
//
msg_Dbg( p_adec->p_fifo, "frame size:%d buffer used:%d", i_frame_size, i_used );
//
msg_Dbg( p_adec->p_fifo, "frame size:%d buffer used:%d", i_frame_size, i_used );
if
(
i_output_size
<=
0
)
{
msg_Warn
(
p_adec
->
p_fifo
,
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
721e1cd9
...
...
@@ -2,7 +2,7 @@
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ffmpeg.c,v 1.4
4 2003/06/16 20:23:41 gbazin
Exp $
* $Id: ffmpeg.c,v 1.4
5 2003/07/10 01:33:41 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -178,6 +178,7 @@ vlc_module_begin();
set_callbacks
(
E_
(
OpenChroma
),
NULL
);
set_description
(
_
(
"ffmpeg chroma conversion"
)
);
var_Create
(
p_module
->
p_libvlc
,
"avcodec"
,
VLC_VAR_MUTEX
);
vlc_module_end
();
/*****************************************************************************
...
...
@@ -281,10 +282,16 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
static
int
InitThread
(
generic_thread_t
*
p_decoder
)
{
int
i_result
;
vlc_value_t
lockval
;
var_Get
(
p_decoder
->
p_fifo
->
p_libvlc
,
"avcodec"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
/* *** init ffmpeg library (libavcodec) *** */
if
(
!
b_ffmpeginit
)
{
avcodec_init
();
avcodec_register_all
();
b_ffmpeginit
=
1
;
...
...
@@ -296,6 +303,7 @@ static int InitThread( generic_thread_t *p_decoder )
{
msg_Dbg
(
p_decoder
->
p_fifo
,
"libavcodec already initialized"
);
}
vlc_mutex_unlock
(
lockval
.
p_address
);
/* *** determine codec type *** */
ffmpeg_GetFfmpegCodec
(
p_decoder
->
p_fifo
->
i_fourcc
,
...
...
modules/codec/ffmpeg/video.c
View file @
721e1cd9
...
...
@@ -2,7 +2,7 @@
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.3
4 2003/06/28 23:56:3
1 fenrir Exp $
* $Id: video.c,v 1.3
5 2003/07/10 01:33:4
1 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
...
...
@@ -361,10 +361,11 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
else
{
p_vdec
->
p_context
->
extradata_size
=
i_size
;
p_vdec
->
p_context
->
extradata
=
malloc
(
i_size
);
p_vdec
->
p_context
->
extradata
=
malloc
(
i_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
memcpy
(
p_vdec
->
p_context
->
extradata
,
&
p_vdec
->
p_format
[
1
],
i_size
);
memset
(
&
((
uint8_t
*
)
p_vdec
->
p_context
->
extradata
)[
i_size
],
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
}
p_vdec
->
p_vout
=
NULL
;
...
...
@@ -477,7 +478,7 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec )
int
i_need
;
/* XXX Don't forget that ffmpeg required a little more bytes
* that the real frame size */
i_need
=
i_frame_size
+
16
+
p_vdec
->
i_buffer
;
i_need
=
i_frame_size
+
FF_INPUT_BUFFER_PADDING_SIZE
+
p_vdec
->
i_buffer
;
if
(
p_vdec
->
i_buffer_size
<
i_need
)
{
p_last
=
p_vdec
->
p_buffer
;
...
...
@@ -493,9 +494,7 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec )
E_
(
GetPESData
)(
p_vdec
->
p_buffer
+
p_vdec
->
i_buffer
,
i_frame_size
,
p_pes
);
memset
(
p_vdec
->
p_buffer
+
p_vdec
->
i_buffer
+
i_frame_size
,
0
,
16
);
memset
(
p_vdec
->
p_buffer
+
p_vdec
->
i_buffer
+
i_frame_size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
input_DeletePES
(
p_vdec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
while
(
i_frame_size
<=
0
);
...
...
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