annotate ffmpeg/libavcodec/audio_frame_queue.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * Audio Frame Queue
yading@10 3 * Copyright (c) 2012 Justin Ruggles
yading@10 4 *
yading@10 5 * This file is part of Libav.
yading@10 6 *
yading@10 7 * Libav is free software; you can redistribute it and/or
yading@10 8 * modify it under the terms of the GNU Lesser General Public
yading@10 9 * License as published by the Free Software Foundation; either
yading@10 10 * version 2.1 of the License, or (at your option) any later version.
yading@10 11 *
yading@10 12 * Libav is distributed in the hope that it will be useful,
yading@10 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 15 * Lesser General Public License for more details.
yading@10 16 *
yading@10 17 * You should have received a copy of the GNU Lesser General Public
yading@10 18 * License along with Libav; if not, write to the Free Software
yading@10 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 20 */
yading@10 21
yading@10 22 #ifndef AVCODEC_AUDIO_FRAME_QUEUE_H
yading@10 23 #define AVCODEC_AUDIO_FRAME_QUEUE_H
yading@10 24
yading@10 25 #include "avcodec.h"
yading@10 26
yading@10 27 typedef struct AudioFrame {
yading@10 28 int64_t pts;
yading@10 29 int duration;
yading@10 30 } AudioFrame;
yading@10 31
yading@10 32 typedef struct AudioFrameQueue {
yading@10 33 AVCodecContext *avctx;
yading@10 34 int remaining_delay;
yading@10 35 int remaining_samples;
yading@10 36 AudioFrame *frames;
yading@10 37 unsigned frame_count;
yading@10 38 unsigned frame_alloc;
yading@10 39 } AudioFrameQueue;
yading@10 40
yading@10 41 /**
yading@10 42 * Initialize AudioFrameQueue.
yading@10 43 *
yading@10 44 * @param avctx context to use for time_base and av_log
yading@10 45 * @param afq queue context
yading@10 46 */
yading@10 47 void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq);
yading@10 48
yading@10 49 /**
yading@10 50 * Close AudioFrameQueue.
yading@10 51 *
yading@10 52 * Frees memory if needed.
yading@10 53 *
yading@10 54 * @param afq queue context
yading@10 55 */
yading@10 56 void ff_af_queue_close(AudioFrameQueue *afq);
yading@10 57
yading@10 58 /**
yading@10 59 * Add a frame to the queue.
yading@10 60 *
yading@10 61 * @param afq queue context
yading@10 62 * @param f frame to add to the queue
yading@10 63 */
yading@10 64 int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f);
yading@10 65
yading@10 66 /**
yading@10 67 * Remove frame(s) from the queue.
yading@10 68 *
yading@10 69 * Retrieves the pts of the next available frame, or a generated pts based on
yading@10 70 * the last frame duration if there are no frames left in the queue. The number
yading@10 71 * of requested samples should be the full number of samples represented by the
yading@10 72 * packet that will be output by the encoder. If fewer samples are available
yading@10 73 * in the queue, a smaller value will be used for the output duration.
yading@10 74 *
yading@10 75 * @param afq queue context
yading@10 76 * @param nb_samples number of samples to remove from the queue
yading@10 77 * @param[out] pts output packet pts
yading@10 78 * @param[out] duration output packet duration
yading@10 79 */
yading@10 80 void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts,
yading@10 81 int *duration);
yading@10 82
yading@10 83 #endif /* AVCODEC_AUDIO_FRAME_QUEUE_H */