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
25c8c4c9
Commit
25c8c4c9
authored
Feb 16, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: fix mpeg2 handling.
parent
c4f86070
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
89 deletions
+73
-89
modules/codec/mpeg_audio.c
modules/codec/mpeg_audio.c
+10
-12
modules/demux/mpeg/audio.c
modules/demux/mpeg/audio.c
+63
-77
No files found.
modules/codec/mpeg_audio.c
View file @
25c8c4c9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* mpeg_audio.c: parse MPEG audio sync info and packetize the stream
* mpeg_audio.c: parse MPEG audio sync info and packetize the stream
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* Copyright (C) 2001-2003 VideoLAN
* $Id: mpeg_audio.c,v 1.
9 2003/01/28 23:55:57 massiot
Exp $
* $Id: mpeg_audio.c,v 1.
10 2003/02/16 08:56:24 fenrir
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
* Eric Petit <titer@videolan.org>
...
@@ -507,29 +507,27 @@ static int SyncInfo( uint32_t i_header, unsigned int * pi_channels,
...
@@ -507,29 +507,27 @@ static int SyncInfo( uint32_t i_header, unsigned int * pi_channels,
switch
(
*
pi_layer
)
switch
(
*
pi_layer
)
{
{
case
1
:
case
1
:
i_current_frame_size
=
(
(
i_version
?
6000
:
12000
)
*
i_current_frame_size
=
(
12000
*
*
pi_bit_rate
/
*
pi_sample_rate
*
pi_bit_rate
/
*
pi_sample_rate
+
b_padding
)
*
4
;
+
b_padding
)
*
4
;
*
pi_frame_size
=
(
(
i_version
?
6000
:
12000
)
*
*
pi_frame_size
=
(
12000
*
i_max_bit_rate
/
*
pi_sample_rate
+
1
)
*
4
;
i_max_bit_rate
/
*
pi_sample_rate
+
1
)
*
4
;
*
pi_frame_length
=
384
;
*
pi_frame_length
=
384
;
break
;
break
;
case
2
:
case
2
:
i_current_frame_size
=
(
i_version
?
72000
:
144000
)
*
i_current_frame_size
=
144000
*
*
pi_bit_rate
/
*
pi_sample_rate
*
pi_bit_rate
/
*
pi_sample_rate
+
b_padding
;
+
b_padding
;
*
pi_frame_size
=
(
i_version
?
72000
:
144000
)
*
*
pi_frame_size
=
144000
*
i_max_bit_rate
/
*
pi_sample_rate
+
1
;
i_max_bit_rate
/
*
pi_sample_rate
+
1
;
*
pi_frame_length
=
1152
;
*
pi_frame_length
=
1152
;
break
;
break
;
case
3
:
case
3
:
i_current_frame_size
=
(
i_version
?
72000
:
144000
)
*
i_current_frame_size
=
144000
*
*
pi_bit_rate
/
*
pi_sample_rate
*
pi_bit_rate
/
*
pi_sample_rate
+
b_padding
;
+
b_padding
;
*
pi_frame_size
=
(
i_version
?
72000
:
144000
)
*
*
pi_frame_size
=
144000
*
i_max_bit_rate
/
*
pi_sample_rate
+
1
;
i_max_bit_rate
/
*
pi_sample_rate
+
1
;
*
pi_frame_length
=
i_version
?
576
:
1152
;
*
pi_frame_length
=
i_version
?
576
:
1152
;
break
;
break
;
...
...
modules/demux/mpeg/audio.c
View file @
25c8c4c9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* audio.c : mpeg audio Stream input module for vlc
* audio.c : mpeg audio Stream input module for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: audio.c,v 1.1
1 2003/02/07 01:22:55
fenrir Exp $
* $Id: audio.c,v 1.1
2 2003/02/16 08:56:24
fenrir Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -62,7 +62,7 @@ vlc_module_end();
...
@@ -62,7 +62,7 @@ vlc_module_end();
typedef
struct
mpeg_header_s
typedef
struct
mpeg_header_s
{
{
u
32
i_header
;
u
int32_t
i_header
;
int
i_version
;
int
i_version
;
int
i_layer
;
int
i_layer
;
int
i_crc
;
int
i_crc
;
...
@@ -89,7 +89,7 @@ typedef struct xing_header_s
...
@@ -89,7 +89,7 @@ typedef struct xing_header_s
int
i_frames
;
/* total bit stream frames from Xing header data */
int
i_frames
;
/* total bit stream frames from Xing header data */
int
i_bytes
;
/* total bit stream bytes from Xing header data */
int
i_bytes
;
/* total bit stream bytes from Xing header data */
int
i_vbr_scale
;
/* encoded vbr scale from Xing header data */
int
i_vbr_scale
;
/* encoded vbr scale from Xing header data */
u
8
i_toc
[
100
];
/* for seek */
u
int8_t
i_toc
[
100
];
/* for seek */
int
i_avgbitrate
;
/* calculated, XXX: bits/sec not Kb */
int
i_avgbitrate
;
/* calculated, XXX: bits/sec not Kb */
}
xing_header_t
;
}
xing_header_t
;
...
@@ -141,7 +141,7 @@ static char* mpegaudio_mode[4] =
...
@@ -141,7 +141,7 @@ static char* mpegaudio_mode[4] =
"stereo"
,
"joint stereo"
,
"dual channel"
,
"mono"
"stereo"
,
"joint stereo"
,
"dual channel"
,
"mono"
};
};
static
inline
u
32
GetDWBE
(
u8
*
p_buff
)
static
inline
u
int32_t
GetDWBE
(
uint8_t
*
p_buff
)
{
{
return
(
(
p_buff
[
0
]
<<
24
)
|
(
p_buff
[
1
]
<<
16
)
|
return
(
(
p_buff
[
0
]
<<
24
)
|
(
p_buff
[
1
]
<<
16
)
|
(
p_buff
[
2
]
<<
8
)
|
(
p_buff
[
3
]
)
);
(
p_buff
[
2
]
<<
8
)
|
(
p_buff
[
3
]
)
);
...
@@ -222,7 +222,7 @@ static int ReadPES( input_thread_t *p_input,
...
@@ -222,7 +222,7 @@ static int ReadPES( input_thread_t *p_input,
/*****************************************************************************
/*****************************************************************************
* CheckHeader : Test the validity of the header
* CheckHeader : Test the validity of the header
*****************************************************************************/
*****************************************************************************/
static
int
CheckHeader
(
u
32
i_header
)
static
int
CheckHeader
(
u
int32_t
i_header
)
{
{
if
(
(((
i_header
>>
20
)
&
0x0FFF
)
!=
0x0FFF
)
/* header sync */
if
(
(((
i_header
>>
20
)
&
0x0FFF
)
!=
0x0FFF
)
/* header sync */
||
(((
i_header
>>
17
)
&
0x03
)
==
0
)
/* valid layer ?*/
||
(((
i_header
>>
17
)
&
0x03
)
==
0
)
/* valid layer ?*/
...
@@ -262,8 +262,8 @@ static int GetHeader( input_thread_t *p_input,
...
@@ -262,8 +262,8 @@ static int GetHeader( input_thread_t *p_input,
int
i_max_pos
,
int
i_max_pos
,
int
*
pi_skip
)
int
*
pi_skip
)
{
{
u
32
i_header
;
u
int32_t
i_header
;
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
int
i_size
;
int
i_size
;
*
pi_skip
=
0
;
*
pi_skip
=
0
;
...
@@ -315,7 +315,7 @@ static void ExtractXingHeader( input_thread_t *p_input,
...
@@ -315,7 +315,7 @@ static void ExtractXingHeader( input_thread_t *p_input,
{
{
int
i_skip
;
int
i_skip
;
int
i_size
;
int
i_size
;
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
mpeg_header_t
mpeg
;
mpeg_header_t
mpeg
;
p_xh
->
i_flags
=
0
;
/* nothing present */
p_xh
->
i_flags
=
0
;
/* nothing present */
...
@@ -406,8 +406,10 @@ static void ExtractXingHeader( input_thread_t *p_input,
...
@@ -406,8 +406,10 @@ static void ExtractXingHeader( input_thread_t *p_input,
if
(
(
p_xh
->
i_flags
&
FRAMES_FLAG
)
&&
(
p_xh
->
i_flags
&
BYTES_FLAG
)
)
if
(
(
p_xh
->
i_flags
&
FRAMES_FLAG
)
&&
(
p_xh
->
i_flags
&
BYTES_FLAG
)
)
{
{
p_xh
->
i_avgbitrate
=
p_xh
->
i_avgbitrate
=
((
u64
)
p_xh
->
i_bytes
*
(
u64
)
8
*
(
u64
)
mpeg
.
i_samplerate
)
/
(
(
uint64_t
)
p_xh
->
i_bytes
*
((
u64
)
p_xh
->
i_frames
*
(
u64
)
DecodedFrameSize
(
&
mpeg
)
);
(
uint64_t
)
8
*
(
uint64_t
)
mpeg
.
i_samplerate
)
/
((
uint64_t
)
p_xh
->
i_frames
*
(
uint64_t
)
DecodedFrameSize
(
&
mpeg
)
);
}
}
}
}
...
@@ -425,14 +427,12 @@ static void ExtractConfiguration( demux_sys_t *p_demux )
...
@@ -425,14 +427,12 @@ static void ExtractConfiguration( demux_sys_t *p_demux )
{
{
case
(
0
):
case
(
0
):
p_demux
->
i_framelength
=
p_demux
->
i_framelength
=
(
(
(
!
p_demux
->
mpeg
.
i_version
?
12000
:
6000
)
*
(
(
12000
*
p_demux
->
mpeg
.
i_bitrate
)
/
p_demux
->
mpeg
.
i_bitrate
)
/
p_demux
->
mpeg
.
i_samplerate
+
p_demux
->
mpeg
.
i_padding
)
*
4
;
p_demux
->
mpeg
.
i_samplerate
+
p_demux
->
mpeg
.
i_padding
)
*
4
;
case
(
1
):
case
(
1
):
case
(
2
):
case
(
2
):
p_demux
->
i_framelength
=
p_demux
->
i_framelength
=
(
(
!
p_demux
->
mpeg
.
i_version
?
144000
:
72000
)
*
(
144000
*
p_demux
->
mpeg
.
i_bitrate
)
/
p_demux
->
mpeg
.
i_bitrate
)
/
p_demux
->
mpeg
.
i_samplerate
+
p_demux
->
mpeg
.
i_padding
;
p_demux
->
mpeg
.
i_samplerate
+
p_demux
->
mpeg
.
i_padding
;
}
}
}
}
...
@@ -444,7 +444,7 @@ static void ExtractConfiguration( demux_sys_t *p_demux )
...
@@ -444,7 +444,7 @@ static void ExtractConfiguration( demux_sys_t *p_demux )
****************************************************************************/
****************************************************************************/
static
int
CheckPS
(
input_thread_t
*
p_input
)
static
int
CheckPS
(
input_thread_t
*
p_input
)
{
{
u
8
*
p_peek
;
u
int8_t
*
p_peek
;
int
i_startcode
=
0
;
int
i_startcode
=
0
;
int
i_size
=
input_Peek
(
p_input
,
&
p_peek
,
8196
);
int
i_size
=
input_Peek
(
p_input
,
&
p_peek
,
8196
);
...
@@ -625,20 +625,6 @@ static int Activate( vlc_object_t * p_this )
...
@@ -625,20 +625,6 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
}
}
#if 0
/* seems now to be ok */
/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME */
/* if i don't do that, it don't work correctly but why ??? */
/* XXX Sigmund : if you want to seek use this :)
but it work only with file .... ( http doesn't like seeking */
if( p_input->stream.b_seekable )
{
p_input->pf_seek( p_input, 0 ); // 0 -> seek at position 0
input_AccessReinit( p_input );
}
#endif
return
(
0
);
return
(
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