2012-04-18 15:32:53 -04:00
|
|
|
// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style license
|
|
|
|
// that can be found in the LICENSE file in the root of the source
|
|
|
|
// tree. An additional intellectual property rights grant can be found
|
|
|
|
// in the file PATENTS. All contributing project authors may
|
|
|
|
// be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
2016-03-21 11:20:48 -07:00
|
|
|
#ifndef MKVMUXER_MKVWRITER_H_
|
|
|
|
#define MKVMUXER_MKVWRITER_H_
|
2012-04-18 15:32:53 -04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-03-21 11:20:48 -07:00
|
|
|
#include "mkvmuxer/mkvmuxer.h"
|
|
|
|
#include "mkvmuxer/mkvmuxertypes.h"
|
2012-04-18 15:32:53 -04:00
|
|
|
|
|
|
|
namespace mkvmuxer {
|
|
|
|
|
|
|
|
// Default implementation of the IMkvWriter interface on Windows.
|
|
|
|
class MkvWriter : public IMkvWriter {
|
|
|
|
public:
|
|
|
|
MkvWriter();
|
2014-05-02 11:47:44 -07:00
|
|
|
explicit MkvWriter(FILE* fp);
|
2012-04-18 15:32:53 -04:00
|
|
|
virtual ~MkvWriter();
|
|
|
|
|
|
|
|
// IMkvWriter interface
|
2016-04-08 09:55:35 -07:00
|
|
|
virtual int64 Position() const;
|
|
|
|
virtual int32 Position(int64 position);
|
2012-04-18 15:32:53 -04:00
|
|
|
virtual bool Seekable() const;
|
2016-04-08 09:55:35 -07:00
|
|
|
virtual int32 Write(const void* buffer, uint32 length);
|
|
|
|
virtual void ElementStartNotify(uint64 element_id, int64 position);
|
2012-04-18 15:32:53 -04:00
|
|
|
|
|
|
|
// Creates and opens a file for writing. |filename| is the name of the file
|
|
|
|
// to open. This function will overwrite the contents of |filename|. Returns
|
|
|
|
// true on success.
|
|
|
|
bool Open(const char* filename);
|
|
|
|
|
|
|
|
// Closes an opened file.
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// File handle to output file.
|
|
|
|
FILE* file_;
|
2014-03-12 12:18:48 -07:00
|
|
|
bool writer_owns_file_;
|
2012-04-18 15:32:53 -04:00
|
|
|
|
|
|
|
LIBWEBM_DISALLOW_COPY_AND_ASSIGN(MkvWriter);
|
|
|
|
};
|
|
|
|
|
2016-03-18 09:32:52 -07:00
|
|
|
} // namespace mkvmuxer
|
2012-04-18 15:32:53 -04:00
|
|
|
|
2016-03-21 11:20:48 -07:00
|
|
|
#endif // MKVMUXER_MKVWRITER_H_
|