Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b931c16e
Commit
b931c16e
authored
Sep 08, 2012
by
Ludovic Fauvet
Committed by
Jean-Baptiste Kempf
Sep 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speex: remove tabs and trailing spaces
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
3e8dc1bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
131 additions
and
131 deletions
+131
-131
modules/codec/speex.c
modules/codec/speex.c
+131
-131
No files found.
modules/codec/speex.c
View file @
b931c16e
...
@@ -224,14 +224,14 @@ static int OpenDecoder( vlc_object_t *p_this )
...
@@ -224,14 +224,14 @@ static int OpenDecoder( vlc_object_t *p_this )
/*
/*
Set callbacks
Set callbacks
If the codec is spxr then this decoder is
If the codec is spxr then this decoder is
being invoked on a Speex stream arriving via RTP.
being invoked on a Speex stream arriving via RTP.
A special decoder callback is used.
A special decoder callback is used.
*/
*/
if
(
p_dec
->
fmt_in
.
i_original_fourcc
==
VLC_FOURCC
(
's'
,
'p'
,
'x'
,
'r'
))
if
(
p_dec
->
fmt_in
.
i_original_fourcc
==
VLC_FOURCC
(
's'
,
'p'
,
'x'
,
'r'
))
{
{
msg_Dbg
(
p_dec
,
"Using RTP version of Speex decoder @ rate %d."
,
msg_Dbg
(
p_dec
,
"Using RTP version of Speex decoder @ rate %d."
,
p_dec
->
fmt_in
.
audio
.
i_rate
);
p_dec
->
fmt_in
.
audio
.
i_rate
);
p_dec
->
pf_decode_audio
=
DecodeRtpSpeexPacket
;
p_dec
->
pf_decode_audio
=
DecodeRtpSpeexPacket
;
}
}
else
else
...
@@ -484,74 +484,74 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
...
@@ -484,74 +484,74 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
if
(
p_sys
->
b_packetizer
)
if
(
p_sys
->
b_packetizer
)
{
{
if
(
p_sys
->
p_header
->
frames_per_packet
>
1
)
if
(
p_sys
->
p_header
->
frames_per_packet
>
1
)
{
{
short
*
p_frame_holder
=
NULL
;
short
*
p_frame_holder
=
NULL
;
int
i_bits_before
=
0
,
i_bits_after
=
0
,
i_bytes_in_speex_frame
=
0
,
int
i_bits_before
=
0
,
i_bits_after
=
0
,
i_bytes_in_speex_frame
=
0
,
i_pcm_output_size
=
0
,
i_bits_in_speex_frame
=
0
;
i_pcm_output_size
=
0
,
i_bits_in_speex_frame
=
0
;
block_t
*
p_new_block
=
NULL
;
block_t
*
p_new_block
=
NULL
;
i_pcm_output_size
=
p_sys
->
p_header
->
frame_size
;
i_pcm_output_size
=
p_sys
->
p_header
->
frame_size
;
p_frame_holder
=
(
short
*
)
xmalloc
(
sizeof
(
short
)
*
i_pcm_output_size
);
p_frame_holder
=
(
short
*
)
xmalloc
(
sizeof
(
short
)
*
i_pcm_output_size
);
speex_bits_read_from
(
&
p_sys
->
bits
,
(
char
*
)
p_oggpacket
->
packet
,
speex_bits_read_from
(
&
p_sys
->
bits
,
(
char
*
)
p_oggpacket
->
packet
,
p_oggpacket
->
bytes
);
p_oggpacket
->
bytes
);
i_bits_before
=
speex_bits_remaining
(
&
p_sys
->
bits
);
i_bits_before
=
speex_bits_remaining
(
&
p_sys
->
bits
);
speex_decode_int
(
p_sys
->
p_state
,
&
p_sys
->
bits
,
p_frame_holder
);
speex_decode_int
(
p_sys
->
p_state
,
&
p_sys
->
bits
,
p_frame_holder
);
i_bits_after
=
speex_bits_remaining
(
&
p_sys
->
bits
);
i_bits_after
=
speex_bits_remaining
(
&
p_sys
->
bits
);
i_bits_in_speex_frame
=
i_bits_before
-
i_bits_after
;
i_bits_in_speex_frame
=
i_bits_before
-
i_bits_after
;
i_bytes_in_speex_frame
=
(
i_bits_in_speex_frame
+
i_bytes_in_speex_frame
=
(
i_bits_in_speex_frame
+
(
8
-
(
i_bits_in_speex_frame
%
8
))
)
(
8
-
(
i_bits_in_speex_frame
%
8
))
)
/
8
;
/
8
;
p_new_block
=
block_New
(
p_dec
,
i_bytes_in_speex_frame
);
p_new_block
=
block_New
(
p_dec
,
i_bytes_in_speex_frame
);
memset
(
p_new_block
->
p_buffer
,
0xff
,
i_bytes_in_speex_frame
);
memset
(
p_new_block
->
p_buffer
,
0xff
,
i_bytes_in_speex_frame
);
/*
/*
* Copy the first frame in this packet to a new packet.
* Copy the first frame in this packet to a new packet.
*/
*/
speex_bits_rewind
(
&
p_sys
->
bits
);
speex_bits_rewind
(
&
p_sys
->
bits
);
speex_bits_write
(
&
p_sys
->
bits
,
speex_bits_write
(
&
p_sys
->
bits
,
(
char
*
)
p_new_block
->
p_buffer
,
(
char
*
)
p_new_block
->
p_buffer
,
(
int
)
i_bytes_in_speex_frame
);
(
int
)
i_bytes_in_speex_frame
);
/*
/*
* Move the remaining part of the original packet (subsequent
* Move the remaining part of the original packet (subsequent
* frames, if there are any) into the beginning
* frames, if there are any) into the beginning
* of the original packet so
* of the original packet so
* they are preserved following the realloc.
* they are preserved following the realloc.
* Note: Any bits that
* Note: Any bits that
* remain in the initial packet
* remain in the initial packet
* are "filler" if they do not constitute
* are "filler" if they do not constitute
* an entire byte.
* an entire byte.
*/
*/
if
(
i_bits_after
>
7
)
if
(
i_bits_after
>
7
)
{
{
/* round-down since we rounded-up earlier (to include
/* round-down since we rounded-up earlier (to include
* the speex terminator code.
* the speex terminator code.
*/
*/
i_bytes_in_speex_frame
--
;
i_bytes_in_speex_frame
--
;
speex_bits_write
(
&
p_sys
->
bits
,
speex_bits_write
(
&
p_sys
->
bits
,
(
char
*
)
p_block
->
p_buffer
,
(
char
*
)
p_block
->
p_buffer
,
p_block
->
i_buffer
-
i_bytes_in_speex_frame
);
p_block
->
i_buffer
-
i_bytes_in_speex_frame
);
p_block
=
block_Realloc
(
p_block
,
p_block
=
block_Realloc
(
p_block
,
0
,
0
,
p_block
->
i_buffer
-
i_bytes_in_speex_frame
);
p_block
->
i_buffer
-
i_bytes_in_speex_frame
);
*
pp_block
=
p_block
;
*
pp_block
=
p_block
;
}
}
else
else
{
{
speex_bits_reset
(
&
p_sys
->
bits
);
speex_bits_reset
(
&
p_sys
->
bits
);
}
}
free
(
p_frame_holder
);
free
(
p_frame_holder
);
return
SendPacket
(
p_dec
,
p_new_block
);
return
SendPacket
(
p_dec
,
p_new_block
);
}
}
else
else
{
{
return
SendPacket
(
p_dec
,
p_block
);
return
SendPacket
(
p_dec
,
p_block
);
}
}
}
}
else
else
{
{
...
@@ -574,63 +574,63 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
...
@@ -574,63 +574,63 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
if
(
!
p_speex_bit_block
||
p_speex_bit_block
->
i_pts
<=
VLC_TS_INVALID
)
if
(
!
p_speex_bit_block
||
p_speex_bit_block
->
i_pts
<=
VLC_TS_INVALID
)
return
NULL
;
return
NULL
;
/*
/*
If the SpeexBits buffer size is 0 (a default value),
If the SpeexBits buffer size is 0 (a default value),
we know that a proper initialization has not yet been done.
we know that a proper initialization has not yet been done.
*/
*/
if
(
p_sys
->
bits
.
buf_size
==
0
)
if
(
p_sys
->
bits
.
buf_size
==
0
)
{
{
p_sys
->
p_header
=
(
SpeexHeader
*
)
malloc
(
sizeof
(
SpeexHeader
));
p_sys
->
p_header
=
(
SpeexHeader
*
)
malloc
(
sizeof
(
SpeexHeader
));
if
(
!
p_sys
->
p_header
)
if
(
!
p_sys
->
p_header
)
{
{
msg_Err
(
p_dec
,
"Could not allocate a Speex header."
);
msg_Err
(
p_dec
,
"Could not allocate a Speex header."
);
return
NULL
;
return
NULL
;
}
}
speex_init_header
(
p_sys
->
p_header
,
p_sys
->
rtp_rate
,
1
,
&
speex_nb_mode
);
speex_init_header
(
p_sys
->
p_header
,
p_sys
->
rtp_rate
,
1
,
&
speex_nb_mode
);
speex_bits_init
(
&
p_sys
->
bits
);
speex_bits_init
(
&
p_sys
->
bits
);
p_sys
->
p_state
=
speex_decoder_init
(
&
speex_nb_mode
);
p_sys
->
p_state
=
speex_decoder_init
(
&
speex_nb_mode
);
if
(
!
p_sys
->
p_state
)
if
(
!
p_sys
->
p_state
)
{
{
msg_Err
(
p_dec
,
"Could not allocate a Speex decoder."
);
msg_Err
(
p_dec
,
"Could not allocate a Speex decoder."
);
free
(
p_sys
->
p_header
);
free
(
p_sys
->
p_header
);
return
NULL
;
return
NULL
;
}
}
/*
/*
Assume that variable bit rate is enabled. Also assume
Assume that variable bit rate is enabled. Also assume
that there is only one frame per packet.
that there is only one frame per packet.
*/
*/
p_sys
->
p_header
->
vbr
=
1
;
p_sys
->
p_header
->
vbr
=
1
;
p_sys
->
p_header
->
frames_per_packet
=
1
;
p_sys
->
p_header
->
frames_per_packet
=
1
;
p_dec
->
fmt_out
.
audio
.
i_channels
=
p_sys
->
p_header
->
nb_channels
;
p_dec
->
fmt_out
.
audio
.
i_channels
=
p_sys
->
p_header
->
nb_channels
;
p_dec
->
fmt_out
.
audio
.
i_physical_channels
=
p_dec
->
fmt_out
.
audio
.
i_physical_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
pi_channels_maps
[
p_sys
->
p_header
->
nb_channels
];
pi_channels_maps
[
p_sys
->
p_header
->
nb_channels
];
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
p_header
->
rate
;
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
p_header
->
rate
;
if
(
speex_mode_query
(
&
speex_nb_mode
,
if
(
speex_mode_query
(
&
speex_nb_mode
,
SPEEX_MODE_FRAME_SIZE
,
SPEEX_MODE_FRAME_SIZE
,
&
i_speex_frame_size
)
)
&
i_speex_frame_size
)
)
{
{
msg_Err
(
p_dec
,
"Could not determine the frame size."
);
msg_Err
(
p_dec
,
"Could not determine the frame size."
);
speex_decoder_destroy
(
p_sys
->
p_state
);
speex_decoder_destroy
(
p_sys
->
p_state
);
free
(
p_sys
->
p_header
);
free
(
p_sys
->
p_header
);
return
NULL
;
return
NULL
;
}
}
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
=
i_speex_frame_size
;
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
=
i_speex_frame_size
;
date_Init
(
&
p_sys
->
end_date
,
p_sys
->
p_header
->
rate
,
1
);
date_Init
(
&
p_sys
->
end_date
,
p_sys
->
p_header
->
rate
,
1
);
}
}
/*
/*
If the SpeexBits are initialized but there is
If the SpeexBits are initialized but there is
still no header, an error must be thrown.
still no header, an error must be thrown.
*/
*/
if
(
!
p_sys
->
p_header
)
if
(
!
p_sys
->
p_header
)
{
{
msg_Err
(
p_dec
,
"There is no valid Speex header found."
);
msg_Err
(
p_dec
,
"There is no valid Speex header found."
);
return
NULL
;
return
NULL
;
}
}
*
pp_block
=
NULL
;
*
pp_block
=
NULL
;
...
@@ -639,43 +639,43 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
...
@@ -639,43 +639,43 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
/*
/*
Ask for a new audio output buffer and make sure
Ask for a new audio output buffer and make sure
we get one.
we get one.
*/
*/
p_aout_buffer
=
decoder_NewAudioBuffer
(
p_dec
,
p_aout_buffer
=
decoder_NewAudioBuffer
(
p_dec
,
p_sys
->
p_header
->
frame_size
);
p_sys
->
p_header
->
frame_size
);
if
(
!
p_aout_buffer
||
p_aout_buffer
->
i_buffer
==
0
)
if
(
!
p_aout_buffer
||
p_aout_buffer
->
i_buffer
==
0
)
{
{
msg_Err
(
p_dec
,
"Oops: No new buffer was returned!"
);
msg_Err
(
p_dec
,
"Oops: No new buffer was returned!"
);
return
NULL
;
return
NULL
;
}
}
/*
/*
Read the Speex payload into the SpeexBits buffer.
Read the Speex payload into the SpeexBits buffer.
*/
*/
speex_bits_read_from
(
&
p_sys
->
bits
,
speex_bits_read_from
(
&
p_sys
->
bits
,
(
char
*
)
p_speex_bit_block
->
p_buffer
,
(
char
*
)
p_speex_bit_block
->
p_buffer
,
p_speex_bit_block
->
i_buffer
);
p_speex_bit_block
->
i_buffer
);
/*
/*
Decode the input and ensure that no errors
Decode the input and ensure that no errors
were encountered.
were encountered.
*/
*/
i_decode_ret
=
speex_decode_int
(
p_sys
->
p_state
,
&
p_sys
->
bits
,
i_decode_ret
=
speex_decode_int
(
p_sys
->
p_state
,
&
p_sys
->
bits
,
(
int16_t
*
)
p_aout_buffer
->
p_buffer
);
(
int16_t
*
)
p_aout_buffer
->
p_buffer
);
if
(
i_decode_ret
<
0
)
if
(
i_decode_ret
<
0
)
{
{
msg_Err
(
p_dec
,
"Decoding failed. Perhaps we have a bad stream?"
);
msg_Err
(
p_dec
,
"Decoding failed. Perhaps we have a bad stream?"
);
return
NULL
;
return
NULL
;
}
}
/*
/*
Handle date management on the audio output buffer.
Handle date management on the audio output buffer.
*/
*/
p_aout_buffer
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_aout_buffer
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_aout_buffer
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
p_aout_buffer
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
p_sys
->
p_header
->
frame_size
)
-
p_aout_buffer
->
i_pts
;
p_sys
->
p_header
->
frame_size
)
-
p_aout_buffer
->
i_pts
;
p_sys
->
i_frame_in_packet
++
;
p_sys
->
i_frame_in_packet
++
;
block_Release
(
p_speex_bit_block
);
block_Release
(
p_speex_bit_block
);
...
...
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