FFmpeg
libavcodec
opus
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
31
typedef
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 */
45
}
OpusPacket
;
46
47
// a mapping between an opus stream and an output channel
48
typedef
struct
ChannelMap
{
49
int
stream_idx
;
50
int
channel_idx
;
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
57
int
copy_idx
;
58
59
// this channel is silent
60
int
silence
;
61
}
ChannelMap
;
62
63
typedef
struct
OpusParseContext
{
64
int
nb_streams
;
65
int
nb_stereo_streams
;
66
67
int16_t
gain_i
;
68
69
ChannelMap
*
channel_maps
;
70
}
OpusParseContext
;
71
72
int
ff_opus_parse_packet
(
OpusPacket
*
pkt
,
const
uint8_t *buf,
int
buf_size,
73
int
self_delimited);
74
75
int
ff_opus_parse_extradata
(
AVCodecContext
*avctx,
OpusParseContext
*
s
);
76
77
#endif
/* AVCODEC_OPUS_PARSE_H */
OpusPacket::bandwidth
enum OpusBandwidth bandwidth
bandwidth
Definition:
parse.h:44
OpusPacket::code
int code
packet code: specifies the frame layout
Definition:
parse.h:34
OpusMode
OpusMode
Definition:
opus.h:41
OpusPacket::frame_offset
int frame_offset[OPUS_MAX_FRAMES]
frame offsets
Definition:
parse.h:40
opus.h
OpusPacket::vbr
int vbr
vbr flag
Definition:
parse.h:36
ChannelMap::copy
int copy
Definition:
parse.h:55
OpusParseContext::nb_stereo_streams
int nb_stereo_streams
Definition:
parse.h:65
OpusPacket::frame_size
int frame_size[OPUS_MAX_FRAMES]
frame sizes
Definition:
parse.h:41
pkt
AVPacket * pkt
Definition:
movenc.c:60
s
#define s(width, name)
Definition:
cbs_vp9.c:198
OpusPacket::frame_duration
int frame_duration
frame duration, in samples @ 48kHz
Definition:
parse.h:42
OpusParseContext::channel_maps
ChannelMap * channel_maps
Definition:
parse.h:69
OpusParseContext::nb_streams
int nb_streams
Definition:
parse.h:64
OpusParseContext
Definition:
parse.h:63
ff_opus_parse_packet
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:95
OpusPacket::data_size
int data_size
size of the useful data – packet size - padding
Definition:
parse.h:33
ChannelMap::silence
int silence
Definition:
parse.h:60
OPUS_MAX_FRAMES
#define OPUS_MAX_FRAMES
Definition:
opus.h:29
avcodec.h
OpusPacket::mode
enum OpusMode mode
mode
Definition:
parse.h:43
AVCodecContext
main external API structure.
Definition:
avcodec.h:451
OpusParseContext::gain_i
int16_t gain_i
Definition:
parse.h:67
OpusPacket::config
int config
configuration: tells the audio mode, bandwidth, and frame duration
Definition:
parse.h:37
OpusPacket
Definition:
parse.h:31
ChannelMap
Definition:
parse.h:48
ChannelMap::stream_idx
int stream_idx
Definition:
parse.h:49
ChannelMap::copy_idx
int copy_idx
Definition:
parse.h:57
ChannelMap::channel_idx
int channel_idx
Definition:
parse.h:50
OpusPacket::stereo
int stereo
whether this packet is mono or stereo
Definition:
parse.h:35
ff_opus_parse_extradata
int ff_opus_parse_extradata(AVCodecContext *avctx, OpusParseContext *s)
Definition:
parse.c:296
OpusPacket::packet_size
int packet_size
packet size
Definition:
parse.h:32
OpusBandwidth
OpusBandwidth
Definition:
opus.h:49
OpusPacket::frame_count
int frame_count
frame count
Definition:
parse.h:39
Generated on Thu Dec 26 2024 19:21:43 for FFmpeg by
1.8.17