kodi
DVDAudioCodecFFmpeg.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "DVDAudioCodec.h"
12 
13 extern "C" {
14 #include <libavcodec/avcodec.h>
15 #include <libavformat/avformat.h>
16 #include <libavutil/avutil.h>
17 #include <libavutil/channel_layout.h>
18 #include <libswresample/swresample.h>
19 #include <libavutil/downmix_info.h>
20 }
21 
22 class CProcessInfo;
23 
25 {
26 public:
27  explicit CDVDAudioCodecFFmpeg(CProcessInfo &processInfo);
28  ~CDVDAudioCodecFFmpeg() override;
29  bool Open(CDVDStreamInfo &hints,
30  CDVDCodecOptions &options) override;
31  void Dispose() override;
32  bool AddData(const DemuxPacket &packet) override;
33  void GetData(DVDAudioFrame &frame) override;
34  void Reset() override;
35  AEAudioFormat GetFormat() override { return m_format; }
36  std::string GetName() override { return m_codecName; }
37  enum AVMatrixEncoding GetMatrixEncoding() override;
38  enum AVAudioServiceType GetAudioServiceType() override;
39  int GetProfile() override;
40 
41 protected:
42  int GetData(uint8_t** dst);
43  enum AEDataFormat GetDataFormat();
44  int GetSampleRate();
45  int GetChannels();
46  CAEChannelInfo GetChannelMap();
47  int GetBitRate() override;
48  void BuildChannelMap();
49 
50  AEAudioFormat m_format;
51  AVCodecContext* m_pCodecContext;
52  enum AVSampleFormat m_iSampleFormat = AV_SAMPLE_FMT_NONE;
53  CAEChannelInfo m_channelLayout;
54  enum AVMatrixEncoding m_matrixEncoding = AV_MATRIX_ENCODING_NONE;
55  AVFrame* m_pFrame;
56  AVDownmixInfo m_downmixInfo;
57  bool m_hasDownmix = false;
58  bool m_eof;
59  int m_channels;
60  uint64_t m_layout;
61  std::string m_codecName;
62  uint64_t m_hint_layout;
63 };
64 
Definition: DVDStreamInfo.h:25
Definition: DVDCodecs.h:23
Definition: DVDAudioCodecFFmpeg.h:24
bool AddData(const DemuxPacket &packet) override
Definition: DVDAudioCodecFFmpeg.cpp:154
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
Definition: ProcessInfo.h:26
Definition: DVDAudioCodec.h:27
Definition: AEChannelInfo.h:19
Definition: DemuxPacket.h:22
Definition: DVDAudioCodec.h:48