Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
5f782bc3
Commit
5f782bc3
authored
Nov 11, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: use es_format_t and es_out_*. (Not well tested yet...)
parent
a7a7e709
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
307 deletions
+125
-307
modules/demux/a52sys.c
modules/demux/a52sys.c
+8
-29
modules/demux/aac.c
modules/demux/aac.c
+8
-28
modules/demux/asf/asf.c
modules/demux/asf/asf.c
+52
-153
modules/demux/au.c
modules/demux/au.c
+57
-97
No files found.
modules/demux/a52sys.c
View file @
5f782bc3
...
...
@@ -2,7 +2,7 @@
* a52.c : Raw a52 Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52sys.c,v 1.
6 2003/09/12 16:26:40
fenrir Exp $
* $Id: a52sys.c,v 1.
7 2003/11/11 00:37:59
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -55,7 +55,7 @@ struct demux_sys_t
{
mtime_t
i_time
;
es_
descriptor_t
*
p_es
;
es_
out_id_t
*
p_es
;
};
static
inline
int
HeaderCheck
(
const
uint8_t
*
p
)
...
...
@@ -76,7 +76,7 @@ static int HeaderInfo( const uint8_t * p,
int
*
pi_frame_size
);
/*****************************************************************************
* Open: initializes A
AC
demux structures
* Open: initializes A
52
demux structures
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
{
...
...
@@ -88,6 +88,8 @@ static int Open( vlc_object_t * p_this )
module_t
*
p_id3
;
es_format_t
fmt
;
if
(
p_input
->
psz_demux
&&
!
strncmp
(
p_input
->
psz_demux
,
"a52"
,
3
)
)
{
...
...
@@ -166,28 +168,11 @@ static int Open( vlc_object_t * p_this )
msg_Err
(
p_input
,
"cannot init stream"
);
goto
error
;
}
if
(
input_AddProgram
(
p_input
,
0
,
0
)
==
NULL
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot add program"
);
goto
error
;
}
p_input
->
stream
.
pp_programs
[
0
]
->
b_is_ok
=
0
;
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
p_input
->
stream
.
i_mux_rate
=
0
/
50
;
p_sys
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
1
,
AUDIO_ES
,
NULL
,
0
);
p_sys
->
p_es
->
i_stream_id
=
1
;
p_sys
->
p_es
->
i_fourcc
=
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
);
input_SelectES
(
p_input
,
p_sys
->
p_es
);
p_input
->
stream
.
p_selected_program
->
b_is_ok
=
1
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
es_format_Init
(
&
fmt
,
AUDIO_ES
,
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
)
);
p_sys
->
p_es
=
es_out_Add
(
p_input
->
p_es_out
,
&
fmt
);
return
VLC_SUCCESS
;
error:
...
...
@@ -265,14 +250,8 @@ static int Demux( input_thread_t * p_input )
p_input
->
stream
.
p_selected_program
,
p_sys
->
i_time
*
9
/
100
);
if
(
!
p_sys
->
p_es
->
p_decoder_fifo
)
{
msg_Err
(
p_input
,
"no audio decoder"
);
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
return
(
-
1
);
}
es_out_Send
(
p_input
->
p_es_out
,
p_sys
->
p_es
,
p_pes
);
input_DecodePES
(
p_sys
->
p_es
->
p_decoder_fifo
,
p_pes
);
p_sys
->
i_time
+=
(
mtime_t
)
1000000
*
(
mtime_t
)
1536
/
(
mtime_t
)
i_sample_rate
;
...
...
modules/demux/aac.c
View file @
5f782bc3
...
...
@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aac.c,v 1.
4 2003/09/12 16:26:40
fenrir Exp $
* $Id: aac.c,v 1.
5 2003/11/11 00:37:59
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -56,7 +56,7 @@ struct demux_sys_t
{
mtime_t
i_time
;
es_
descriptor_t
*
p_es
;
es_
out_id_t
*
p_es
;
};
static
int
i_aac_samplerate
[
16
]
=
...
...
@@ -100,6 +100,8 @@ static int Open( vlc_object_t * p_this )
module_t
*
p_id3
;
es_format_t
fmt
;
if
(
p_input
->
psz_demux
&&
!
strncmp
(
p_input
->
psz_demux
,
"aac"
,
3
)
)
{
...
...
@@ -181,28 +183,12 @@ static int Open( vlc_object_t * p_this )
msg_Err
(
p_input
,
"cannot init stream"
);
goto
error
;
}
if
(
input_AddProgram
(
p_input
,
0
,
0
)
==
NULL
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot add program"
);
goto
error
;
}
p_input
->
stream
.
pp_programs
[
0
]
->
b_is_ok
=
0
;
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
p_input
->
stream
.
i_mux_rate
=
0
/
50
;
p_sys
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
1
,
AUDIO_ES
,
NULL
,
0
);
p_sys
->
p_es
->
i_stream_id
=
1
;
p_sys
->
p_es
->
i_fourcc
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
);
input_SelectES
(
p_input
,
p_sys
->
p_es
);
p_input
->
stream
.
p_selected_program
->
b_is_ok
=
1
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
es_format_Init
(
&
fmt
,
AUDIO_ES
,
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
)
);
p_sys
->
p_es
=
es_out_Add
(
p_input
->
p_es_out
,
&
fmt
);
return
VLC_SUCCESS
;
error:
...
...
@@ -279,14 +265,8 @@ static int Demux( input_thread_t * p_input )
p_input
->
stream
.
p_selected_program
,
p_sys
->
i_time
*
9
/
100
);
if
(
!
p_sys
->
p_es
->
p_decoder_fifo
)
{
msg_Err
(
p_input
,
"no audio decoder"
);
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
return
(
-
1
);
}
es_out_Send
(
p_input
->
p_es_out
,
p_sys
->
p_es
,
p_pes
);
input_DecodePES
(
p_sys
->
p_es
->
p_decoder_fifo
,
p_pes
);
p_sys
->
i_time
+=
(
mtime_t
)
1000000
*
(
mtime_t
)
AAC_FRAME_SAMPLES
(
h
)
/
(
mtime_t
)
AAC_SAMPLE_RATE
(
h
);
...
...
modules/demux/asf/asf.c
View file @
5f782bc3
...
...
@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.3
8 2003/09/12 16:26:40
fenrir Exp $
* $Id: asf.c,v 1.3
9 2003/11/11 00:37:59
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -54,7 +54,9 @@ static int Demux ( input_thread_t * );
typedef
struct
asf_stream_s
{
int
i_cat
;
es_descriptor_t
*
p_es
;
es_out_id_t
*
p_es
;
asf_object_stream_properties_t
*
p_sp
;
mtime_t
i_time
;
...
...
@@ -93,7 +95,6 @@ static int Open( vlc_object_t * p_this )
demux_sys_t
*
p_sys
;
unsigned
int
i_stream
;
unsigned
int
i
;
asf_object_content_description_t
*
p_cd
;
vlc_bool_t
b_seekable
;
...
...
@@ -148,7 +149,6 @@ static int Open( vlc_object_t * p_this )
msg_Dbg
(
p_input
,
"found %d streams"
,
p_sys
->
i_streams
);
/* create one program */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
if
(
input_InitStream
(
p_input
,
0
)
==
-
1
)
{
...
...
@@ -156,13 +156,6 @@ static int Open( vlc_object_t * p_this )
msg_Err
(
p_input
,
"cannot init stream"
);
goto
error
;
}
if
(
input_AddProgram
(
p_input
,
0
,
0
)
==
NULL
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot add program"
);
goto
error
;
}
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
p_input
->
stream
.
i_mux_rate
=
0
;
/* updated later */
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -184,109 +177,61 @@ static int Open( vlc_object_t * p_this )
p_stream
->
p_sp
=
p_sp
;
p_stream
->
p_es
=
NULL
;
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_audio
)
)
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_audio
)
&&
p_sp
->
i_type_specific_data_length
>=
sizeof
(
WAVEFORMATEX
)
-
2
)
{
int
i_codec
;
if
(
p_sp
->
p_type_specific_data
)
{
i_codec
=
GetWLE
(
p_sp
->
p_type_specific_data
);
}
else
es_format_t
fmt
;
uint8_t
*
p_data
=
p_sp
->
p_type_specific_data
;
es_format_Init
(
&
fmt
,
AUDIO_ES
,
0
);
wf_tag_to_fourcc
(
GetWLE
(
&
p_data
[
0
]
),
&
fmt
.
i_codec
,
NULL
);
fmt
.
audio
.
i_channels
=
GetWLE
(
&
p_data
[
2
]
);
fmt
.
audio
.
i_samplerate
=
GetDWLE
(
&
p_data
[
4
]
);
fmt
.
audio
.
i_bitrate
=
GetDWLE
(
&
p_data
[
8
]
)
*
8
;
fmt
.
audio
.
i_blockalign
=
GetWLE
(
&
p_data
[
12
]
);
fmt
.
audio
.
i_bitspersample
=
GetWLE
(
&
p_data
[
14
]
);
if
(
p_sp
->
i_type_specific_data_length
>
sizeof
(
WAVEFORMATEX
)
)
{
i_codec
=
-
1
;
fmt
.
i_extra_type
=
ES_EXTRA_TYPE_WAVEFORMATEX
;
fmt
.
i_extra
=
__MIN
(
GetWLE
(
&
p_data
[
16
]
),
p_sp
->
i_type_specific_data_length
-
sizeof
(
WAVEFORMATEX
)
);
fmt
.
p_extra
=
malloc
(
fmt
.
i_extra
);
memcpy
(
fmt
.
p_extra
,
&
p_data
[
sizeof
(
WAVEFORMATEX
)],
fmt
.
i_extra
);
}
p_stream
->
i_cat
=
AUDIO_ES
;
p_stream
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_sp
->
i_stream_number
,
AUDIO_ES
,
NULL
,
0
);
p_stream
->
p_es
=
es_out_Add
(
p_input
->
p_es_out
,
&
fmt
);
msg_Dbg
(
p_input
,
"adding new audio stream(codec:0x%x,ID:%d)"
,
i_codec
,
p_sp
->
i_stream_number
);
wf_tag_to_fourcc
(
i_codec
,
&
p_stream
->
p_es
->
i_fourcc
,
NULL
);
if
(
p_sp
->
i_type_specific_data_length
>
0
)
"added new audio stream(codec:0x%x,ID:%d)"
,
GetWLE
(
p_data
),
p_sp
->
i_stream_number
);
}
else
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_video
)
&&
p_sp
->
i_type_specific_data_length
>=
11
+
sizeof
(
BITMAPINFOHEADER
)
)
{
WAVEFORMATEX
*
p_wf
;
size_t
i_size
;
uint8_t
*
p_data
;
i_size
=
p_sp
->
i_type_specific_data_length
;
es_format_t
fmt
;
uint8_t
*
p_data
=
&
p_sp
->
p_type_specific_data
[
11
];
p_wf
=
malloc
(
i_size
);
p_stream
->
p_es
->
p_waveformatex
=
(
void
*
)
p_wf
;
p_data
=
p_sp
->
p_type_specific_data
;
es_format_Init
(
&
fmt
,
VIDEO_ES
,
VLC_FOURCC
(
p_data
[
16
],
p_data
[
17
],
p_data
[
18
],
p_data
[
19
]
)
);
fmt
.
video
.
i_width
=
GetDWLE
(
p_data
+
4
);
fmt
.
video
.
i_height
=
GetDWLE
(
p_data
+
8
);
p_wf
->
wFormatTag
=
GetWLE
(
p_data
);
p_wf
->
nChannels
=
GetWLE
(
p_data
+
2
);
p_wf
->
nSamplesPerSec
=
GetDWLE
(
p_data
+
4
);
p_wf
->
nAvgBytesPerSec
=
GetDWLE
(
p_data
+
8
);
p_wf
->
nBlockAlign
=
GetWLE
(
p_data
+
12
);
p_wf
->
wBitsPerSample
=
GetWLE
(
p_data
+
14
);
p_wf
->
cbSize
=
__MIN
(
GetWLE
(
p_data
+
16
),
i_size
-
sizeof
(
WAVEFORMATEX
));
if
(
p_wf
->
cbSize
>
0
)
if
(
p_sp
->
i_type_specific_data_length
>
11
+
sizeof
(
BITMAPINFOHEADER
)
)
{
memcpy
(
&
p_wf
[
1
],
p_data
+
sizeof
(
WAVEFORMATEX
),
p_wf
->
cbSize
);
fmt
.
i_extra_type
=
ES_EXTRA_TYPE_BITMAPINFOHEADER
;
fmt
.
i_extra
=
__MIN
(
GetDWLE
(
p_data
),
p_sp
->
i_type_specific_data_length
-
11
-
sizeof
(
BITMAPINFOHEADER
)
);
fmt
.
p_extra
=
malloc
(
fmt
.
i_extra
);
memcpy
(
fmt
.
p_extra
,
&
p_data
[
sizeof
(
BITMAPINFOHEADER
)],
fmt
.
i_extra
);
}
}
}
else
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_video
)
)
{
p_stream
->
i_cat
=
VIDEO_ES
;
p_stream
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_sp
->
i_stream_number
,
VIDEO_ES
,
NULL
,
0
);
p_stream
->
p_es
=
es_out_Add
(
p_input
->
p_es_out
,
&
fmt
);
msg_Dbg
(
p_input
,
"add
ing
new video stream(ID:%d)"
,
msg_Dbg
(
p_input
,
"add
ed
new video stream(ID:%d)"
,
p_sp
->
i_stream_number
);
if
(
p_sp
->
p_type_specific_data
)
{
p_stream
->
p_es
->
i_fourcc
=
VLC_FOURCC
(
p_sp
->
p_type_specific_data
[
27
],
p_sp
->
p_type_specific_data
[
28
],
p_sp
->
p_type_specific_data
[
29
],
p_sp
->
p_type_specific_data
[
30
]
);
}
else
{
p_stream
->
p_es
->
i_fourcc
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
if
(
p_sp
->
i_type_specific_data_length
>
11
)
{
BITMAPINFOHEADER
*
p_bih
;
size_t
i_size
;
uint8_t
*
p_data
;
i_size
=
p_sp
->
i_type_specific_data_length
-
11
;
p_bih
=
malloc
(
i_size
);
p_stream
->
p_es
->
p_bitmapinfoheader
=
(
void
*
)
p_bih
;
p_data
=
p_sp
->
p_type_specific_data
+
11
;
p_bih
->
biSize
=
GetDWLE
(
p_data
);
p_bih
->
biWidth
=
GetDWLE
(
p_data
+
4
);
p_bih
->
biHeight
=
GetDWLE
(
p_data
+
8
);
p_bih
->
biPlanes
=
GetDWLE
(
p_data
+
12
);
p_bih
->
biBitCount
=
GetDWLE
(
p_data
+
14
);
p_bih
->
biCompression
=
GetDWLE
(
p_data
+
16
);
p_bih
->
biSizeImage
=
GetDWLE
(
p_data
+
20
);
p_bih
->
biXPelsPerMeter
=
GetDWLE
(
p_data
+
24
);
p_bih
->
biYPelsPerMeter
=
GetDWLE
(
p_data
+
28
);
p_bih
->
biClrUsed
=
GetDWLE
(
p_data
+
32
);
p_bih
->
biClrImportant
=
GetDWLE
(
p_data
+
36
);
if
(
i_size
>
sizeof
(
BITMAPINFOHEADER
)
)
{
memcpy
(
&
p_bih
[
1
],
p_data
+
sizeof
(
BITMAPINFOHEADER
),
i_size
-
sizeof
(
BITMAPINFOHEADER
)
);
}
}
}
else
{
...
...
@@ -294,16 +239,8 @@ static int Open( vlc_object_t * p_this )
msg_Dbg
(
p_input
,
"ignoring unknown stream(ID:%d)"
,
p_sp
->
i_stream_number
);
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
if
(
p_stream
->
p_es
)
{
input_SelectES
(
p_input
,
p_stream
->
p_es
);
}
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
}
p_sys
->
i_data_begin
=
p_sys
->
p_root
->
p_data
->
i_object_pos
+
50
;
if
(
p_sys
->
p_root
->
p_data
->
i_object_size
!=
0
)
{
/* local file */
...
...
@@ -346,11 +283,6 @@ static int Open( vlc_object_t * p_this )
}
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_program
->
b_is_ok
=
1
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
/* We add all info about this stream */
p_cat
=
input_InfoCategory
(
p_input
,
"Asf"
);
if
(
p_sys
->
i_length
>
0
)
...
...
@@ -379,6 +311,8 @@ static int Open( vlc_object_t * p_this )
input_AddInfo
(
p_cat
,
_
(
"Rating"
),
p_cd
->
psz_rating
);
}
#if 0
/* FIXME to port to new way */
for( i_stream = 0, i = 0; i < 128; i++ )
{
asf_stream_t *tk = p_sys->stream[i];
...
...
@@ -420,17 +354,11 @@ static int Open( vlc_object_t * p_this )
input_AddInfo( p_cat, _("Resolution"), "%dx%d",
p_bih->biWidth, p_bih->biHeight );
input_AddInfo
(
p_cat
,
_
(
"Planes"
),
"%d"
,
p_bih
->
biPlanes
);
input_AddInfo
(
p_cat
,
_
(
"Bits Per Pixel"
),
"%d"
,
p_bih
->
biBitCount
);
input_AddInfo
(
p_cat
,
_
(
"Image Size"
),
"%d"
,
p_bih
->
biSizeImage
);
input_AddInfo
(
p_cat
,
_
(
"X pixels per meter"
),
"%d"
,
p_bih
->
biXPelsPerMeter
);
input_AddInfo
(
p_cat
,
_
(
"Y pixels per meter"
),
"%d"
,
p_bih
->
biYPelsPerMeter
);
}
i_stream++;
}
#endif
return
VLC_SUCCESS
;
...
...
@@ -449,23 +377,6 @@ static int Demux( input_thread_t *p_input )
demux_sys_t
*
p_sys
=
p_input
->
p_demux_data
;
vlc_bool_t
b_play_audio
;
int
i
;
vlc_bool_t
b_stream
;
b_stream
=
VLC_FALSE
;
for
(
i
=
0
;
i
<
128
;
i
++
)
{
if
(
p_sys
->
stream
[
i
]
&&
p_sys
->
stream
[
i
]
->
p_es
&&
p_sys
->
stream
[
i
]
->
p_es
->
p_decoder_fifo
)
{
b_stream
=
VLC_TRUE
;
}
}
if
(
!
b_stream
)
{
msg_Warn
(
p_input
,
"no stream selected, exiting..."
);
return
(
0
);
}
/* catch seek from user */
if
(
p_input
->
stream
.
p_selected_program
->
i_synchro_state
==
SYNCHRO_REINIT
)
...
...
@@ -586,7 +497,7 @@ static mtime_t GetMoviePTS( demux_sys_t *p_sys )
for
(
i_stream
=
0
;
i_stream
<
128
;
i_stream
++
)
{
#define p_stream p_sys->stream[i_stream]
if
(
p_stream
&&
p_stream
->
p_es
&&
p_stream
->
p_es
->
p_decoder_fifo
&&
p_stream
->
i_time
>
0
)
if
(
p_stream
&&
p_stream
->
p_es
&&
p_stream
->
i_time
>
0
)
{
if
(
i_time
<
0
)
{
...
...
@@ -801,7 +712,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
continue
;
// over payload
}
if
(
!
p_stream
->
p_es
||
!
p_stream
->
p_es
->
p_decoder_fifo
)
if
(
!
p_stream
->
p_es
)
{
i_skip
+=
i_payload_data_length
;
continue
;
...
...
@@ -832,19 +743,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
/* send complete packet to decoder */
if
(
p_stream
->
p_pes
->
i_pes_size
>
0
)
{
if
(
p_stream
->
p_es
->
p_decoder_fifo
&&
(
b_play_audio
||
p_stream
->
i_cat
!=
AUDIO_ES
)
)
{
p_stream
->
p_pes
->
i_rate
=
p_input
->
stream
.
control
.
i_rate
;
input_DecodePES
(
p_stream
->
p_es
->
p_decoder_fifo
,
p_stream
->
p_pes
);
}
else
{
input_DeletePES
(
p_input
->
p_method_data
,
p_stream
->
p_pes
);
}
es_out_Send
(
p_input
->
p_es_out
,
p_stream
->
p_es
,
p_stream
->
p_pes
);
p_stream
->
p_pes
=
NULL
;
}
}
...
...
modules/demux/au.c
View file @
5f782bc3
...
...
@@ -2,7 +2,7 @@
* au.c : au file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: au.c,v 1.
7 2003/09/12 16:26:40
fenrir Exp $
* $Id: au.c,v 1.
8 2003/11/11 00:37:59
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -93,11 +93,11 @@ typedef struct
struct
demux_sys_t
{
au_t
au
;
WAVEFORMATEX
wf
;
mtime_t
i_time
;
es_descriptor_t
*
p_es
;
es_format_t
fmt
;
es_out_id_t
*
p_es
;
int
i_frame_size
;
mtime_t
i_frame_length
;
...
...
@@ -114,8 +114,6 @@ static int Open( vlc_object_t * p_this )
uint8_t
*
p_peek
;
vlc_fourcc_t
i_fourcc
;
int
i_cat
;
/* a little test to see if it's a au file */
...
...
@@ -170,105 +168,92 @@ static int Open( vlc_object_t * p_this )
}
/* Create WAVEFORMATEX structure */
p_sys
->
wf
.
nChannels
=
p_sys
->
au
.
i_channels
;
p_sys
->
wf
.
nSamplesPerSec
=
p_sys
->
au
.
i_sample_rate
;
p_sys
->
wf
.
cbSize
=
0
;
es_format_Init
(
&
p_sys
->
fmt
,
AUDIO_ES
,
0
);
p_sys
->
fmt
.
audio
.
i_channels
=
p_sys
->
au
.
i_channels
;
p_sys
->
fmt
.
audio
.
i_samplerate
=
p_sys
->
au
.
i_sample_rate
;
switch
(
p_sys
->
au
.
i_encoding
)
{
case
AU_ALAW_8
:
/* 8-bit ISDN A-law */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_ALAW
;
// FIXME ??
p_sys
->
wf
.
wBitsPerSample
=
8
;
p_sys
->
wf
.
nBlockAlign
=
1
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'l'
,
'a'
,
'w'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'l'
,
'a'
,
'w'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
8
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
1
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_MULAW_8
:
/* 8-bit ISDN u-law */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_MULAW
;
// FIXME ??
p_sys
->
wf
.
wBitsPerSample
=
8
;
p_sys
->
wf
.
nBlockAlign
=
1
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'u'
,
'l'
,
'a'
,
'w'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'l'
,
'a'
,
'w'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
8
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
1
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_LINEAR_8
:
/* 8-bit linear PCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_PCM
;
p_sys
->
wf
.
wBitsPerSample
=
8
;
p_sys
->
wf
.
nBlockAlign
=
1
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
8
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
1
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_LINEAR_16
:
/* 16-bit linear PCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_PCM
;
p_sys
->
wf
.
wBitsPerSample
=
16
;
p_sys
->
wf
.
nBlockAlign
=
2
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
16
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
2
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_LINEAR_24
:
/* 24-bit linear PCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_PCM
;
p_sys
->
wf
.
wBitsPerSample
=
24
;
p_sys
->
wf
.
nBlockAlign
=
3
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
24
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
3
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_LINEAR_32
:
/* 32-bit linear PCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_PCM
;
p_sys
->
wf
.
wBitsPerSample
=
32
;
p_sys
->
wf
.
nBlockAlign
=
4
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
32
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
4
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_FLOAT
:
/* 32-bit IEEE floating point */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
32
;
p_sys
->
wf
.
nBlockAlign
=
4
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_FLOAT
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_FLOAT
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
32
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
4
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_DOUBLE
:
/* 64-bit IEEE floating point */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
64
;
p_sys
->
wf
.
nBlockAlign
=
8
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_DOUBLE
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_DOUBLE
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
64
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
8
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_PCM
;
break
;
case
AU_ADPCM_G721
:
/* 4-bit CCITT g.721 ADPCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
0
;
p_sys
->
wf
.
nBlockAlign
=
0
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G721
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G721
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
0
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
0
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_ADPCM
;
break
;
case
AU_ADPCM_G722
:
/* CCITT g.722 ADPCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
0
;
p_sys
->
wf
.
nBlockAlign
=
0
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G722
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G722
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
0
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
0
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_ADPCM
;
break
;
case
AU_ADPCM_G723_3
:
/* CCITT g.723 3-bit ADPCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
0
;
p_sys
->
wf
.
nBlockAlign
=
0
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G723_3
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G723_3
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
0
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
0
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_ADPCM
;
break
;
case
AU_ADPCM_G723_5
:
/* CCITT g.723 5-bit ADPCM */
p_sys
->
wf
.
wFormatTag
=
WAVE_FORMAT_UNKNOWN
;
p_sys
->
wf
.
wBitsPerSample
=
0
;
p_sys
->
wf
.
nBlockAlign
=
0
*
p_sys
->
wf
.
nChannels
;
i_fourcc
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G723_5
);
p_sys
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'u'
,
0
,
AU_ADPCM_G723_5
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
0
;
p_sys
->
fmt
.
audio
.
i_blockalign
=
0
*
p_sys
->
fmt
.
audio
.
i_channels
;
i_cat
=
AU_CAT_ADPCM
;
break
;
...
...
@@ -277,9 +262,9 @@ static int Open( vlc_object_t * p_this )
i_cat
=
AU_CAT_UNKNOWN
;
goto
error
;
}
p_sys
->
wf
.
nAvgBytesPerSec
=
p_sys
->
wf
.
nSamplesPerSec
*
p_sys
->
wf
.
nChannels
*
p_sys
->
wf
.
wBitsPerSample
/
8
;
p_sys
->
fmt
.
audio
.
i_bitrate
=
p_sys
->
fmt
.
audio
.
i_samplerate
*
p_sys
->
fmt
.
audio
.
i_channels
*
p_sys
->
fmt
.
audio
.
i_bitspersample
;
if
(
i_cat
==
AU_CAT_UNKNOWN
||
i_cat
==
AU_CAT_ADPCM
)
{
...
...
@@ -294,27 +279,26 @@ static int Open( vlc_object_t * p_this )
int
i_samples
,
i_modulo
;
/* read samples for 50ms of */
i_samples
=
__MAX
(
p_sys
->
wf
.
nSamplesPerSec
/
20
,
1
);
i_samples
=
__MAX
(
p_sys
->
fmt
.
audio
.
i_samplerate
/
20
,
1
);
p_sys
->
i_frame_size
=
i_samples
*
p_sys
->
wf
.
nChannels
*
(
(
p_sys
->
wf
.
wBitsPerS
ample
+
7
)
/
8
);
p_sys
->
i_frame_size
=
i_samples
*
p_sys
->
fmt
.
audio
.
i_channels
*
(
(
p_sys
->
fmt
.
audio
.
i_bitspers
ample
+
7
)
/
8
);
if
(
p_sys
->
wf
.
nBlockA
lign
>
0
)
if
(
p_sys
->
fmt
.
audio
.
i_blocka
lign
>
0
)
{
if
(
(
i_modulo
=
p_sys
->
i_frame_size
%
p_sys
->
wf
.
nBlockA
lign
)
!=
0
)
if
(
(
i_modulo
=
p_sys
->
i_frame_size
%
p_sys
->
fmt
.
audio
.
i_blocka
lign
)
!=
0
)
{
p_sys
->
i_frame_size
+=
p_sys
->
wf
.
nBlockA
lign
-
i_modulo
;
p_sys
->
i_frame_size
+=
p_sys
->
fmt
.
audio
.
i_blocka
lign
-
i_modulo
;
}
}
p_sys
->
i_frame_length
=
(
mtime_t
)
1000000
*
(
mtime_t
)
i_samples
/
(
mtime_t
)
p_sys
->
wf
.
nSamplesPerSec
;
(
mtime_t
)
p_sys
->
fmt
.
audio
.
i_samplerate
;
p_input
->
pf_demux
=
DemuxPCM
;
p_input
->
pf_demux_control
=
demux_vaControlDefault
;
}
/* create one program */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
if
(
input_InitStream
(
p_input
,
0
)
==
-
1
)
{
...
...
@@ -322,29 +306,10 @@ static int Open( vlc_object_t * p_this )
msg_Err
(
p_input
,
"cannot init stream"
);
goto
error
;
}
if
(
input_AddProgram
(
p_input
,
0
,
0
)
==
NULL
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot add program"
);
goto
error
;
}
p_input
->
stream
.
p_selected_program
=
p_input
->
stream
.
pp_programs
[
0
];
p_input
->
stream
.
i_mux_rate
=
p_sys
->
wf
.
nAvgBytesPerSec
/
50
;
p_sys
->
p_es
=
input_AddES
(
p_input
,
p_input
->
stream
.
p_selected_program
,
0x01
,
AUDIO_ES
,
NULL
,
0
);
p_sys
->
p_es
->
i_stream_id
=
0x01
;
p_sys
->
p_es
->
i_fourcc
=
i_fourcc
;
p_sys
->
p_es
->
p_waveformatex
=
malloc
(
sizeof
(
WAVEFORMATEX
)
);
memcpy
(
p_sys
->
p_es
->
p_waveformatex
,
&
p_sys
->
wf
,
sizeof
(
WAVEFORMATEX
)
);
input_SelectES
(
p_input
,
p_sys
->
p_es
);
p_input
->
stream
.
p_selected_program
->
b_is_ok
=
1
;
p_input
->
stream
.
i_mux_rate
=
p_sys
->
fmt
.
audio
.
i_bitrate
/
50
/
8
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
p_sys
->
p_es
=
es_out_Add
(
p_input
->
p_es_out
,
&
p_sys
->
fmt
);
return
VLC_SUCCESS
;
error:
...
...
@@ -366,9 +331,9 @@ static int DemuxPCM( input_thread_t *p_input )
{
int64_t
i_pos
=
stream_Tell
(
p_input
->
s
);
if
(
p_sys
->
wf
.
nBlockA
lign
!=
0
)
if
(
p_sys
->
fmt
.
audio
.
i_blocka
lign
!=
0
)
{
i_pos
+=
p_sys
->
wf
.
nBlockAlign
-
i_pos
%
p_sys
->
wf
.
nBlockA
lign
;
i_pos
+=
p_sys
->
fmt
.
audio
.
i_blockalign
-
i_pos
%
p_sys
->
fmt
.
audio
.
i_blocka
lign
;
if
(
stream_Seek
(
p_input
->
s
,
i_pos
)
)
{
msg_Err
(
p_input
,
"Seek failed(cannot resync)"
);
...
...
@@ -390,15 +355,10 @@ static int DemuxPCM( input_thread_t *p_input )
p_input
->
stream
.
p_selected_program
,
p_sys
->
i_time
*
9
/
100
);
if
(
!
p_sys
->
p_es
->
p_decoder_fifo
)
{
msg_Err
(
p_input
,
"no audio decoder"
);
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
return
(
-
1
);
}
es_out_Send
(
p_input
->
p_es_out
,
p_sys
->
p_es
,
p_pes
);
input_DecodePES
(
p_sys
->
p_es
->
p_decoder_fifo
,
p_pes
);
p_sys
->
i_time
+=
p_sys
->
i_frame_length
;
return
(
1
);
}
...
...
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