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
22d851e1
Commit
22d851e1
authored
Jan 25, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all : fixed some memory leaks thanks valgrind.
parent
25eea88d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
222 additions
and
167 deletions
+222
-167
modules/demux/aac/demux.c
modules/demux/aac/demux.c
+68
-60
modules/demux/asf/asf.c
modules/demux/asf/asf.c
+2
-2
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+4
-2
modules/demux/avi/libavi.c
modules/demux/avi/libavi.c
+16
-2
modules/demux/avi/libavi.h
modules/demux/avi/libavi.h
+8
-1
modules/demux/demuxdump.c
modules/demux/demuxdump.c
+9
-9
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.c
+58
-54
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+7
-3
modules/demux/wav/wav.c
modules/demux/wav/wav.c
+50
-34
No files found.
modules/demux/aac/demux.c
View file @
22d851e1
...
...
@@ -2,15 +2,15 @@
* demux.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demux.c,v 1.
4 2003/01/20 13:03:03
fenrir Exp $
* $Id: demux.c,v 1.
5 2003/01/25 16:58:34
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...
...
@@ -35,9 +35,9 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
);
static
int
Demux
(
input_thread_t
*
);
static
int
Activate
(
vlc_object_t
*
);
static
int
Demux
(
input_thread_t
*
);
static
void
Deactivate
(
vlc_object_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -50,9 +50,9 @@ vlc_module_begin();
vlc_module_end
();
/*****************************************************************************
* Definitions of structures and functions used by this plugins
* Definitions of structures and functions used by this plugins
*****************************************************************************/
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
/* XXX set this to 0 to avoid problem with PS XXX */
/* but with some file or web radio will failed to detect */
/* it's you to choose */
...
...
@@ -84,22 +84,22 @@ typedef struct adts_header_s
int
i_adts_buffer_fullness
;
int
i_no_raw_data_blocks_in_frame
;
int
i_crc_check
;
}
adts_header_t
;
/* Not yet used */
typedef
struct
adif_header_s
{
int
b_copyright_id_present
;
u8
i_copyright_id
[
10
];
int
b_original_copy
;
int
b_copyright_id_present
;
uint8_t
i_copyright_id
[
10
];
int
i_home
;
int
i_bitstream_type
;
int
i_bitrate
;
int
i_num_program_config_elements
;
int
adif_buffer_fullness
;
int
b_original_copy
;
int
i_home
;
int
i_bitstream_type
;
int
i_bitrate
;
int
i_num_program_config_elements
;
int
adif_buffer_fullness
;
// program_config_element
...
...
@@ -131,16 +131,16 @@ struct demux_sys_t
* bit_* : function to get a bitstream from a memory buffer
****************************************************************************
*
****************************************************************************/
****************************************************************************/
typedef
struct
bit_s
{
u
8
*
p_buffer
;
u
int8_t
*
p_buffer
;
int
i_buffer
;
int
i_mask
;
}
bit_t
;
static
void
bit_init
(
bit_t
*
p_bit
,
u
8
*
p_buffer
,
u
int8_t
*
p_buffer
,
int
i_buffer
)
{
p_bit
->
p_buffer
=
p_buffer
;
...
...
@@ -148,15 +148,15 @@ static void bit_init( bit_t *p_bit,
p_bit
->
i_mask
=
0x80
;
}
static
u
32
bit_get
(
bit_t
*
p_bit
)
static
u
int32_t
bit_get
(
bit_t
*
p_bit
)
{
u
32
i_bit
;
u
int32_t
i_bit
;
if
(
p_bit
->
i_buffer
<=
0
)
{
return
(
0
);
}
i_bit
=
(
p_bit
->
p_buffer
[
0
]
&
p_bit
->
i_mask
)
?
1
:
0
;
p_bit
->
i_mask
>>=
1
;
if
(
!
p_bit
->
i_mask
)
{
...
...
@@ -167,9 +167,9 @@ static u32 bit_get( bit_t *p_bit )
return
(
i_bit
);
}
static
u
32
bit_gets
(
bit_t
*
p_bit
,
int
i_count
)
static
u
int32_t
bit_gets
(
bit_t
*
p_bit
,
int
i_count
)
{
u
32
i_bits
;
u
int32_t
i_bits
;
i_bits
=
0
;
for
(
;
i_count
>
0
;
i_count
--
)
{
...
...
@@ -185,7 +185,7 @@ static u32 bit_gets( bit_t *p_bit, int i_count )
* SkipBytes : skip bytes :) not yet uoptimised ( read bytes to be skipped )
*
* ReadPes : read data and make a PES
*
*
*****************************************************************************/
static
int
SkipBytes
(
input_thread_t
*
p_input
,
int
i_size
)
{
...
...
@@ -205,14 +205,14 @@ static int SkipBytes( input_thread_t *p_input, int i_size )
return
(
1
);
}
static
int
ReadPES
(
input_thread_t
*
p_input
,
pes_packet_t
**
pp_pes
,
static
int
ReadPES
(
input_thread_t
*
p_input
,
pes_packet_t
**
pp_pes
,
int
i_size
)
{
pes_packet_t
*
p_pes
;
*
pp_pes
=
NULL
;
if
(
!
(
p_pes
=
input_NewPES
(
p_input
->
p_method_data
))
)
{
msg_Err
(
p_input
,
"cannot allocate new PES"
);
...
...
@@ -224,8 +224,8 @@ static int ReadPES( input_thread_t *p_input,
data_packet_t
*
p_data
;
int
i_read
;
if
(
(
i_read
=
input_SplitBuffer
(
p_input
,
&
p_data
,
if
(
(
i_read
=
input_SplitBuffer
(
p_input
,
&
p_data
,
__MIN
(
i_size
,
1024
)
)
)
<=
0
)
{
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
...
...
@@ -256,7 +256,7 @@ static int ReadPES( input_thread_t *p_input,
static
int
GetADIF
(
input_thread_t
*
p_input
,
adif_header_t
*
p_adif
)
{
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
int
i_size
;
if
(
(
i_size
=
input_Peek
(
p_input
,
&
p_peek
,
60
)
)
<
60
)
...
...
@@ -269,9 +269,9 @@ static int GetADIF( input_thread_t *p_input,
{
return
(
0
);
}
/* we now that we have an adif header */
// return( 1 );
return
(
0
);
/* need some work */
}
...
...
@@ -285,7 +285,7 @@ static int GetADTS( input_thread_t *p_input,
int
i_max_pos
,
int
*
pi_skip
)
{
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
int
i_size
;
bit_t
bit
;
...
...
@@ -315,7 +315,7 @@ static int GetADTS( input_thread_t *p_input,
bit_init
(
&
bit
,
p_peek
,
i_size
);
bit_gets
(
&
bit
,
12
);
/* synchro bits */
p_adts
->
i_id
=
bit_get
(
&
bit
);
p_adts
->
i_layer
=
bit_gets
(
&
bit
,
2
);
p_adts
->
i_protection_absent
=
bit_get
(
&
bit
);
...
...
@@ -354,7 +354,7 @@ static void ExtractConfiguration( demux_sys_t *p_aac )
p_aac
->
i_samplerate_index
=
p_aac
->
adts_header
.
i_samplerate_index
;
p_aac
->
i_object_type
=
p_aac
->
adts_header
.
i_profile
;
p_aac
->
i_samplerate
=
i_aac_samplerate
[
p_aac
->
i_samplerate_index
];
p_aac
->
i_channels
=
p_aac
->
adts_header
.
i_channel_configuration
;
p_aac
->
i_channels
=
p_aac
->
adts_header
.
i_channel_configuration
;
if
(
p_aac
->
i_channels
>
6
)
{
/* I'm not sure of that, got from faad */
...
...
@@ -381,7 +381,7 @@ static void ExtractConfiguration( demux_sys_t *p_aac )
static
int
CheckPS
(
input_thread_t
*
p_input
)
{
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
int
i_size
=
input_Peek
(
p_input
,
&
p_peek
,
8196
);
while
(
i_size
>
4
)
...
...
@@ -406,7 +406,7 @@ static int Activate( vlc_object_t * p_this )
demux_sys_t
*
p_aac
;
input_info_category_t
*
p_category
;
module_t
*
p_id3
;
int
i_skip
;
int
b_forced
;
...
...
@@ -422,19 +422,19 @@ static int Activate( vlc_object_t * p_this )
b_forced
=
(
(
*
p_input
->
psz_demux
)
&&
(
!
strncmp
(
p_input
->
psz_demux
,
"aac"
,
10
)
)
)
?
1
:
0
;
/* check if it can be a ps stream */
if
(
!
b_forced
&&
CheckPS
(
p_input
)
)
{
return
(
-
1
);
}
/* skip possible id3 header */
/* skip possible id3 header */
p_id3
=
module_Need
(
p_input
,
"id3"
,
NULL
);
if
(
p_id3
)
{
module_Unneed
(
p_input
,
p_id3
);
}
/* allocate p_aac */
if
(
!
(
p_aac
=
malloc
(
sizeof
(
demux_sys_t
)
)
)
)
{
...
...
@@ -442,7 +442,7 @@ static int Activate( vlc_object_t * p_this )
return
(
-
1
);
}
memset
(
p_aac
,
0
,
sizeof
(
demux_sys_t
)
);
/* Now check for adif/adts header */
i_skip
=
0
;
if
(
GetADIF
(
p_input
,
&
p_aac
->
adif_header
)
)
...
...
@@ -454,8 +454,8 @@ static int Activate( vlc_object_t * p_this )
return
(
-
1
);
}
else
if
(
GetADTS
(
p_input
,
&
p_aac
->
adts_header
,
if
(
GetADTS
(
p_input
,
&
p_aac
->
adts_header
,
b_forced
?
8000
:
0
,
&
i_skip
)
)
{
...
...
@@ -478,7 +478,7 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot init stream"
);
return
(
-
1
);
}
}
if
(
input_AddProgram
(
p_input
,
0
,
0
)
==
NULL
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -487,9 +487,9 @@ static int Activate( vlc_object_t * p_this )
}
p_input
->
stream
.
pp_programs
[
0
]
->
b_is_ok
=
0
;
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
/* create our ES */
p_aac
->
p_es
=
input_AddES
(
p_input
,
/* create our ES */
p_aac
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
1
,
/* id */
0
);
...
...
@@ -499,7 +499,7 @@ static int Activate( vlc_object_t * p_this )
msg_Err
(
p_input
,
"out of memory"
);
return
(
-
1
);
}
p_aac
->
p_es
->
i_stream_id
=
1
;
p_aac
->
p_es
->
i_fourcc
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
);
p_aac
->
p_es
->
i_cat
=
AUDIO_ES
;
...
...
@@ -509,7 +509,7 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
if
(
p_aac
->
b_adif_header
)
{
...
...
@@ -547,7 +547,7 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_category
=
input_InfoCategory
(
p_input
,
"aac"
);
input_AddInfo
(
p_category
,
"input type"
,
"MPEG-%d AAC"
,
p_aac
->
adts_header
.
i_id
==
1
?
2
:
4
);
...
...
@@ -562,7 +562,7 @@ static int Activate( vlc_object_t * p_this )
}
p_input
->
p_demux_data
=
p_aac
;
return
(
0
);
}
...
...
@@ -576,7 +576,7 @@ static int Demux( input_thread_t * p_input )
{
int
i_skip
;
int
i_found
;
pes_packet_t
*
p_pes
;
demux_sys_t
*
p_aac
=
p_input
->
p_demux_data
;
...
...
@@ -589,7 +589,7 @@ static int Demux( input_thread_t * p_input )
else
if
(
p_aac
->
b_adts_header
)
{
i_found
=
GetADTS
(
p_input
,
i_found
=
GetADTS
(
p_input
,
&
p_aac
->
adts_header
,
8000
,
&
i_skip
);
...
...
@@ -599,7 +599,7 @@ static int Demux( input_thread_t * p_input )
return
(
-
1
);
}
ExtractConfiguration
(
p_aac
);
/* skip garbage bytes */
if
(
i_skip
>
0
)
{
...
...
@@ -614,11 +614,11 @@ static int Demux( input_thread_t * p_input )
msg_Info
(
p_input
,
"can't find next frame"
);
return
(
0
);
}
input_ClockManageRef
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_aac
->
i_pts
);
if
(
!
ReadPES
(
p_input
,
&
p_pes
,
p_aac
->
i_aac_frame_length
)
)
{
msg_Warn
(
p_input
,
...
...
@@ -642,10 +642,18 @@ static int Demux( input_thread_t * p_input )
}
/* Update date information */
p_aac
->
i_pts
+=
(
mtime_t
)
90000
*
p_aac
->
i_pts
+=
(
mtime_t
)
90000
*
(
mtime_t
)
p_aac
->
i_framelength
/
(
mtime_t
)
p_aac
->
i_samplerate
;
return
(
1
);
}
static
void
Deactivate
(
vlc_object_t
*
p_this
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
// demux_sys_t *p_aac = p_input->p_demux_data;
FREE
(
p_input
->
p_demux_data
);
}
modules/demux/asf/asf.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.1
7 2003/01/23 15:07:20
fenrir Exp $
* $Id: asf.c,v 1.1
8 2003/01/25 16:58:34
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -858,7 +858,7 @@ static void Deactivate( vlc_object_t * p_this )
}
#undef p_stream
}
FREE
(
p_input
->
p_demux_data
);
#undef FREE
}
modules/demux/avi/avi.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.3
0 2003/01/25 03:12:20
fenrir Exp $
* $Id: avi.c,v 1.3
1 2003/01/25 16:58:34
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -52,7 +52,7 @@ static int AVIDemux_Seekable ( input_thread_t * );
static
int
AVIDemux_UnSeekable
(
input_thread_t
*
p_input
);
#define AVIEnd(a) __AVIEnd(VLC_OBJECT(a))
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
/*****************************************************************************
* Module descriptor
*****************************************************************************/
...
...
@@ -793,6 +793,8 @@ static void __AVIEnd ( vlc_object_t * p_this )
}
#endif
AVI_ChunkFreeRoot
(
p_input
,
&
p_avi
->
ck_root
);
FREE
(
p_input
->
p_demux_data
);
}
/*****************************************************************************
...
...
modules/demux/avi/libavi.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* libavi.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.1
4 2003/01/20 13:01:53
fenrir Exp $
* $Id: libavi.c,v 1.1
5 2003/01/25 16:58:34
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -520,6 +520,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
switch
(
p_strh
->
strh
.
i_type
)
{
case
(
AVIFOURCC_auds
):
p_chk
->
strf
.
auds
.
i_cat
=
AUDIO_ES
;
p_chk
->
strf
.
auds
.
p_wf
=
malloc
(
p_chk
->
common
.
i_chunk_size
);
AVI_READ2BYTES
(
p_chk
->
strf
.
auds
.
p_wf
->
wFormatTag
);
AVI_READ2BYTES
(
p_chk
->
strf
.
auds
.
p_wf
->
nChannels
);
...
...
@@ -561,6 +562,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
break
;
case
(
AVIFOURCC_vids
):
p_strh
->
strh
.
i_samplesize
=
0
;
// XXX for ffmpeg avi file
p_chk
->
strf
.
vids
.
i_cat
=
VIDEO_ES
;
p_chk
->
strf
.
vids
.
p_bih
=
malloc
(
p_chk
->
common
.
i_chunk_size
);
AVI_READ4BYTES
(
p_chk
->
strf
.
vids
.
p_bih
->
biSize
);
AVI_READ4BYTES
(
p_chk
->
strf
.
vids
.
p_bih
->
biWidth
);
...
...
@@ -597,6 +599,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
break
;
default:
msg_Warn
(
p_input
,
"unknown stream type"
);
p_chk
->
strf
.
common
.
i_cat
=
UNKNOWN_ES
;
break
;
}
AVI_READCHUNK_EXIT
(
VLC_SUCCESS
);
...
...
@@ -604,7 +607,18 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
static
void
AVI_ChunkFree_strf
(
input_thread_t
*
p_input
,
avi_chunk_t
*
p_chk
)
{
avi_chunk_strf_t
*
p_strf
=
(
avi_chunk_strf_t
*
)
p_chk
;
switch
(
p_strf
->
common
.
i_cat
)
{
case
AUDIO_ES
:
FREE
(
p_strf
->
auds
.
p_wf
);
break
;
case
VIDEO_ES
:
FREE
(
p_strf
->
vids
.
p_bih
);
break
;
default:
break
;
}
}
static
int
AVI_ChunkRead_strd
(
input_thread_t
*
p_input
,
...
...
modules/demux/avi/libavi.h
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* libavi.h : LibAVI library
******************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libavi.h,v 1.
6 2002/12/06 16:34:06 sam
Exp $
* $Id: libavi.h,v 1.
7 2003/01/25 16:58:34 fenrir
Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -237,12 +237,14 @@ typedef struct avi_chunk_strh_s
typedef
struct
avi_chunk_strf_auds_s
{
AVI_CHUNK_COMMON
int
i_cat
;
WAVEFORMATEX
*
p_wf
;
}
avi_chunk_strf_auds_t
;
typedef
struct
avi_chunk_strf_vids_s
{
AVI_CHUNK_COMMON
int
i_cat
;
BITMAPINFOHEADER
*
p_bih
;
}
avi_chunk_strf_vids_t
;
...
...
@@ -250,6 +252,11 @@ typedef union avi_chunk_strf_u
{
avi_chunk_strf_auds_t
auds
;
avi_chunk_strf_vids_t
vids
;
struct
{
AVI_CHUNK_COMMON
int
i_cat
;
}
common
;
}
avi_chunk_strf_t
;
typedef
struct
avi_chunk_strd_s
...
...
modules/demux/demuxdump.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* demuxdump.c : Pseudo demux module for vlc (dump raw stream)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demuxdump.c,v 1.
2 2002/12/18 14:17:10 sam
Exp $
* $Id: demuxdump.c,v 1.
3 2003/01/25 16:58:34 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -113,7 +113,7 @@ static int Activate( vlc_object_t * p_this )
psz_name
);
p_demux
->
psz_name
=
psz_name
;
}
p_demux
->
i_write
=
0
;
p_demux
->
p_demux_data_sav
=
p_input
->
p_demux_data
;
...
...
@@ -124,7 +124,7 @@ static int Activate( vlc_object_t * p_this )
}
else
{
if
(
input_InitStream
(
p_input
,
0
)
==
-
1
)
{
fclose
(
p_demux
->
p_file
);
...
...
@@ -133,7 +133,7 @@ static int Activate( vlc_object_t * p_this )
}
input_AddProgram
(
p_input
,
0
,
0
);
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_area
->
i_tell
=
0
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -155,12 +155,12 @@ static void Desactivate ( vlc_object_t *p_this )
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
demux_sys_t
*
p_demux
=
(
demux_sys_t
*
)
p_input
->
p_demux_data
;
msg_Info
(
p_input
,
"closing %s ("
I64Fd
" Kbytes dumped)"
,
msg_Info
(
p_input
,
"closing %s ("
I64Fd
" Kbytes dumped)"
,
p_demux
->
psz_name
,
p_demux
->
i_write
/
1024
);
if
(
p_demux
->
p_file
)
{
fclose
(
p_demux
->
p_file
);
...
...
@@ -168,7 +168,7 @@ static void Desactivate ( vlc_object_t *p_this )
}
if
(
p_demux
->
psz_name
)
{
free
(
p_demux
->
psz_name
);
free
(
p_demux
->
psz_name
);
}
p_input
->
p_demux_data
=
p_demux
->
p_demux_data_sav
;
free
(
p_demux
);
...
...
modules/demux/mp4/libmp4.c
View file @
22d851e1
...
...
@@ -2,14 +2,14 @@
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.1
2 2003/01/13 02:30:11
fenrir Exp $
* $Id: libmp4.c,v 1.1
3 2003/01/25 16:58:34
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...
...
@@ -35,8 +35,8 @@
#include "libmp4.h"
/*****************************************************************************
* Here are defined some macro to make life simpler but before using it
* *look* at the code.
* Here are defined some macro to make life simpler but before using it
* *look* at the code.
*
* XXX: All macro are written in capital letters
*
...
...
@@ -44,7 +44,7 @@
#define MP4_BOX_HEADERSIZE( p_box ) \
( 8 + ( p_box->i_shortsize == 1 ? 8 : 0 ) \
+ ( p_box->i_type == FOURCC_uuid ? 16 : 0 ) )
#define MP4_BOX_DESCEND( p_box ) \
MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) )
...
...
@@ -59,18 +59,18 @@
#define MP4_GET4BYTES( dst ) \
dst = GetDWBE( p_peek ); p_peek += 4; i_read -= 4
#define MP4_GETFOURCC( dst ) \
dst = VLC_FOURCC( p_peek[0], p_peek[1], p_peek[2], p_peek[3] ); \
p_peek += 4; i_read -= 4
#define MP4_GET8BYTES( dst ) \
dst = GetQWBE( p_peek ); p_peek += 8; i_read -= 8
#define MP4_GETVERSIONFLAGS( p_void ) \
MP4_GET1BYTE( p_void->i_version ); \
MP4_GET3BYTES( p_void->i_flags )
#define MP4_GETSTRINGZ( p_str ) \
if( ( i_read > 0 )&&(p_peek[0] ) ) \
{ \
...
...
@@ -84,7 +84,7 @@
{ \
p_str = NULL; \
}
#define MP4_READBOX_ENTER( MP4_Box_data_TYPE_t ) \
int64_t i_read = p_box->i_size; \
...
...
@@ -105,8 +105,8 @@
{ \
free( p_buff ); \
return( 0 ); \
}
}
#define MP4_READBOX_EXIT( i_code ) \
free( p_buff ); \
if( i_read < 0 ) \
...
...
@@ -117,12 +117,12 @@
#define FREE( p ) \
if( p ) {free( p ); p = NULL; }
/* Some assumptions:
* The input method HAVE to be seekable
* The input method HAVE to be seekable
*/
/* Some functions to manipulate memory */
...
...
@@ -187,7 +187,7 @@ void MP4_ConvertDate2Str( char *psz, uint64_t i_date )
i_hour
=
(
i_date
/
(
60
*
60
)
)
%
60
;
i_min
=
(
i_date
/
60
)
%
60
;
i_sec
=
i_date
%
60
;
/* FIXME do it correctly, date begin at 1 jan 1904 */
/* FIXME do it correctly, date begin at 1 jan 1904 */
sprintf
(
psz
,
"%dd-%2.2dh:%2.2dm:%2.2ds"
,
i_day
,
i_hour
,
i_min
,
i_sec
);
}
...
...
@@ -198,7 +198,7 @@ void MP4_ConvertDate2Str( char *psz, uint64_t i_date )
* Some basic functions to manipulate stream more easily in vlc
*
* MP4_TellAbsolute get file position
*
*
* MP4_SeekAbsolute seek in the file
*
* MP4_ReadData read data from the file in a buffer
...
...
@@ -207,9 +207,9 @@ void MP4_ConvertDate2Str( char *psz, uint64_t i_date )
off_t
MP4_TellAbsolute
(
input_thread_t
*
p_input
)
{
off_t
i_pos
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
i_pos
=
p_input
->
stream
.
p_selected_area
->
i_tell
;
// ( p_input->p_last_data - p_input->p_current_data );
...
...
@@ -217,7 +217,7 @@ off_t MP4_TellAbsolute( input_thread_t *p_input )
return
(
i_pos
);
}
int
MP4_SeekAbsolute
(
input_thread_t
*
p_input
,
off_t
i_pos
)
{
...
...
@@ -227,7 +227,7 @@ int MP4_SeekAbsolute( input_thread_t *p_input,
{
return
(
0
);
}
i_filepos
=
MP4_TellAbsolute
(
p_input
);
if
(
i_pos
!=
i_filepos
)
{
...
...
@@ -244,7 +244,7 @@ int MP4_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
int
i_read
;
if
(
!
i_size
)
{
return
(
1
);
...
...
@@ -259,12 +259,12 @@ int MP4_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
}
memcpy
(
p_buff
,
p_data
->
p_payload_start
,
i_read
);
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
p_buff
+=
i_read
;
i_size
-=
i_read
;
}
while
(
i_size
);
return
(
1
);
}
...
...
@@ -416,9 +416,9 @@ int MP4_SeekStream( MP4_Stream_t *p_stream, off_t i_pos)
/*****************************************************************************
* MP4_ReadBoxCommon : Load only common parameters for all boxes
* MP4_ReadBoxCommon : Load only common parameters for all boxes
*****************************************************************************
* p_box need to be an already allocated MP4_Box_t, and all data
* p_box need to be an already allocated MP4_Box_t, and all data
* will only be peek not read
*
* RETURN : 0 if it fail, 1 otherwise
...
...
@@ -427,7 +427,7 @@ int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int
i_read
;
uint8_t
*
p_peek
;
if
(
(
(
i_read
=
MP4_PeekStream
(
p_stream
,
&
p_peek
,
32
)
)
<
8
)
)
{
return
(
0
);
...
...
@@ -439,7 +439,7 @@ int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box
->
p_first
=
NULL
;
p_box
->
p_last
=
NULL
;
p_box
->
p_next
=
NULL
;
MP4_GET4BYTES
(
p_box
->
i_shortsize
);
MP4_GETFOURCC
(
p_box
->
i_type
);
...
...
@@ -455,7 +455,7 @@ int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box
->
i_size
=
p_box
->
i_shortsize
;
/* XXX size of 0 means that the box extends to end of file */
}
if
(
p_box
->
i_type
==
FOURCC_uuid
)
{
/* get extented type on 16 bytes */
...
...
@@ -513,7 +513,7 @@ int MP4_NextBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
return
(
MP4_SeekStream
(
p_stream
,
p_box
->
i_size
+
p_box
->
i_pos
)
);
}
/*****************************************************************************
* MP4_MP4_GotoBox : Go to this particular box
* MP4_MP4_GotoBox : Go to this particular box
*****************************************************************************
* RETURN : 0 if it fail, 1 otherwise
*****************************************************************************/
...
...
@@ -524,22 +524,22 @@ int MP4_GotoBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
/*****************************************************************************
* For all known box a loader is given,
* For all known box a loader is given,
* XXX: all common struct have to be already read by MP4_ReadBoxCommon
* after called one of theses functions, file position is unknown
* you need to call MP4_GotoBox to go where you want
* you need to call MP4_GotoBox to go where you want
*****************************************************************************/
int
MP4_ReadBoxContainerRaw
(
MP4_Stream_t
*
p_stream
,
MP4_Box_t
*
p_container
)
{
MP4_Box_t
*
p_box
;
if
(
MP4_TellStream
(
p_stream
)
+
8
>
(
off_t
)(
p_container
->
i_pos
+
p_container
->
i_size
)
)
{
/* there is no box to load */
return
(
0
);
}
do
{
p_box
=
malloc
(
sizeof
(
MP4_Box_t
)
);
...
...
@@ -563,22 +563,22 @@ int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container )
free
(
p_box
);
break
;
}
}
while
(
MP4_NextBox
(
p_stream
,
p_box
)
==
1
);
return
(
1
);
}
int
MP4_ReadBoxContainer
(
MP4_Stream_t
*
p_stream
,
MP4_Box_t
*
p_container
)
{
if
(
p_container
->
i_size
<=
(
size_t
)
MP4_BOX_HEADERSIZE
(
p_container
)
+
8
)
{
/* container is empty, 8 stand for the first header in this box */
return
(
1
);
}
/* enter box */
MP4_BOX_DESCEND
(
p_container
);
...
...
@@ -594,7 +594,7 @@ int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
/* Nothing to do */
#ifdef MP4_VERBOSE
msg_Dbg
(
p_stream
->
p_input
,
"Skip box:
\"
%c%c%c%c
\"
"
,
msg_Dbg
(
p_stream
->
p_input
,
"Skip box:
\"
%c%c%c%c
\"
"
,
(
p_box
->
i_type
)
&
0xff
,
(
p_box
->
i_type
>>
8
)
&
0xff
,
(
p_box
->
i_type
>>
16
)
&
0xff
,
...
...
@@ -606,14 +606,14 @@ int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
int
MP4_ReadBox_ftyp
(
MP4_Stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
MP4_READBOX_ENTER
(
MP4_Box_data_ftyp_t
);
MP4_GETFOURCC
(
p_box
->
data
.
p_ftyp
->
i_major_brand
);
MP4_GET4BYTES
(
p_box
->
data
.
p_ftyp
->
i_minor_version
);
if
(
(
p_box
->
data
.
p_ftyp
->
i_compatible_brands_count
=
i_read
/
4
)
)
{
unsigned
int
i
;
p_box
->
data
.
p_ftyp
->
i_compatible_brands
=
p_box
->
data
.
p_ftyp
->
i_compatible_brands
=
calloc
(
p_box
->
data
.
p_ftyp
->
i_compatible_brands_count
,
sizeof
(
uint32_t
));
for
(
i
=
0
;
i
<
p_box
->
data
.
p_ftyp
->
i_compatible_brands_count
;
i
++
)
...
...
@@ -1168,7 +1168,7 @@ int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_EXIT
(
1
);
}
i_len
=
MP4_ReadLengthDescriptor
(
&
p_peek
,
&
i_read
);
es_descriptor
.
p_decConfigDescr
->
i_decoder_specific_info_len
=
i_len
;
es_descriptor
.
p_decConfigDescr
->
p_decoder_specific_info
=
malloc
(
i_len
);
...
...
@@ -1183,13 +1183,17 @@ int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
void
MP4_FreeBox_esds
(
input_thread_t
*
p_input
,
MP4_Box_t
*
p_box
)
{
FREE
(
p_box
->
data
.
p_esds
->
es_descriptor
.
psz_URL
);
if
(
p_box
->
data
.
p_esds
->
es_descriptor
.
p_decConfigDescr
)
{
FREE
(
p_box
->
data
.
p_esds
->
es_descriptor
.
p_decConfigDescr
->
p_decoder_specific_info
);
}
FREE
(
p_box
->
data
.
p_esds
->
es_descriptor
.
p_decConfigDescr
);
}
int
MP4_ReadBox_sample_soun
(
MP4_Stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
unsigned
int
i
;
unsigned
int
i
;
MP4_READBOX_ENTER
(
MP4_Box_data_sample_soun_t
);
for
(
i
=
0
;
i
<
6
;
i
++
)
...
...
@@ -1198,22 +1202,22 @@ int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
}
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_data_reference_index
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
MP4_GET4BYTES
(
p_box
->
data
.
p_sample_soun
->
i_reserved2
[
i
]
);
}
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_channelcount
);
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_samplesize
);
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_predefined
);
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_reserved3
);
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_sampleratehi
);
MP4_GET2BYTES
(
p_box
->
data
.
p_sample_soun
->
i_sampleratelo
);
MP4_SeekStream
(
p_stream
,
p_box
->
i_pos
+
MP4_BOX_HEADERSIZE
(
p_box
)
+
28
);
MP4_ReadBoxContainerRaw
(
p_stream
,
p_box
);
/* esds */
#ifdef MP4_VERBOSE
msg_Dbg
(
p_stream
->
p_input
,
"Read Box:
\"
soun
\"
in stsd channel %d sample size %d sampl rate %f"
,
p_box
->
data
.
p_sample_soun
->
i_channelcount
,
...
...
@@ -1231,19 +1235,19 @@ int MP4_ReadBox_sample_mp4a( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
unsigned int i;
MP4_READBOX_ENTER( MP4_Box_data_sample_mp4a_t );
for( i = 0; i < 6 ; i++ )
{
MP4_GET1BYTE( p_box->data.p_sample_mp4a->i_reserved1[i] );
}
MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_data_reference_index );
for( i = 0; i < 2 ; i++ )
{
MP4_GET4BYTES( p_box->data.p_sample_mp4a->i_reserved2[i] );
}
MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_channelcount );
MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_samplesize );
MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_predefined );
...
...
modules/demux/mp4/mp4.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.1
2 2003/01/08 10:46:30
fenrir Exp $
* $Id: mp4.c,v 1.1
3 2003/01/25 16:58:34
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -441,6 +441,7 @@ static void __MP4End ( vlc_object_t * p_this )
FREE
(
p_demux
->
track
[
i_track
].
chunk
[
i_chunk
].
p_sample_delta_dts
);
}
}
FREE
(
p_demux
->
track
[
i_track
].
chunk
);
if
(
!
p_demux
->
track
[
i_track
].
i_sample_size
)
{
...
...
@@ -448,6 +449,8 @@ static void __MP4End ( vlc_object_t * p_this )
}
}
FREE
(
p_demux
->
track
);
FREE
(
p_input
->
p_demux_data
);
#undef FREE
}
...
...
@@ -1057,7 +1060,8 @@ static void MP4_StartDecoder( input_thread_t *p_input,
case
(
VIDEO_ES
):
/* now create a bitmapinfoheader_t for decoder and
add information found in p_esds */
p_init
=
malloc
(
sizeof
(
BITMAPINFOHEADER
)
+
i_decoder_specific_info_len
);
/* XXX XXX + 16 are for avoid segfault when ffmpeg access beyong the data */
p_init
=
malloc
(
sizeof
(
BITMAPINFOHEADER
)
+
i_decoder_specific_info_len
+
16
);
p_bih
=
(
BITMAPINFOHEADER
*
)
p_init
;
p_bih
->
biSize
=
sizeof
(
BITMAPINFOHEADER
)
+
i_decoder_specific_info_len
;
...
...
@@ -1117,7 +1121,7 @@ static void MP4_StartDecoder( input_thread_t *p_input,
break
;
case
(
AUDIO_ES
):
p_init
=
malloc
(
sizeof
(
WAVEFORMATEX
)
+
i_decoder_specific_info_len
);
p_init
=
malloc
(
sizeof
(
WAVEFORMATEX
)
+
i_decoder_specific_info_len
+
16
);
p_wf
=
(
WAVEFORMATEX
*
)
p_init
;
p_wf
->
wFormatTag
=
0
;
...
...
modules/demux/wav/wav.c
View file @
22d851e1
...
...
@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.c,v 1.
9 2003/01/07 21:49:01
fenrir Exp $
* $Id: wav.c,v 1.
10 2003/01/25 16:58:35
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -60,18 +60,18 @@ vlc_module_end();
#define __EVEN( x ) ( (x)%2 != 0 ) ? ((x)+1) : (x)
/* Some functions to manipulate memory */
static
u
16
GetWLE
(
u8
*
p_buff
)
static
u
int16_t
GetWLE
(
uint8_t
*
p_buff
)
{
return
(
(
p_buff
[
0
])
+
(
p_buff
[
1
]
<<
8
)
);
}
static
u
32
GetDWLE
(
u8
*
p_buff
)
static
u
int32_t
GetDWLE
(
uint8_t
*
p_buff
)
{
return
(
p_buff
[
0
]
+
(
p_buff
[
1
]
<<
8
)
+
(
p_buff
[
2
]
<<
16
)
+
(
p_buff
[
3
]
<<
24
)
);
}
static
u
32
CreateDWLE
(
int
a
,
int
b
,
int
c
,
int
d
)
static
u
int32_t
CreateDWLE
(
int
a
,
int
b
,
int
c
,
int
d
)
{
return
(
a
+
(
b
<<
8
)
+
(
c
<<
16
)
+
(
d
<<
24
)
);
}
...
...
@@ -116,13 +116,13 @@ static int SkipBytes( input_thread_t *p_input, int i_skip )
}
/* return 1 if success, 0 if fail */
static
int
ReadData
(
input_thread_t
*
p_input
,
u
8
*
p_buff
,
int
i_size
)
static
int
ReadData
(
input_thread_t
*
p_input
,
u
int8_t
*
p_buff
,
int
i_size
)
{
data_packet_t
*
p_data
;
int
i_read
;
if
(
!
i_size
)
{
return
(
1
);
...
...
@@ -137,12 +137,12 @@ static int ReadData( input_thread_t *p_input, u8 *p_buff, int i_size )
}
memcpy
(
p_buff
,
p_data
->
p_payload_start
,
i_read
);
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
p_buff
+=
i_read
;
i_size
-=
i_read
;
}
while
(
i_size
);
return
(
1
);
}
...
...
@@ -154,7 +154,7 @@ static int ReadPES( input_thread_t *p_input,
pes_packet_t
*
p_pes
;
*
pp_pes
=
NULL
;
if
(
!
(
p_pes
=
input_NewPES
(
p_input
->
p_method_data
))
)
{
msg_Err
(
p_input
,
"cannot allocate new PES"
);
...
...
@@ -192,11 +192,11 @@ static int ReadPES( input_thread_t *p_input,
return
(
1
);
}
static
int
FindTag
(
input_thread_t
*
p_input
,
u
32
i_tag
)
static
int
FindTag
(
input_thread_t
*
p_input
,
u
int32_t
i_tag
)
{
u
32
i_id
;
u
32
i_size
;
u
8
*
p_peek
;
u
int32_t
i_id
;
u
int32_t
i_size
;
u
int8_t
*
p_peek
;
for
(
;;
)
{
...
...
@@ -226,10 +226,10 @@ static int FindTag( input_thread_t *p_input, u32 i_tag )
static
int
LoadTag_fmt
(
input_thread_t
*
p_input
,
demux_sys_t
*
p_demux
)
{
u
8
*
p_peek
;
u
32
i_size
;
u
int8_t
*
p_peek
;
u
int32_t
i_size
;
WAVEFORMATEX
*
p_wf
;
if
(
input_Peek
(
p_input
,
&
p_peek
,
8
)
<
8
)
{
...
...
@@ -277,14 +277,14 @@ static int PCM_GetFrame( input_thread_t *p_input,
/* read samples for 50ms of */
i_samples
=
__MAX
(
p_wf
->
nSamplesPerSec
/
20
,
1
);
*
pi_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_wf
->
nSamplesPerSec
;
i_bytes
=
i_samples
*
p_wf
->
nChannels
*
(
(
p_wf
->
wBitsPerSample
+
7
)
/
8
);
if
(
p_wf
->
nBlockAlign
>
0
)
{
if
(
(
i_modulo
=
i_bytes
%
p_wf
->
nBlockAlign
)
!=
0
)
...
...
@@ -305,7 +305,7 @@ static int MS_ADPCM_GetFrame( input_thread_t *p_input,
i_samples
=
2
+
2
*
(
p_wf
->
nBlockAlign
-
7
*
p_wf
->
nChannels
)
/
p_wf
->
nChannels
;
*
pi_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_wf
->
nSamplesPerSec
;
...
...
@@ -336,8 +336,8 @@ static int IMA_ADPCM_GetFrame( input_thread_t *p_input,
static
int
WAVInit
(
vlc_object_t
*
p_this
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
u
8
*
p_peek
;
u
32
i_size
;
u
int8_t
*
p_peek
;
u
int32_t
i_size
;
demux_sys_t
*
p_demux
;
...
...
@@ -380,7 +380,7 @@ static int WAVInit( vlc_object_t * p_this )
return
(
-
1
);
}
memset
(
p_demux
,
0
,
sizeof
(
demux_sys_t
)
);
/* Load WAVEFORMATEX header */
if
(
!
LoadTag_fmt
(
p_input
,
p_demux
)
)
{
...
...
@@ -396,7 +396,7 @@ static int WAVInit( vlc_object_t * p_this )
p_demux
->
p_wf
->
nBlockAlign
,
p_demux
->
p_wf
->
wBitsPerSample
,
p_demux
->
p_wf
->
cbSize
);
if
(
!
FindTag
(
p_input
,
CreateDWLE
(
'd'
,
'a'
,
't'
,
'a'
)
)
)
{
msg_Err
(
p_input
,
"cannot find
\"
data
\"
tag"
);
...
...
@@ -593,12 +593,12 @@ static int WAVDemux( input_thread_t *p_input )
}
if
(
p_demux
->
p_wf
->
nBlockAlign
!=
0
)
{
i_offset
+=
p_demux
->
p_wf
->
nBlockAlign
-
i_offset
+=
p_demux
->
p_wf
->
nBlockAlign
-
i_offset
%
p_demux
->
p_wf
->
nBlockAlign
;
}
SeekAbsolute
(
p_input
,
p_demux
->
i_data_pos
+
i_offset
);
}
input_ClockManageRef
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_demux
->
i_pcr
);
...
...
@@ -615,11 +615,11 @@ static int WAVDemux( input_thread_t *p_input )
return
(
0
);
}
p_pes
->
i_dts
=
p_pes
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_pes
->
i_dts
=
p_pes
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_demux
->
i_pcr
);
if
(
!
p_demux
->
p_es
->
p_decoder_fifo
)
{
msg_Err
(
p_input
,
"no audio decoder"
);
...
...
@@ -630,7 +630,7 @@ static int WAVDemux( input_thread_t *p_input )
{
input_DecodePES
(
p_demux
->
p_es
->
p_decoder_fifo
,
p_pes
);
}
p_demux
->
i_pcr
+=
i_length
*
9
/
100
;
return
(
1
);
}
...
...
@@ -639,17 +639,33 @@ static int WAVDemux( input_thread_t *p_input )
* WAVEnd: frees unused data
*****************************************************************************/
static
void
__WAVEnd
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
demux_sys_t
*
p_demux
=
p_input
->
p_demux_data
;
FREE
(
p_demux
->
p_wf
);
FREE
(
p_demux
->
psz_demux
);
if
(
p_demux
->
p_demux
)
{
char
*
psz_sav
;
/* save context */
psz_sav
=
p_input
->
psz_demux
;
/* switch context */
p_input
->
pf_demux
=
p_demux
->
pf_demux
;
p_input
->
p_demux_data
=
p_demux
->
p_demux_data
;
p_input
->
psz_demux
=
p_demux
->
psz_demux
;
/* unload module */
module_Unneed
(
p_input
,
p_demux
->
p_demux
);
/* switch back */
p_input
->
psz_demux
=
psz_sav
;
p_input
->
p_demux_data
=
p_demux
;
}
FREE
(
p_input
->
p_demux_data
);
}
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