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
8b807a4e
Commit
8b807a4e
authored
Sep 27, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/wav.c: misc improvements.
parent
d4ccb69d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
55 deletions
+37
-55
modules/demux/wav.c
modules/demux/wav.c
+37
-55
No files found.
modules/demux/wav.c
View file @
8b807a4e
...
@@ -57,18 +57,19 @@ struct demux_sys_t
...
@@ -57,18 +57,19 @@ struct demux_sys_t
int64_t
i_data_pos
;
int64_t
i_data_pos
;
unsigned
int
i_data_size
;
unsigned
int
i_data_size
;
mtime_t
i_time
;
unsigned
int
i_frame_size
;
unsigned
int
i_frame_size
;
mtime_t
i_frame_length
;
int
i_frame_samples
;
date_t
pts
;
};
};
#define __EVEN( x ) ( ( (x)%2 != 0 ) ? ((x)+1) : (x) )
#define __EVEN( x ) ( ( (x)%2 != 0 ) ? ((x)+1) : (x) )
static
int
ChunkFind
(
demux_t
*
,
char
*
,
unsigned
int
*
);
static
int
ChunkFind
(
demux_t
*
,
char
*
,
unsigned
int
*
);
static
void
FrameInfo_IMA_ADPCM
(
demux_t
*
,
unsigned
int
*
,
mtime_
t
*
);
static
void
FrameInfo_IMA_ADPCM
(
demux_t
*
,
unsigned
int
*
,
in
t
*
);
static
void
FrameInfo_MS_ADPCM
(
demux_t
*
,
unsigned
int
*
,
mtime_
t
*
);
static
void
FrameInfo_MS_ADPCM
(
demux_t
*
,
unsigned
int
*
,
in
t
*
);
static
void
FrameInfo_PCM
(
demux_t
*
,
unsigned
int
*
,
mtime_
t
*
);
static
void
FrameInfo_PCM
(
demux_t
*
,
unsigned
int
*
,
in
t
*
);
/*****************************************************************************
/*****************************************************************************
* Open: check file and initializes structures
* Open: check file and initializes structures
...
@@ -100,7 +101,6 @@ static int Open( vlc_object_t * p_this )
...
@@ -100,7 +101,6 @@ static int Open( vlc_object_t * p_this )
p_demux
->
pf_control
=
Control
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_sys
->
p_es
=
NULL
;
p_sys
->
p_es
=
NULL
;
p_sys
->
i_time
=
1
;
/* skip riff header */
/* skip riff header */
stream_Read
(
p_demux
->
s
,
NULL
,
12
);
/* cannot fail as peek succeed */
stream_Read
(
p_demux
->
s
,
NULL
,
12
);
/* cannot fail as peek succeed */
...
@@ -173,21 +173,22 @@ static int Open( vlc_object_t * p_this )
...
@@ -173,21 +173,22 @@ static int Open( vlc_object_t * p_this )
case
VLC_FOURCC
(
'a'
,
'f'
,
'l'
,
't'
):
case
VLC_FOURCC
(
'a'
,
'f'
,
'l'
,
't'
):
case
VLC_FOURCC
(
'u'
,
'l'
,
'a'
,
'w'
):
case
VLC_FOURCC
(
'u'
,
'l'
,
'a'
,
'w'
):
case
VLC_FOURCC
(
'a'
,
'l'
,
'a'
,
'w'
):
case
VLC_FOURCC
(
'a'
,
'l'
,
'a'
,
'w'
):
FrameInfo_PCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
&
p_sys
->
i_frame_length
);
FrameInfo_PCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
&
p_sys
->
i_frame_samples
);
break
;
break
;
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x02
):
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x02
):
FrameInfo_MS_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
FrameInfo_MS_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
&
p_sys
->
i_frame_
length
);
&
p_sys
->
i_frame_
samples
);
break
;
break
;
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x11
):
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x11
):
FrameInfo_IMA_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
FrameInfo_IMA_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
&
p_sys
->
i_frame_
length
);
&
p_sys
->
i_frame_
samples
);
break
;
break
;
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x61
):
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x61
):
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x62
):
case
VLC_FOURCC
(
'm'
,
's'
,
0x00
,
0x62
):
/* FIXME not sure at all FIXME */
/* FIXME not sure at all FIXME */
FrameInfo_MS_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
FrameInfo_MS_ADPCM
(
p_demux
,
&
p_sys
->
i_frame_size
,
&
p_sys
->
i_frame_
length
);
&
p_sys
->
i_frame_
samples
);
break
;
break
;
case
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
):
case
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
):
case
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
):
case
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
):
...
@@ -212,10 +213,14 @@ static int Open( vlc_object_t * p_this )
...
@@ -212,10 +213,14 @@ static int Open( vlc_object_t * p_this )
if
(
p_sys
->
fmt
.
i_bitrate
<=
0
)
if
(
p_sys
->
fmt
.
i_bitrate
<=
0
)
{
{
p_sys
->
fmt
.
i_bitrate
=
(
mtime_t
)
p_sys
->
i_frame_size
*
p_sys
->
fmt
.
i_bitrate
=
(
mtime_t
)
p_sys
->
i_frame_size
*
I64C
(
8000000
)
/
p_sys
->
i_frame_length
;
p_sys
->
fmt
.
audio
.
i_rate
*
8
/
p_sys
->
i_frame_samples
;
}
}
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
p_sys
->
fmt
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
p_sys
->
fmt
);
date_Init
(
&
p_sys
->
pts
,
p_sys
->
fmt
.
audio
.
i_rate
,
1
);
date_Set
(
&
p_sys
->
pts
,
1
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
...
@@ -249,15 +254,15 @@ static int Demux( demux_t *p_demux )
...
@@ -249,15 +254,15 @@ static int Demux( demux_t *p_demux )
msg_Warn
(
p_demux
,
"cannot read data"
);
msg_Warn
(
p_demux
,
"cannot read data"
);
return
0
;
return
0
;
}
}
p_block
->
i_dts
=
p_block
->
i_pts
=
p_sys
->
i_time
;
p_block
->
i_dts
=
p_block
->
i_pts
=
date_Increment
(
&
p_sys
->
pts
,
p_sys
->
i_frame_samples
);
/* set PCR */
/* set PCR */
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_
sys
->
i_time
);
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_
block
->
i_pts
);
es_out_Send
(
p_demux
->
out
,
p_sys
->
p_es
,
p_block
);
es_out_Send
(
p_demux
->
out
,
p_sys
->
p_es
,
p_block
);
p_sys
->
i_time
+=
p_sys
->
i_frame_length
;
return
1
;
return
1
;
}
}
...
@@ -279,21 +284,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -279,21 +284,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int64_t
i_end
=
-
1
;
int64_t
i_end
=
-
1
;
if
(
p_sys
->
i_data_size
>
0
)
if
(
p_sys
->
i_data_size
>
0
)
{
{
i_end
=
p_sys
->
i_data_pos
+
p_sys
->
i_data_size
;
i_end
=
p_sys
->
i_data_pos
+
p_sys
->
i_data_size
;
}
}
return
demux2_vaControlHelper
(
p_demux
->
s
,
p_sys
->
i_data_pos
,
i_end
,
return
demux2_vaControlHelper
(
p_demux
->
s
,
p_sys
->
i_data_pos
,
i_end
,
p_sys
->
fmt
.
i_bitrate
,
p_sys
->
fmt
.
audio
.
i_blockalign
,
p_sys
->
fmt
.
i_bitrate
,
p_sys
->
fmt
.
audio
.
i_blockalign
,
i_query
,
args
);
i_query
,
args
);
}
}
/*****************************************************************************
/*****************************************************************************
* Local functions
* Local functions
*****************************************************************************/
*****************************************************************************/
static
int
ChunkFind
(
demux_t
*
p_demux
,
static
int
ChunkFind
(
demux_t
*
p_demux
,
char
*
fcc
,
unsigned
int
*
pi_size
)
char
*
fcc
,
unsigned
int
*
pi_size
)
{
{
uint8_t
*
p_peek
;
uint8_t
*
p_peek
;
...
@@ -328,26 +334,16 @@ static int ChunkFind( demux_t *p_demux,
...
@@ -328,26 +334,16 @@ static int ChunkFind( demux_t *p_demux,
}
}
}
}
static
void
FrameInfo_PCM
(
demux_t
*
p_demux
,
static
void
FrameInfo_PCM
(
demux_t
*
p_demux
,
unsigned
int
*
pi_size
,
unsigned
int
*
pi_size
,
int
*
pi_samples
)
mtime_t
*
pi_length
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int
i_bytes
,
i_modulo
;
int
i_samples
;
int
i_bytes
;
int
i_modulo
;
/* read samples for 50ms of */
/* read samples for 50ms of */
i_samples
=
__MAX
(
p_sys
->
fmt
.
audio
.
i_rate
/
20
,
1
);
*
p
i_samples
=
__MAX
(
p_sys
->
fmt
.
audio
.
i_rate
/
20
,
1
);
i_bytes
=
*
pi_samples
*
p_sys
->
fmt
.
audio
.
i_channels
*
*
pi_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_sys
->
fmt
.
audio
.
i_rate
;
i_bytes
=
i_samples
*
p_sys
->
fmt
.
audio
.
i_channels
*
(
(
p_sys
->
fmt
.
audio
.
i_bitspersample
+
7
)
/
8
);
(
(
p_sys
->
fmt
.
audio
.
i_bitspersample
+
7
)
/
8
);
if
(
p_sys
->
fmt
.
audio
.
i_blockalign
>
0
)
if
(
p_sys
->
fmt
.
audio
.
i_blockalign
>
0
)
...
@@ -361,38 +357,24 @@ static void FrameInfo_PCM( demux_t *p_demux,
...
@@ -361,38 +357,24 @@ static void FrameInfo_PCM( demux_t *p_demux,
*
pi_size
=
i_bytes
;
*
pi_size
=
i_bytes
;
}
}
static
void
FrameInfo_MS_ADPCM
(
demux_t
*
p_demux
,
static
void
FrameInfo_MS_ADPCM
(
demux_t
*
p_demux
,
unsigned
int
*
pi_size
,
unsigned
int
*
pi_size
,
int
*
pi_samples
)
mtime_t
*
pi_length
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int
i_samples
;
*
pi_samples
=
2
+
2
*
(
p_sys
->
fmt
.
audio
.
i_blockalign
-
i_samples
=
2
+
2
*
(
p_sys
->
fmt
.
audio
.
i_blockalign
-
7
*
p_sys
->
fmt
.
audio
.
i_channels
)
/
p_sys
->
fmt
.
audio
.
i_channels
;
7
*
p_sys
->
fmt
.
audio
.
i_channels
)
/
p_sys
->
fmt
.
audio
.
i_channels
;
*
pi_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_sys
->
fmt
.
audio
.
i_rate
;
*
pi_size
=
p_sys
->
fmt
.
audio
.
i_blockalign
;
*
pi_size
=
p_sys
->
fmt
.
audio
.
i_blockalign
;
}
}
static
void
FrameInfo_IMA_ADPCM
(
demux_t
*
p_demux
,
static
void
FrameInfo_IMA_ADPCM
(
demux_t
*
p_demux
,
unsigned
int
*
pi_size
,
unsigned
int
*
pi_size
,
int
*
pi_samples
)
mtime_t
*
pi_length
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int
i_samples
;
*
pi_samples
=
2
*
(
p_sys
->
fmt
.
audio
.
i_blockalign
-
i_samples
=
2
*
(
p_sys
->
fmt
.
audio
.
i_blockalign
-
4
*
p_sys
->
fmt
.
audio
.
i_channels
)
/
p_sys
->
fmt
.
audio
.
i_channels
;
4
*
p_sys
->
fmt
.
audio
.
i_channels
)
/
p_sys
->
fmt
.
audio
.
i_channels
;
*
pi_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_sys
->
fmt
.
audio
.
i_rate
;
*
pi_size
=
p_sys
->
fmt
.
audio
.
i_blockalign
;
*
pi_size
=
p_sys
->
fmt
.
audio
.
i_blockalign
;
}
}
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