sndio_sink.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2009 Jacob Meuser <jakemsr@sdf.lonestar.org>
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _AKODE_SNDIO_SINK_H
  17. #define _AKODE_SNDIO_SINK_H
  18. #include "sink.h"
  19. #include "akode_export.h"
  20. namespace aKode {
  21. class AudioConfiguration;
  22. class AudioFrame;
  23. class SndioSink : public Sink {
  24. public:
  25. SndioSink();
  26. ~SndioSink();
  27. bool open();
  28. void close();
  29. int setAudioConfiguration(const AudioConfiguration *config);
  30. const AudioConfiguration* audioConfiguration() const;
  31. bool writeFrame(AudioFrame *frame);
  32. struct private_data;
  33. private:
  34. template<class T> void _writeFrame(AudioFrame *frame);
  35. private_data *d;
  36. };
  37. class SndioSinkPlugin : public SinkPlugin {
  38. public:
  39. virtual SndioSink* openSink() {
  40. return new SndioSink();
  41. }
  42. };
  43. extern "C" AKODE_EXPORT SndioSinkPlugin sndio_sink;
  44. } // namespace
  45. #endif