FFmpeg
Loading...
Searching...
No Matches
parse.h
Go to the documentation of this file.
1/*
2 * Opus decoder/parser common functions and structures
3 * Copyright (c) 2012 Andrew D'Addesio
4 * Copyright (c) 2013-2014 Mozilla Corporation
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_OPUS_PARSE_H
24#define AVCODEC_OPUS_PARSE_H
25
26#include <stdint.h>
27
28#include "libavcodec/avcodec.h"
29#include "opus.h"
30
31typedef struct OpusPacket {
32 int packet_size; /**< packet size */
33 int data_size; /**< size of the useful data -- packet size - padding */
34 int code; /**< packet code: specifies the frame layout */
35 int stereo; /**< whether this packet is mono or stereo */
36 int vbr; /**< vbr flag */
37 int config; /**< configuration: tells the audio mode,
38 ** bandwidth, and frame duration */
39 int frame_count; /**< frame count */
40 int frame_offset[OPUS_MAX_FRAMES]; /**< frame offsets */
41 int frame_size[OPUS_MAX_FRAMES]; /**< frame sizes */
42 int frame_duration; /**< frame duration, in samples @ 48kHz */
43 enum OpusMode mode; /**< mode */
44 enum OpusBandwidth bandwidth; /**< bandwidth */
46
47// a mapping between an opus stream and an output channel
48typedef struct ChannelMap {
51
52 // when a single decoded channel is mapped to multiple output channels, we
53 // write to the first output directly and copy from it to the others
54 // this field is set to 1 for those copied output channels
55 int copy;
56 // this is the index of the output channel to copy from
58
59 // this channel is silent
62
71
72int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
73 int self_delimited);
74
76
77#endif /* AVCODEC_OPUS_PARSE_H */
Libavcodec external API header.
#define s(width, name)
Definition cbs_vp9.c:198
static AVPacket * pkt
int ff_opus_parse_extradata(AVCodecContext *avctx, OpusParseContext *s)
Definition parse.c:286
int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, int self_delimited)
Parse Opus packet info from raw packet data.
Definition parse.c:85
OpusBandwidth
Definition opus.h:49
OpusMode
Definition opus.h:41
#define OPUS_MAX_FRAMES
Definition opus.h:29
main external API structure.
Definition avcodec.h:443
int copy_idx
Definition parse.h:57
int copy
Definition parse.h:55
int channel_idx
Definition parse.h:50
int silence
Definition parse.h:60
int stream_idx
Definition parse.h:49
int stereo
whether this packet is mono or stereo
Definition parse.h:35
int frame_size[OPUS_MAX_FRAMES]
frame sizes
Definition parse.h:41
int frame_count
frame count
Definition parse.h:39
int frame_duration
frame duration, in samples @ 48kHz
Definition parse.h:42
int code
packet code: specifies the frame layout
Definition parse.h:34
int data_size
size of the useful data – packet size - padding
Definition parse.h:33
int vbr
vbr flag
Definition parse.h:36
int frame_offset[OPUS_MAX_FRAMES]
frame offsets
Definition parse.h:40
enum OpusMode mode
mode
Definition parse.h:43
enum OpusBandwidth bandwidth
bandwidth
Definition parse.h:44
int packet_size
packet size
Definition parse.h:32
int config
configuration: tells the audio mode, bandwidth, and frame duration
Definition parse.h:37
int nb_stereo_streams
Definition parse.h:65
int16_t gain_i
Definition parse.h:67
ChannelMap * channel_maps
Definition parse.h:69