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