[FFmpeg-devel] [PATCH] ffplay: rename temporary variable pts in audio_decode_frame()
Stefano Sabatini
stefasab at gmail.com
Sat Feb 2 16:17:11 CET 2013
Also rename variable pts to pts_time.
---
ffplay.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/ffplay.c b/ffplay.c
index f5acbca..80e3187 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2073,7 +2073,7 @@ static int synchronize_audio(VideoState *is, int nb_samples)
* stored in is->audio_buf, with size in bytes given by the return
* value.
*/
-static int audio_decode_frame(VideoState *is, double *pts_ptr)
+static int audio_decode_frame(VideoState *is, double *pts_time)
{
AVPacket *pkt_temp = &is->audio_pkt_temp;
AVPacket *pkt = &is->audio_pkt;
@@ -2081,7 +2081,6 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
int len1, len2, data_size, resampled_data_size;
int64_t dec_channel_layout;
int got_frame;
- double pts;
int new_packet = 0;
int flush_complete = 0;
int wanted_nb_samples;
@@ -2175,16 +2174,15 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
}
/* if no pts, then compute it */
- pts = is->audio_clock;
- *pts_ptr = pts;
+ *pts_time = is->audio_clock;
is->audio_clock += (double)data_size /
(is->frame->channels * is->frame->sample_rate * av_get_bytes_per_sample(is->frame->format));
#ifdef DEBUG
{
static double last_clock;
- printf("audio: delay=%0.3f clock=%0.3f pts=%0.3f\n",
+ printf("audio: delay=%0.3f clock=%0.3f pts_time=%0.3f\n",
is->audio_clock - last_clock,
- is->audio_clock, pts);
+ is->audio_clock, *pts_time);
last_clock = is->audio_clock;
}
#endif
@@ -2214,7 +2212,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
*pkt_temp = *pkt;
- /* if update the audio clock with the pts */
+ /* if update the audio clock with the pts time */
if (pkt->pts != AV_NOPTS_VALUE) {
is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts;
}
@@ -2228,13 +2226,13 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
int audio_size, len1;
int bytes_per_sec;
int frame_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, 1, is->audio_tgt.fmt, 1);
- double pts;
+ double pts_time;
audio_callback_time = av_gettime();
while (len > 0) {
if (is->audio_buf_index >= is->audio_buf_size) {
- audio_size = audio_decode_frame(is, &pts);
+ audio_size = audio_decode_frame(is, &pts_time);
if (audio_size < 0) {
/* if error, just output silence */
is->audio_buf = is->silence_buf;
--
1.7.9.5
More information about the ffmpeg-devel
mailing list