mkvwriter.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2012 The WebM project authors. All Rights Reserved.
  2. //
  3. // Use of this source code is governed by a BSD-style license
  4. // that can be found in the LICENSE file in the root of the source
  5. // tree. An additional intellectual property rights grant can be found
  6. // in the file PATENTS. All contributing project authors may
  7. // be found in the AUTHORS file in the root of the source tree.
  8. #ifndef MKVMUXER_MKVWRITER_H_
  9. #define MKVMUXER_MKVWRITER_H_
  10. #include <stdio.h>
  11. #include "mkvmuxer/mkvmuxer.h"
  12. #include "mkvmuxer/mkvmuxertypes.h"
  13. namespace mkvmuxer {
  14. // Default implementation of the IMkvWriter interface on Windows.
  15. class MkvWriter : public IMkvWriter {
  16. public:
  17. MkvWriter();
  18. explicit MkvWriter(FILE* fp);
  19. virtual ~MkvWriter();
  20. // IMkvWriter interface
  21. virtual int64 Position() const;
  22. virtual int32 Position(int64 position);
  23. virtual bool Seekable() const;
  24. virtual int32 Write(const void* buffer, uint32 length);
  25. virtual void ElementStartNotify(uint64 element_id, int64 position);
  26. // Creates and opens a file for writing. |filename| is the name of the file
  27. // to open. This function will overwrite the contents of |filename|. Returns
  28. // true on success.
  29. bool Open(const char* filename);
  30. // Closes an opened file.
  31. void Close();
  32. private:
  33. // File handle to output file.
  34. FILE* file_;
  35. bool writer_owns_file_;
  36. LIBWEBM_DISALLOW_COPY_AND_ASSIGN(MkvWriter);
  37. };
  38. } // namespace mkvmuxer
  39. #endif // MKVMUXER_MKVWRITER_H_