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
88386ce7
Commit
88386ce7
authored
Aug 31, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/stream_out/transcode.c, modules/audio_filter/format.c: fixed a bunch of stupid mistakes.
parent
499a2fea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
16 deletions
+61
-16
modules/audio_filter/format.c
modules/audio_filter/format.c
+36
-10
modules/stream_out/transcode.c
modules/stream_out/transcode.c
+25
-6
No files found.
modules/audio_filter/format.c
View file @
88386ce7
...
...
@@ -40,6 +40,7 @@ static int Open ( vlc_object_t * );
static
block_t
*
Float32toS16
(
filter_t
*
,
block_t
*
);
static
block_t
*
Float32toU16
(
filter_t
*
,
block_t
*
);
static
block_t
*
S16toFloat32
(
filter_t
*
,
block_t
*
);
static
block_t
*
S16Invert
(
filter_t
*
,
block_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -62,16 +63,23 @@ static int Open( vlc_object_t *p_this )
{
p_filter
->
pf_audio_filter
=
Float32toS16
;
}
else
if
(
p_filter
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
)
&&
p_filter
->
fmt_out
.
i_codec
==
AUDIO_FMT_U16_NE
)
else
if
(
p_filter
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
)
&&
p_filter
->
fmt_out
.
i_codec
==
AUDIO_FMT_U16_NE
)
{
p_filter
->
pf_audio_filter
=
Float32toU16
;
}
else
if
(
p_filter
->
fmt_in
.
i_codec
==
AUDIO_FMT_S16_NE
&&
p_filter
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
)
)
else
if
(
p_filter
->
fmt_in
.
i_codec
==
AUDIO_FMT_S16_NE
&&
p_filter
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
)
)
{
p_filter
->
pf_audio_filter
=
S16toFloat32
;
}
else
if
(
(
p_filter
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'l'
)
&&
p_filter
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'b'
)
)
||
(
p_filter
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'b'
)
&&
p_filter
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'l'
)
)
)
{
p_filter
->
pf_audio_filter
=
S16Invert
;
}
else
return
VLC_EGENERIC
;
msg_Dbg
(
p_this
,
"%4.4s->%4.4s, bits per sample: %i"
,
...
...
@@ -91,7 +99,7 @@ static block_t *Float32toS16( filter_t *p_filter, block_t *p_block )
float
*
p_in
=
(
float
*
)
p_block
->
p_buffer
;
int16_t
*
p_out
=
(
int16_t
*
)
p_in
;
for
(
i
=
p_block
->
i_buffer
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
for
(
i
=
p_block
->
i_buffer
*
8
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
{
#if 0
/* Slow version. */
...
...
@@ -119,7 +127,7 @@ static block_t *Float32toU16( filter_t *p_filter, block_t *p_block )
float
*
p_in
=
(
float
*
)
p_block
->
p_buffer
;
uint16_t
*
p_out
=
(
uint16_t
*
)
p_in
;
for
(
i
=
p_block
->
i_buffer
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
for
(
i
=
p_block
->
i_buffer
*
8
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
{
if
(
*
p_in
>=
1
.
0
)
*
p_out
=
65535
;
else
if
(
*
p_in
<
-
1
.
0
)
*
p_out
=
0
;
...
...
@@ -146,10 +154,10 @@ static block_t *S16toFloat32( filter_t *p_filter, block_t *p_block )
return
NULL
;
}
p_in
=
(
int16_t
*
)
(
p_block
->
p_buffer
+
p_block
->
i_buffer
)
-
1
;
p_out
=
(
float
*
)
(
p_block_out
->
p_buffer
+
p_block_out
->
i_buffer
)
-
1
;
p_in
=
(
int16_t
*
)
p_block
->
p_buffer
;
p_out
=
(
float
*
)
p_block_out
->
p_buffer
;
for
(
i
=
p_block
->
i_buffer
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
for
(
i
=
p_block
->
i_buffer
*
8
/
p_filter
->
fmt_in
.
audio
.
i_bitspersample
;
i
--
;
)
{
#if 0
/* Slow version */
...
...
@@ -163,7 +171,7 @@ static block_t *S16toFloat32( filter_t *p_filter, block_t *p_block )
*
p_out
=
u
.
f
-
384
.
0
;
#endif
p_in
--
;
p_out
--
;
p_in
++
;
p_out
++
;
}
p_block_out
->
i_samples
=
p_block
->
i_samples
;
...
...
@@ -172,5 +180,23 @@ static block_t *S16toFloat32( filter_t *p_filter, block_t *p_block )
p_block_out
->
i_length
=
p_block
->
i_length
;
p_block_out
->
i_rate
=
p_block
->
i_rate
;
p_block
->
pf_release
(
p_block
);
return
p_block_out
;
}
static
block_t
*
S16Invert
(
filter_t
*
p_filter
,
block_t
*
p_block
)
{
int
i
;
uint8_t
*
p_in
=
(
uint8_t
*
)
p_block
->
p_buffer
;
uint8_t
tmp
;
for
(
i
=
0
;
i
<
p_block
->
i_buffer
/
2
;
i
++
)
{
tmp
=
p_in
[
0
];
p_in
[
0
]
=
p_in
[
1
];
p_in
[
1
]
=
tmp
;
p_in
+=
2
;
}
return
p_block
;
}
modules/stream_out/transcode.c
View file @
88386ce7
...
...
@@ -818,17 +818,30 @@ int audio_BitsPerSample( vlc_fourcc_t i_format )
{
case
VLC_FOURCC
(
'u'
,
'8'
,
' '
,
' '
):
case
VLC_FOURCC
(
's'
,
'8'
,
' '
,
' '
):
return
1
;
return
8
;
case
VLC_FOURCC
(
'u'
,
'1'
,
'6'
,
'l'
):
case
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'l'
):
case
VLC_FOURCC
(
'u'
,
'1'
,
'6'
,
'b'
):
case
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'b'
):
return
2
;
return
16
;
case
VLC_FOURCC
(
'u'
,
'2'
,
'4'
,
'l'
):
case
VLC_FOURCC
(
's'
,
'2'
,
'4'
,
'l'
):
case
VLC_FOURCC
(
'u'
,
'2'
,
'4'
,
'b'
):
case
VLC_FOURCC
(
's'
,
'2'
,
'4'
,
'b'
):
return
24
;
case
VLC_FOURCC
(
'u'
,
'3'
,
'2'
,
'l'
):
case
VLC_FOURCC
(
's'
,
'3'
,
'2'
,
'l'
):
case
VLC_FOURCC
(
'u'
,
'3'
,
'2'
,
'b'
):
case
VLC_FOURCC
(
's'
,
'3'
,
'2'
,
'b'
):
case
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
):
case
VLC_FOURCC
(
'f'
,
'i'
,
'3'
,
'2'
):
return
4
;
return
32
;
case
VLC_FOURCC
(
'f'
,
'l'
,
'6'
,
'4'
):
return
64
;
}
return
0
;
...
...
@@ -892,7 +905,8 @@ static int transcode_audio_new( sout_stream_t *p_stream,
id
->
p_encoder
->
fmt_out
.
audio
.
i_physical_channels
;
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
=
id
->
p_encoder
->
fmt_out
.
audio
.
i_channels
;
id
->
p_encoder
->
fmt_in
.
audio
.
i_bitspersample
=
16
;
id
->
p_encoder
->
fmt_in
.
audio
.
i_bitspersample
=
audio_BitsPerSample
(
id
->
p_encoder
->
fmt_in
.
i_codec
);
id
->
p_encoder
->
p_cfg
=
p_stream
->
p_sys
->
p_audio_cfg
;
...
...
@@ -906,6 +920,8 @@ static int transcode_audio_new( sout_stream_t *p_stream,
return
VLC_EGENERIC
;
}
id
->
p_encoder
->
fmt_in
.
audio
.
i_format
=
id
->
p_encoder
->
fmt_in
.
i_codec
;
id
->
p_encoder
->
fmt_in
.
audio
.
i_bitspersample
=
audio_BitsPerSample
(
id
->
p_encoder
->
fmt_in
.
i_codec
);
/* Check if we need a filter for chroma conversion or resizing */
if
(
id
->
p_decoder
->
fmt_out
.
i_codec
!=
...
...
@@ -934,6 +950,9 @@ static int transcode_audio_new( sout_stream_t *p_stream,
return
VLC_EGENERIC
;
}
id
->
pp_filter
[
0
]
->
fmt_out
.
audio
.
i_bitspersample
=
audio_BitsPerSample
(
id
->
pp_filter
[
0
]
->
fmt_out
.
i_codec
);
/* Try a 2 stage conversion */
if
(
id
->
pp_filter
[
0
]
->
fmt_out
.
i_codec
!=
id
->
p_encoder
->
fmt_in
.
i_codec
)
...
...
@@ -1067,7 +1086,7 @@ static aout_buffer_t *audio_new_buffer( decoder_t *p_dec, int i_samples )
if
(
p_dec
->
fmt_out
.
audio
.
i_bitspersample
)
{
i_size
=
i_samples
*
p_dec
->
fmt_out
.
audio
.
i_bitspersample
*
i_size
=
i_samples
*
p_dec
->
fmt_out
.
audio
.
i_bitspersample
/
8
*
p_dec
->
fmt_out
.
audio
.
i_channels
;
}
else
if
(
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
&&
...
...
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