file_output.cpp 706 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * This file is part of the FreeStreamer project,
  3. * (C)Copyright 2011-2018 Matias Muhonen <mmu@iki.fi> 穆马帝
  4. * See the file ''LICENSE'' for using the code.
  5. *
  6. * https://github.com/muhku/FreeStreamer
  7. */
  8. #include "file_output.h"
  9. namespace astreamer {
  10. File_Output::File_Output(CFURLRef fileURL) :
  11. m_writeStream(CFWriteStreamCreateWithFile(kCFAllocatorDefault, fileURL))
  12. {
  13. CFWriteStreamOpen(m_writeStream);
  14. }
  15. File_Output::~File_Output()
  16. {
  17. CFWriteStreamClose(m_writeStream);
  18. CFRelease(m_writeStream);
  19. }
  20. CFIndex File_Output::write(const UInt8 *buffer, CFIndex bufferLength)
  21. {
  22. return CFWriteStreamWrite(m_writeStream, buffer, bufferLength);
  23. }
  24. } // namespace astreamer