Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
8fce437b
Commit
8fce437b
authored
Jan 25, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ffmpeg: fixed memory leaks.
parent
22d851e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
40 deletions
+39
-40
modules/codec/faad/decoder.c
modules/codec/faad/decoder.c
+10
-9
modules/codec/ffmpeg/audio.c
modules/codec/ffmpeg/audio.c
+22
-24
modules/codec/ffmpeg/audio.h
modules/codec/ffmpeg/audio.h
+7
-7
No files found.
modules/codec/faad/decoder.c
View file @
8fce437b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.1
8 2003/01/08 10:43:27
fenrir Exp $
* $Id: decoder.c,v 1.1
9 2003/01/25 16:59:49
fenrir Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -120,7 +120,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -120,7 +120,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
return
(
0
);
return
(
0
);
}
}
static
int
pi_channels_maps
[
6
]
=
static
unsigned
int
pi_channels_maps
[
6
]
=
{
{
0
,
0
,
AOUT_CHAN_CENTER
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
,
AOUT_CHAN_CENTER
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
,
...
@@ -209,6 +209,7 @@ static int InitThread( adec_thread_t * p_adec )
...
@@ -209,6 +209,7 @@ static int InitThread( adec_thread_t * p_adec )
{
{
msg_Warn
(
p_adec
->
p_fifo
,
msg_Warn
(
p_adec
->
p_fifo
,
"cannot load stream informations"
);
"cannot load stream informations"
);
memset
(
&
p_adec
->
format
,
0
,
sizeof
(
waveformatex_t
)
);
}
}
else
else
{
{
...
@@ -253,7 +254,7 @@ static int InitThread( adec_thread_t * p_adec )
...
@@ -253,7 +254,7 @@ static int InitThread( adec_thread_t * p_adec )
p_adec
->
p_buffer
=
malloc
(
i_frame_size
+
16
);
p_adec
->
p_buffer
=
malloc
(
i_frame_size
+
16
);
p_adec
->
i_buffer
=
i_frame_size
+
16
;
p_adec
->
i_buffer
=
i_frame_size
+
16
;
}
}
GetPESData
(
p_adec
->
p_buffer
,
p_adec
->
i_buffer
,
p_pes
);
GetPESData
(
p_adec
->
p_buffer
,
p_adec
->
i_buffer
,
p_pes
);
}
}
else
else
...
@@ -295,7 +296,7 @@ static int InitThread( adec_thread_t * p_adec )
...
@@ -295,7 +296,7 @@ static int InitThread( adec_thread_t * p_adec )
p_faad_config
=
faacDecGetCurrentConfiguration
(
p_adec
->
p_handle
);
p_faad_config
=
faacDecGetCurrentConfiguration
(
p_adec
->
p_handle
);
p_faad_config
->
outputFormat
=
FAAD_FMT_FLOAT
;
p_faad_config
->
outputFormat
=
FAAD_FMT_FLOAT
;
faacDecSetConfiguration
(
p_adec
->
p_handle
,
p_faad_config
);
faacDecSetConfiguration
(
p_adec
->
p_handle
,
p_faad_config
);
/* Initialize the thread properties */
/* Initialize the thread properties */
p_adec
->
output_format
.
i_format
=
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
);
p_adec
->
output_format
.
i_format
=
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
);
...
@@ -307,7 +308,7 @@ static int InitThread( adec_thread_t * p_adec )
...
@@ -307,7 +308,7 @@ static int InitThread( adec_thread_t * p_adec )
p_adec
->
p_aout_input
=
NULL
;
p_adec
->
p_aout_input
=
NULL
;
p_adec
->
pts
=
0
;
p_adec
->
pts
=
0
;
return
(
0
);
return
(
0
);
}
}
...
@@ -350,12 +351,12 @@ static void DecodeThread( adec_thread_t *p_adec )
...
@@ -350,12 +351,12 @@ static void DecodeThread( adec_thread_t *p_adec )
p_adec
->
p_buffer
=
malloc
(
i_frame_size
+
16
);
p_adec
->
p_buffer
=
malloc
(
i_frame_size
+
16
);
p_adec
->
i_buffer
=
i_frame_size
+
16
;
p_adec
->
i_buffer
=
i_frame_size
+
16
;
}
}
GetPESData
(
p_adec
->
p_buffer
,
p_adec
->
i_buffer
,
p_pes
);
GetPESData
(
p_adec
->
p_buffer
,
p_adec
->
i_buffer
,
p_pes
);
}
}
input_DeletePES
(
p_adec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
input_DeletePES
(
p_adec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
while
(
i_frame_size
<=
0
);
}
while
(
i_frame_size
<=
0
);
/* **** decode this frame **** */
/* **** decode this frame **** */
p_faad_buffer
=
faacDecDecode
(
p_adec
->
p_handle
,
p_faad_buffer
=
faacDecDecode
(
p_adec
->
p_handle
,
&
faad_frame
,
&
faad_frame
,
...
@@ -392,7 +393,7 @@ static void DecodeThread( adec_thread_t *p_adec )
...
@@ -392,7 +393,7 @@ static void DecodeThread( adec_thread_t *p_adec )
#endif
#endif
/* **** Now we can output these samples **** */
/* **** Now we can output these samples **** */
/* **** First check if we have a valid output **** */
/* **** First check if we have a valid output **** */
if
(
(
!
p_adec
->
p_aout_input
)
||
if
(
(
!
p_adec
->
p_aout_input
)
||
(
p_adec
->
output_format
.
i_original_channels
!=
(
p_adec
->
output_format
.
i_original_channels
!=
...
@@ -470,7 +471,7 @@ static void EndThread (adec_thread_t *p_adec)
...
@@ -470,7 +471,7 @@ static void EndThread (adec_thread_t *p_adec)
FREE
(
p_adec
->
p_buffer
);
FREE
(
p_adec
->
p_buffer
);
msg_Dbg
(
p_adec
->
p_fifo
,
"faad decoder closed"
);
msg_Dbg
(
p_adec
->
p_fifo
,
"faad decoder closed"
);
free
(
p_adec
);
free
(
p_adec
);
}
}
modules/codec/ffmpeg/audio.c
View file @
8fce437b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.1
2 2003/01/11 18:10
:49 fenrir Exp $
* $Id: audio.c,v 1.1
3 2003/01/25 16:59
:49 fenrir Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -71,7 +71,7 @@ static unsigned int pi_channels_maps[6] =
...
@@ -71,7 +71,7 @@ static unsigned int pi_channels_maps[6] =
/*****************************************************************************
/*****************************************************************************
* locales Functions
* locales Functions
*****************************************************************************/
*****************************************************************************/
#if 0
static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data )
u8 *p_data )
{
{
...
@@ -93,7 +93,7 @@ static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
...
@@ -93,7 +93,7 @@ static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
p_wh->i_size );
p_wh->i_size );
}
}
}
}
#endif
/*****************************************************************************
/*****************************************************************************
*
*
...
@@ -116,37 +116,34 @@ static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
...
@@ -116,37 +116,34 @@ static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
*****************************************************************************/
*****************************************************************************/
int
E_
(
InitThread_Audio
)(
adec_thread_t
*
p_adec
)
int
E_
(
InitThread_Audio
)(
adec_thread_t
*
p_adec
)
{
{
WAVEFORMATEX
*
p_wf
;
WAVEFORMATEX
wf
,
*
p_wf
;
if
(
(
p_wf
=
p_adec
->
p_fifo
->
p_waveformatex
)
!=
NULL
)
if
(
(
p_wf
=
p_adec
->
p_fifo
->
p_waveformatex
)
==
NULL
)
{
ffmpeg_GetWaveFormatEx
(
&
p_adec
->
format
,
(
uint8_t
*
)
p_wf
);
}
else
{
{
msg_Warn
(
p_adec
->
p_fifo
,
"audio informations missing"
);
msg_Warn
(
p_adec
->
p_fifo
,
"audio informations missing"
);
p_wf
=
&
wf
;
memset
(
p_wf
,
0
,
sizeof
(
WAVEFORMATEX
)
);
}
}
/* ***** Fill p_context with init values ***** */
/* ***** Fill p_context with init values ***** */
p_adec
->
p_context
->
sample_rate
=
p_
adec
->
format
.
i_samplespers
ec
;
p_adec
->
p_context
->
sample_rate
=
p_
wf
->
nSamplesPerS
ec
;
p_adec
->
p_context
->
channels
=
p_
adec
->
format
.
i_nb_c
hannels
;
p_adec
->
p_context
->
channels
=
p_
wf
->
nC
hannels
;
#if LIBAVCODEC_BUILD >= 4618
#if LIBAVCODEC_BUILD >= 4618
p_adec
->
p_context
->
block_align
=
p_
adec
->
format
.
i_blocka
lign
;
p_adec
->
p_context
->
block_align
=
p_
wf
->
nBlockA
lign
;
#endif
#endif
p_adec
->
p_context
->
bit_rate
=
p_
adec
->
format
.
i_avgbytespers
ec
*
8
;
p_adec
->
p_context
->
bit_rate
=
p_
wf
->
nAvgBytesPerS
ec
*
8
;
if
(
(
p_adec
->
p_context
->
extradata_size
=
p_
adec
->
format
.
i_s
ize
)
>
0
)
if
(
(
p_adec
->
p_context
->
extradata_size
=
p_
wf
->
cbS
ize
)
>
0
)
{
{
p_adec
->
p_context
->
extradata
=
p_adec
->
p_context
->
extradata
=
malloc
(
p_
adec
->
format
.
i_s
ize
);
malloc
(
p_
wf
->
cbS
ize
);
memcpy
(
p_adec
->
p_context
->
extradata
,
memcpy
(
p_adec
->
p_context
->
extradata
,
p_adec
->
format
.
p_data
,
&
p_wf
[
1
]
,
p_
adec
->
format
.
i_size
);
p_
wf
->
cbSize
);
}
}
/* ***** Open the codec ***** */
/* ***** Open the codec ***** */
if
(
avcodec_open
(
p_adec
->
p_context
,
p_adec
->
p_codec
)
<
0
)
if
(
avcodec_open
(
p_adec
->
p_context
,
p_adec
->
p_codec
)
<
0
)
{
{
msg_Err
(
p_adec
->
p_fifo
,
msg_Err
(
p_adec
->
p_fifo
,
...
@@ -165,10 +162,10 @@ int E_( InitThread_Audio )( adec_thread_t *p_adec )
...
@@ -165,10 +162,10 @@ int E_( InitThread_Audio )( adec_thread_t *p_adec )
p_adec
->
output_format
.
i_format
=
AOUT_FMT_S16_NE
;
p_adec
->
output_format
.
i_format
=
AOUT_FMT_S16_NE
;
p_adec
->
output_format
.
i_rate
=
p_
adec
->
format
.
i_samplespers
ec
;
p_adec
->
output_format
.
i_rate
=
p_
wf
->
nSamplesPerS
ec
;
p_adec
->
output_format
.
i_physical_channels
p_adec
->
output_format
.
i_physical_channels
=
p_adec
->
output_format
.
i_original_channels
=
p_adec
->
output_format
.
i_original_channels
=
p_
adec
->
format
.
i_nb_c
hannels
;
=
p_
wf
->
nC
hannels
;
p_adec
->
p_aout
=
NULL
;
p_adec
->
p_aout
=
NULL
;
p_adec
->
p_aout_input
=
NULL
;
p_adec
->
p_aout_input
=
NULL
;
...
@@ -355,12 +352,13 @@ usenextdata:
...
@@ -355,12 +352,13 @@ usenextdata:
*****************************************************************************/
*****************************************************************************/
void
E_
(
EndThread_Audio
)(
adec_thread_t
*
p_adec
)
void
E_
(
EndThread_Audio
)(
adec_thread_t
*
p_adec
)
{
{
FREE
(
p_adec
->
format
.
p_data
);
// FREE( p_adec->format.p_data );
FREE
(
p_adec
->
p_output
);
if
(
p_adec
->
p_aout_input
)
if
(
p_adec
->
p_aout_input
)
{
{
aout_DecDelete
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
);
aout_DecDelete
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
);
}
}
}
}
modules/codec/ffmpeg/audio.h
View file @
8fce437b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* audio.h: video decoder using ffmpeg library
* audio.h: video decoder using ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.h,v 1.
2 2002/11/14 22:38:47 massiot
Exp $
* $Id: audio.h,v 1.
3 2003/01/25 16:59:49 fenrir
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -40,19 +40,19 @@ typedef struct adec_thread_s
...
@@ -40,19 +40,19 @@ typedef struct adec_thread_s
{
{
DECODER_THREAD_COMMON
DECODER_THREAD_COMMON
waveformatex_t
format
;
//
waveformatex_t format;
/*
/*
* Output properties
* Output properties
*/
*/
u
8
*
p_output
;
u
int8_t
*
p_output
;
aout_instance_t
*
p_aout
;
/* opaque */
aout_instance_t
*
p_aout
;
/* opaque */
aout_input_t
*
p_aout_input
;
/* opaque */
aout_input_t
*
p_aout_input
;
/* opaque */
audio_sample_format_t
output_format
;
audio_sample_format_t
output_format
;
audio_date_t
date
;
audio_date_t
date
;
}
adec_thread_t
;
}
adec_thread_t
;
...
...
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