Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
b8813031
Commit
b8813031
authored
Aug 13, 2009
by
Laurent Aimar
Browse files
Used date_t instead of audio_date_t in codecs.
parent
09d375d4
Changes
16
Hide whitespace changes
Inline
Side-by-side
modules/codec/a52.c
View file @
b8813031
...
...
@@ -77,7 +77,7 @@ struct decoder_sys_t
/*
* Common properties
*/
audio_
date_t
end_date
;
date_t
end_date
;
mtime_t
i_pts
;
...
...
@@ -136,7 +136,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/* Misc init */
p_sys
->
b_packetizer
=
b_packetizer
;
p_sys
->
i_state
=
STATE_NOSYNC
;
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_sys
->
bytestream
=
block_BytestreamInit
();
...
...
@@ -187,12 +187,12 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys
->
i_state
=
STATE_NOSYNC
;
block_BytestreamEmpty
(
&
p_sys
->
bytestream
);
}
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
block_Release
(
*
pp_block
);
return
NULL
;
}
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
*
pp_block
);
...
...
@@ -228,9 +228,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* New frame, set the Presentation Time Stamp */
p_sys
->
i_pts
=
p_sys
->
bytestream
.
p_block
->
i_pts
;
if
(
p_sys
->
i_pts
!=
0
&&
p_sys
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_sys
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
}
p_sys
->
i_state
=
STATE_HEADER
;
...
...
@@ -350,8 +350,8 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer )
msg_Info
(
p_dec
,
"A/52 channels:%d samplerate:%d bitrate:%d"
,
p_sys
->
frame
.
i_channels
,
p_sys
->
frame
.
i_rate
,
p_sys
->
frame
.
i_bitrate
);
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
}
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
frame
.
i_rate
;
...
...
@@ -393,8 +393,8 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
p_buf
=
decoder_NewAudioBuffer
(
p_dec
,
p_sys
->
frame
.
i_samples
);
if
(
p_buf
==
NULL
)
return
NULL
;
p_buf
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_buf
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_samples
);
p_buf
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_buf
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_samples
);
return
p_buf
;
}
...
...
@@ -410,10 +410,10 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
p_block
=
block_New
(
p_dec
,
p_sys
->
frame
.
i_size
);
if
(
p_block
==
NULL
)
return
NULL
;
p_block
->
i_pts
=
p_block
->
i_dts
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_block
->
i_pts
=
p_block
->
i_dts
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_samples
)
-
p_block
->
i_pts
;
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
frame
.
i_samples
)
-
p_block
->
i_pts
;
return
p_block
;
}
...
...
modules/codec/adpcm.c
View file @
b8813031
...
...
@@ -72,7 +72,7 @@ struct decoder_sys_t
size_t
i_block
;
size_t
i_samplesperblock
;
audio_
date_t
end_date
;
date_t
end_date
;
};
static
void
DecodeAdpcmMs
(
decoder_t
*
,
int16_t
*
,
uint8_t
*
);
...
...
@@ -254,8 +254,8 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
pi_channels_maps
[
p_dec
->
fmt_in
.
audio
.
i_channels
];
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_dec
->
pf_decode_audio
=
DecodeBlock
;
...
...
@@ -275,11 +275,11 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block
=
*
pp_block
;
if
(
p_block
->
i_pts
!=
0
&&
p_block
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_block
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
else
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
else
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
...
...
@@ -300,9 +300,9 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
}
p_out
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_out
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_out
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_sys
->
i_samplesperblock
);
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
i_samplesperblock
);
switch
(
p_sys
->
codec
)
{
...
...
modules/codec/aes3.c
View file @
b8813031
...
...
@@ -64,7 +64,7 @@ struct decoder_sys_t
/*
* Output properties
*/
audio_
date_t
end_date
;
date_t
end_date
;
};
#define AES3_HEADER_LEN 4
...
...
@@ -134,8 +134,8 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
if
(
p_aout_buffer
==
NULL
)
goto
exit
;
p_aout_buffer
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_aout_buffer
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
i_frame_length
);
p_aout_buffer
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_aout_buffer
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
i_frame_length
);
p_block
->
i_buffer
-=
AES3_HEADER_LEN
;
p_block
->
p_buffer
+=
AES3_HEADER_LEN
;
...
...
@@ -219,8 +219,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if
(
!
p_block
)
return
NULL
;
p_block
->
i_pts
=
p_block
->
i_dts
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
i_frame_length
)
-
p_block
->
i_pts
;
p_block
->
i_pts
=
p_block
->
i_dts
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
i_frame_length
)
-
p_block
->
i_pts
;
/* Just pass on the incoming frame */
return
p_block
;
...
...
@@ -243,8 +243,8 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
return
VLC_EGENERIC
;
/* Misc init */
aout_D
ateInit
(
&
p_sys
->
end_date
,
48000
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
48000
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
/* Set output properties */
p_dec
->
fmt_out
.
i_cat
=
AUDIO_ES
;
...
...
@@ -297,12 +297,12 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
/* Date management */
if
(
p_block
->
i_pts
>
0
&&
p_block
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_block
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
...
...
modules/codec/araw.c
View file @
b8813031
...
...
@@ -74,7 +74,7 @@ struct decoder_sys_t
const
int16_t
*
p_logtos16
;
/* used with m/alaw to int16_t */
int
i_bytespersample
;
audio_
date_t
end_date
;
date_t
end_date
;
};
static
const
int
pi_channels_maps
[]
=
...
...
@@ -311,8 +311,8 @@ static int DecoderOpen( vlc_object_t *p_this )
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
}
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_sys
->
i_bytespersample
=
(
p_dec
->
fmt_in
.
audio
.
i_bitspersample
+
7
)
/
8
;
p_dec
->
pf_decode_audio
=
DecodeBlock
;
...
...
@@ -337,11 +337,11 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block
=
*
pp_block
;
if
(
p_block
->
i_pts
!=
0
&&
p_block
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_block
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
else
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
else
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
...
...
@@ -370,8 +370,8 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
}
p_out
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_out
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
i_samples
);
p_out
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_out
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
i_samples
);
if
(
p_sys
->
p_logtos16
)
{
...
...
modules/codec/avcodec/audio.c
View file @
b8813031
...
...
@@ -60,7 +60,7 @@ struct decoder_sys_t
* Output properties
*/
audio_sample_format_t
aout_format
;
audio_
date_t
end_date
;
date_t
end_date
;
/*
*
...
...
@@ -207,9 +207,9 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys
->
i_previous_channels
=
0
;
p_sys
->
i_previous_layout
=
0
;
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
if
(
p_dec
->
fmt_in
.
audio
.
i_rate
)
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_dec
->
fmt_in
.
audio
.
i_rate
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_dec
->
fmt_in
.
audio
.
i_rate
,
1
);
/* */
p_dec
->
fmt_out
.
i_cat
=
AUDIO_ES
;
...
...
@@ -234,8 +234,8 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
if
(
(
p_buffer
=
decoder_NewAudioBuffer
(
p_dec
,
i_samples
)
)
==
NULL
)
return
NULL
;
p_buffer
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_buffer
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
i_samples
);
p_buffer
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_buffer
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
i_samples
);
if
(
p_sys
->
b_extract
)
aout_ChannelExtract
(
p_buffer
->
p_buffer
,
p_dec
->
fmt_out
.
audio
.
i_channels
,
...
...
@@ -269,7 +269,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
block_Release
(
p_block
);
avcodec_flush_buffers
(
p_sys
->
p_context
);
p_sys
->
i_samples
=
0
;
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
if
(
p_sys
->
i_codec_id
==
CODEC_ID_MP2
||
p_sys
->
i_codec_id
==
CODEC_ID_MP3
)
p_sys
->
i_reject_count
=
3
;
...
...
@@ -284,7 +284,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
return
p_buffer
;
}
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
&&
!
p_block
->
i_pts
)
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
&&
!
p_block
->
i_pts
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
...
...
@@ -348,17 +348,17 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
if
(
p_dec
->
fmt_out
.
audio
.
i_rate
!=
(
unsigned
int
)
p_sys
->
p_context
->
sample_rate
)
{
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_sys
->
p_context
->
sample_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_sys
->
p_context
->
sample_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
/* **** Set audio output parameters **** */
SetupOutputFormat
(
p_dec
,
true
);
if
(
p_block
->
i_pts
!=
0
&&
p_block
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_block
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
p_block
->
i_pts
=
0
;
...
...
modules/codec/dts.c
View file @
b8813031
...
...
@@ -73,7 +73,7 @@ struct decoder_sys_t
/*
* Common properties
*/
audio_
date_t
end_date
;
date_t
end_date
;
mtime_t
i_pts
;
...
...
@@ -150,7 +150,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/* Misc init */
p_sys
->
b_packetizer
=
b_packetizer
;
p_sys
->
i_state
=
STATE_NOSYNC
;
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_sys
->
b_dts_hd
=
false
;
p_sys
->
bytestream
=
block_BytestreamInit
();
...
...
@@ -189,12 +189,12 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys
->
i_state
=
STATE_NOSYNC
;
block_BytestreamEmpty
(
&
p_sys
->
bytestream
);
}
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
block_Release
(
*
pp_block
);
return
NULL
;
}
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
*
pp_block
);
...
...
@@ -231,9 +231,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* New frame, set the Presentation Time Stamp */
p_sys
->
i_pts
=
p_sys
->
bytestream
.
p_block
->
i_pts
;
if
(
p_sys
->
i_pts
!=
0
&&
p_sys
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_sys
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
}
p_sys
->
i_state
=
STATE_HEADER
;
...
...
@@ -361,8 +361,8 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer )
msg_Info
(
p_dec
,
"DTS channels:%d samplerate:%d bitrate:%d"
,
p_sys
->
i_channels
,
p_sys
->
i_rate
,
p_sys
->
i_bit_rate
);
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
}
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
i_rate
;
...
...
@@ -409,9 +409,9 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
p_buf
->
i_nb_samples
=
p_sys
->
i_frame_length
;
p_buf
->
i_nb_bytes
=
p_sys
->
i_frame_size
;
p_buf
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_buf
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_buf
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_sys
->
i_frame_length
);
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
i_frame_length
);
return
p_buf
;
}
...
...
@@ -427,9 +427,9 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
p_block
=
block_New
(
p_dec
,
p_sys
->
i_frame_size
);
if
(
p_block
==
NULL
)
return
NULL
;
p_block
->
i_pts
=
p_block
->
i_dts
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_block
->
i_pts
=
p_block
->
i_dts
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_block
->
i_length
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
i_frame_length
)
-
p_block
->
i_pts
;
return
p_block
;
...
...
modules/codec/faad.c
View file @
b8813031
...
...
@@ -62,7 +62,7 @@ struct decoder_sys_t
faacDecHandle
*
hfaad
;
/* samples */
audio_
date_t
date
;
date_t
date
;
/* temporary buffer */
uint8_t
*
p_buffer
;
...
...
@@ -134,7 +134,7 @@ static int Open( vlc_object_t *p_this )
}
/* Misc init */
aout_D
ateSet
(
&
p_sys
->
date
,
0
);
d
ate
_
Set
(
&
p_sys
->
date
,
0
);
p_dec
->
fmt_out
.
i_cat
=
AUDIO_ES
;
if
(
vlc_CPU
()
&
CPU_CAPABILITY_FPU
)
...
...
@@ -165,7 +165,7 @@ static int Open( vlc_object_t *p_this )
p_dec
->
fmt_out
.
audio
.
i_physical_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
pi_channels_guessed
[
i_channels
];
aout_D
ateInit
(
&
p_sys
->
date
,
i_rate
);
d
ate
_
Init
(
&
p_sys
->
date
,
i_rate
,
1
);
}
else
{
...
...
@@ -261,7 +261,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
pi_channels_guessed
[
i_channels
];
aout_D
ateInit
(
&
p_sys
->
date
,
i_rate
);
d
ate
_
Init
(
&
p_sys
->
date
,
i_rate
,
1
);
}
}
...
...
@@ -284,14 +284,14 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_dec
->
fmt_out
.
audio
.
i_physical_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
pi_channels_guessed
[
i_channels
];
aout_D
ateInit
(
&
p_sys
->
date
,
i_rate
);
d
ate
_
Init
(
&
p_sys
->
date
,
i_rate
,
1
);
}
if
(
p_block
->
i_pts
!=
0
&&
p_block
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
date
)
)
if
(
p_block
->
i_pts
!=
0
&&
p_block
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
date
)
)
{
aout_D
ateSet
(
&
p_sys
->
date
,
p_block
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
date
,
p_block
->
i_pts
);
}
else
if
(
!
aout_D
ateGet
(
&
p_sys
->
date
)
)
else
if
(
!
d
ate
_
Get
(
&
p_sys
->
date
)
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
...
...
@@ -353,8 +353,8 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* We decoded a valid frame */
if
(
p_dec
->
fmt_out
.
audio
.
i_rate
!=
frame
.
samplerate
)
{
aout_D
ateInit
(
&
p_sys
->
date
,
frame
.
samplerate
);
aout_D
ateSet
(
&
p_sys
->
date
,
p_block
->
i_pts
);
d
ate
_
Init
(
&
p_sys
->
date
,
frame
.
samplerate
,
1
);
d
ate
_
Set
(
&
p_sys
->
date
,
p_block
->
i_pts
);
}
p_block
->
i_pts
=
0
;
/* PTS is valid only once */
...
...
@@ -415,8 +415,8 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
}
p_out
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
date
);
p_out
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
date
,
frame
.
samples
/
frame
.
channels
);
p_out
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
date
);
p_out
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
date
,
frame
.
samples
/
frame
.
channels
);
DoReordering
(
(
uint32_t
*
)
p_out
->
p_buffer
,
samples
,
frame
.
samples
/
frame
.
channels
,
frame
.
channels
,
...
...
modules/codec/flac.c
View file @
b8813031
...
...
@@ -90,7 +90,7 @@ struct decoder_sys_t
/*
* Common properties
*/
audio_
date_t
end_date
;
date_t
end_date
;
mtime_t
i_pts
;
int
i_frame_size
,
i_frame_length
,
i_bits_per_sample
;
...
...
@@ -220,7 +220,7 @@ static int OpenDecoder( vlc_object_t *p_this )
return
VLC_ENOMEM
;
/* Misc init */
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_sys
->
i_state
=
STATE_NOSYNC
;
p_sys
->
b_stream_info
=
false
;
p_sys
->
p_block
=
NULL
;
...
...
@@ -389,7 +389,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys
->
i_state
=
STATE_NOSYNC
;
block_BytestreamEmpty
(
&
p_sys
->
bytestream
);
}
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
block_Release
(
*
pp_block
);
return
NULL
;
}
...
...
@@ -402,18 +402,18 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
}
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
&&
!
(
*
pp_block
)
->
i_pts
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
*
pp_block
);
return
NULL
;
}
else
if
(
!
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
else
if
(
!
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
/* The first PTS is as good as anything else. */
p_sys
->
i_rate
=
p_dec
->
fmt_out
.
audio
.
i_rate
;
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
(
*
pp_block
)
->
i_pts
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
(
*
pp_block
)
->
i_pts
);
}
block_BytestreamPush
(
&
p_sys
->
bytestream
,
*
pp_block
);
...
...
@@ -445,9 +445,9 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
/* New frame, set the Presentation Time Stamp */
p_sys
->
i_pts
=
p_sys
->
bytestream
.
p_block
->
i_pts
;
if
(
p_sys
->
i_pts
!=
0
&&
p_sys
->
i_pts
!=
aout_D
ateGet
(
&
p_sys
->
end_date
)
)
p_sys
->
i_pts
!=
d
ate
_
Get
(
&
p_sys
->
end_date
)
)
{
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_sys
->
i_pts
);
}
p_sys
->
i_state
=
STATE_HEADER
;
...
...
@@ -476,7 +476,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
if
(
p_sys
->
i_rate
!=
p_dec
->
fmt_out
.
audio
.
i_rate
)
{
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
i_rate
;
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_sys
->
i_rate
,
1
);
}
p_sys
->
i_state
=
STATE_NEXT_SYNC
;
p_sys
->
i_frame_size
=
1
;
...
...
@@ -535,10 +535,10 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
/* Date management */
p_sout_block
->
i_pts
=
p_sout_block
->
i_dts
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
p_sys
->
i_frame_length
);
p_sout_block
->
i_dts
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
d
ate
_
Increment
(
&
p_sys
->
end_date
,
p_sys
->
i_frame_length
);
p_sout_block
->
i_length
=
aout_D
ateGet
(
&
p_sys
->
end_date
)
-
p_sout_block
->
i_pts
;
d
ate
_
Get
(
&
p_sys
->
end_date
)
-
p_sout_block
->
i_pts
;
return
p_sout_block
;
}
...
...
@@ -710,7 +710,7 @@ static void DecoderMetadataCallback( const FLAC__StreamDecoder *decoder,
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
metadata
->
data
.
stream_info
.
bits_per_sample
;
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
,
1
);
msg_Dbg
(
p_dec
,
"channels:%d samplerate:%d bitspersamples:%d"
,
p_dec
->
fmt_out
.
audio
.
i_channels
,
p_dec
->
fmt_out
.
audio
.
i_rate
,
...
...
modules/codec/fluidsynth.c
View file @
b8813031
...
...
@@ -59,7 +59,7 @@ struct decoder_sys_t
fluid_settings_t
*
settings
;
fluid_synth_t
*
synth
;
int
soundfont
;
audio_
date_t
end_date
;
date_t
end_date
;
};
...
...
@@ -110,8 +110,8 @@ static int Open (vlc_object_t *p_this)
return
VLC_EGENERIC
;
}
aout_D
ateInit
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
);
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Init
(
&
p_sys
->
end_date
,
p_dec
->
fmt_out
.
audio
.
i_rate
,
1
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
return
VLC_SUCCESS
;
}
...
...
@@ -142,10 +142,10 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
return
NULL
;
*
pp_block
=
NULL
;
if
(
p_block
->
i_pts
&&
!
aout_D
ateGet
(
&
p_sys
->
end_date
))
aout_D
ateSet
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
if
(
p_block
->
i_pts
&&
!
d
ate
_
Get
(
&
p_sys
->
end_date
))
d
ate
_
Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
else
if
(
p_block
->
i_pts
<
aout_D
ateGet
(
&
p_sys
->
end_date
))
if
(
p_block
->
i_pts
<
d
ate
_
Get
(
&
p_sys
->
end_date
))
{
msg_Warn
(
p_dec
,
"MIDI message in the past?"
);
goto
drop
;
...
...
@@ -178,7 +178,7 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
}
unsigned
samples
=
(
p_block
->
i_pts
-
aout_D
ateGet
(
&
p_sys
->
end_date
))
*
441
/
10000
;
(
p_block
->
i_pts
-
d
ate
_
Get
(
&
p_sys
->
end_date
))
*
441
/
10000
;
if
(
samples
==
0
)
return
NULL
;
...
...
@@ -186,8 +186,8 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
if
(
p_out
==
NULL
)
goto
drop
;
p_out
->
start_date
=
aout_D
ateGet
(
&
p_sys
->
end_date
);
p_out
->
end_date
=
aout_D
ateIncrement
(
&
p_sys
->
end_date
,
samples
);
p_out
->
start_date
=
d
ate
_
Get
(
&
p_sys
->
end_date
);
p_out
->
end_date
=
d
ate
_
Increment
(
&
p_sys
->
end_date
,
samples
);
fluid_synth_write_float
(
p_sys
->
synth
,
samples
,
p_out
->
p_buffer
,
0
,
2
,
p_out
->
p_buffer
,
1
,
2
);
...
...
modules/codec/lpcm.c
View file @
b8813031
...
...
@@ -72,7 +72,7 @@ struct decoder_sys_t
/*
* Output properties
*/
audio_
date_t
end_date
;
date_t
end_date
;
/* */
unsigned
i_header_size
;
...
...
@@ -193,7 +193,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/* Misc init */
p_sys
->
b_packetizer
=
b_packetizer
;
aout_D
ateSet
(
&
p_sys
->
end_date
,
0
);
d
ate
_
Set
(
&
p_sys
->
end_date
,
0
);
p_sys
->
i_type
=
i_type
;