diff options
author | Peter Ross <pross@xvid.org> | 2008-08-02 01:26:38 +0000 |
---|---|---|
committer | Peter Ross <pross@xvid.org> | 2008-08-02 01:26:38 +0000 |
commit | abdff64682ac6fb7d2916d3b1101ce8b30c7ad93 (patch) | |
tree | 1f72e52189cf966dd75b8d49399f0dbf35f74349 /ffplay.c | |
parent | a78d882d76b459043328a2455bb5e19e2607f50b (diff) | |
download | ffmpeg-abdff64682ac6fb7d2916d3b1101ce8b30c7ad93.tar.gz |
Simplify AVCodecContext usage within FFplay audio_decode_frame()
Originally committed as revision 14503 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1571,6 +1571,7 @@ static int synchronize_audio(VideoState *is, short *samples, static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, double *pts_ptr) { AVPacket *pkt = &is->audio_pkt; + AVCodecContext *dec= is->audio_st->codec; int n, len1, data_size; double pts; @@ -1578,7 +1579,7 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, /* NOTE: the audio packet can contain several frames */ while (is->audio_pkt_size > 0) { data_size = buf_size; - len1 = avcodec_decode_audio2(is->audio_st->codec, + len1 = avcodec_decode_audio2(dec, (int16_t *)audio_buf, &data_size, is->audio_pkt_data, is->audio_pkt_size); if (len1 < 0) { @@ -1594,9 +1595,9 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, /* if no pts, then compute it */ pts = is->audio_clock; *pts_ptr = pts; - n = 2 * is->audio_st->codec->channels; + n = 2 * dec->channels; is->audio_clock += (double)data_size / - (double)(n * is->audio_st->codec->sample_rate); + (double)(n * dec->sample_rate); #if defined(DEBUG_SYNC) { static double last_clock; @@ -1621,7 +1622,7 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, if (packet_queue_get(&is->audioq, pkt, 1) < 0) return -1; if(pkt->data == flush_pkt.data){ - avcodec_flush_buffers(is->audio_st->codec); + avcodec_flush_buffers(dec); continue; } |