• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 #ifndef MKVMUXER_MKVWRITER_H_
10 #define MKVMUXER_MKVWRITER_H_
11 
12 #include <stdio.h>
13 
14 #include "mkvmuxer/mkvmuxer.h"
15 #include "mkvmuxer/mkvmuxertypes.h"
16 
17 namespace mkvmuxer {
18 
19 // Default implementation of the IMkvWriter interface on Windows.
20 class MkvWriter : public IMkvWriter {
21  public:
22   MkvWriter();
23   explicit MkvWriter(FILE* fp);
24   virtual ~MkvWriter();
25 
26   // IMkvWriter interface
27   virtual int64 Position() const;
28   virtual int32 Position(int64 position);
29   virtual bool Seekable() const;
30   virtual int32 Write(const void* buffer, uint32 length);
31   virtual void ElementStartNotify(uint64 element_id, int64 position);
32 
33   // Creates and opens a file for writing. |filename| is the name of the file
34   // to open. This function will overwrite the contents of |filename|. Returns
35   // true on success.
36   bool Open(const char* filename);
37 
38   // Closes an opened file.
39   void Close();
40 
41  private:
42   // File handle to output file.
43   FILE* file_;
44   bool writer_owns_file_;
45 
46   LIBWEBM_DISALLOW_COPY_AND_ASSIGN(MkvWriter);
47 };
48 
49 }  // namespace mkvmuxer
50 
51 #endif  // MKVMUXER_MKVWRITER_H_
52