FFmpeg
Loading...
Searching...
No Matches
dolby_e_parser.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 foo86
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
22#include "avcodec.h"
23#include "dolby_e.h"
24#include "parser_internal.h"
25
29
31 const uint8_t **poutbuf, int *poutbuf_size,
32 const uint8_t *buf, int buf_size)
33{
34 DBEParseContext *s1 = s2->priv_data;
35 DBEContext *s = &s1->dectx;
36 int ret;
37
38 if ((ret = ff_dolby_e_parse_header(s, buf, buf_size)) < 0)
39 goto end;
40
42 switch (s->metadata.nb_channels) {
43 case 4:
45 break;
46 case 6:
48 break;
49 case 8:
51 break;
52 default:
54 avctx->ch_layout.nb_channels = s->metadata.nb_channels;
55 break;
56 }
57
58 avctx->sample_rate = s->metadata.sample_rate;
60
61end:
62 /* always return the full packet. this parser isn't doing any splitting or
63 combining, only packet analysis */
64 *poutbuf = buf;
65 *poutbuf_size = buf_size;
66 return buf_size;
67}
68
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition apv_parser.c:92
Libavcodec external API header.
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define FRAME_SAMPLES
Definition dolby_e.h:27
int ff_dolby_e_parse_header(DBEContext *s, const uint8_t *buf, int buf_size)
Initialize DBEContext and parse Dolby E metadata.
static int dolby_e_parse(AVCodecParserContext *s2, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
const FFCodecParser ff_dolby_e_parser
@ AV_CODEC_ID_DOLBY_E
Definition codec_id.h:537
#define AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
#define PARSER_CODEC_LIST(...)
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
main external API structure.
Definition avcodec.h:443
AVChannelLayout ch_layout
Audio channel layout.
Definition avcodec.h:1055
enum AVSampleFormat sample_fmt
audio sample format
Definition avcodec.h:1047
int sample_rate
samples per second
Definition avcodec.h:1040
int duration
Duration of the current frame.
Definition avcodec.h:2731
Dolby E reading context used by decoder and parser.
Definition dolby_e.h:72