PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodec.h

http://github.com/xbmc/xbmc
C++ Header | 121 lines | 33 code | 22 blank | 66 comment | 1 complexity | ff23646e5fa34286ee2f726bf4e4488a MD5 | raw file
  1#pragma once
  2
  3/*
  4 *      Copyright (C) 2005-2013 Team XBMC
  5 *      http://xbmc.org
  6 *
  7 *  This Program is free software; you can redistribute it and/or modify
  8 *  it under the terms of the GNU General Public License as published by
  9 *  the Free Software Foundation; either version 2, or (at your option)
 10 *  any later version.
 11 *
 12 *  This Program 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
 15 *  GNU General Public License for more details.
 16 *
 17 *  You should have received a copy of the GNU General Public License
 18 *  along with XBMC; see the file COPYING.  If not, see
 19 *  <http://www.gnu.org/licenses/>.
 20 *
 21 */
 22
 23#include "system.h"
 24#include "cores/AudioEngine/Utils/AEAudioFormat.h"
 25
 26#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
 27  #include "config.h"
 28#endif
 29#include <vector>
 30#include "DllAvCodec.h"
 31
 32struct AVStream;
 33
 34class CDVDStreamInfo;
 35class CDVDCodecOption;
 36class CDVDCodecOptions;
 37
 38class CDVDAudioCodec
 39{
 40public:
 41
 42  CDVDAudioCodec() {}
 43  virtual ~CDVDAudioCodec() {}
 44
 45  /*
 46   * Open the decoder, returns true on success
 47   */
 48  virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) = 0;
 49
 50  /*
 51   * Dispose, Free all resources
 52   */
 53  virtual void Dispose() = 0;
 54
 55  /*
 56   * returns bytes used or -1 on error
 57   *
 58   */
 59  virtual int Decode(uint8_t* pData, int iSize) = 0;
 60
 61  /*
 62   * returns nr of bytes used or -1 on error
 63   * the data is valid until the next Decode call
 64   */
 65  virtual int GetData(uint8_t** dst) = 0;
 66
 67  /*
 68   * resets the decoder
 69   */
 70  virtual void Reset() = 0;
 71
 72  /*
 73   * returns the nr of channels for the decoded audio stream
 74   */
 75  virtual int GetChannels() = 0;
 76
 77  /*
 78   * returns the nr of channels for the encoded audio stream
 79   */
 80  virtual int GetEncodedChannels() { return 0; }
 81
 82  /*
 83   * returns the channel mapping
 84   */
 85  virtual CAEChannelInfo GetChannelMap() = 0;
 86
 87  /*
 88   * returns the samplerate for the decoded audio stream
 89   */
 90  virtual int GetSampleRate() = 0;
 91
 92  /*
 93   * returns the samplerate for the encoded audio stream
 94   */
 95  virtual int GetEncodedSampleRate() { return 0; } 
 96
 97  /*
 98   * returns the data format for the decoded audio stream (eg AE_FMT_S16LE)
 99   */
100  virtual enum AEDataFormat GetDataFormat() = 0;
101
102  /*
103   * should return the average input bit rate 
104   */
105  virtual int GetBitRate() { return 0; }
106
107  /*
108   * returns if the codec requests to use passtrough
109   */
110  virtual bool NeedPassthrough() { return false; }
111
112  /*
113   * should return codecs name
114   */
115  virtual const char* GetName() = 0;
116
117  /*
118   * should return amount of data decoded has buffered in preparation for next audio frame
119   */
120  virtual int GetBufferSize() { return 0; }
121};