1 /*
2 * PCM common functions
3 * Copyright (c) 2003 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
26
27 #define RAW_SAMPLES 1024
28
30 {
33
36
37 /*
38 * Compute read size to complete a read every 62ms.
39 * Clamp to RAW_SAMPLES if larger.
40 */
43
45
48
49 return ret;
50 }
51
53 int stream_index, int64_t timestamp,
int flags)
54 {
56 int block_align, byte_rate;
57 int64_t pos, ret;
58
60
65
66 if (block_align <= 0 || byte_rate <= 0)
67 return -1;
68 if (timestamp < 0) timestamp = 0;
69
70 /* compute the position by aligning it to block_align */
75 pos *= block_align;
76
77 /* recompute exact position */
80 return ret;
81 return 0;
82 }
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
This struct describes the properties of an encoded stream.
AVStream ** streams
A list of all streams in the file.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int flags
A combination of AV_PKT_FLAG values.
int block_align
Audio only.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
AVIOContext * pb
I/O context.
int sample_rate
Audio only.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.