2012-04-18 21:32:53 +02: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.
|
|
|
|
|
|
|
|
#ifndef MKVWRITER_HPP
|
|
|
|
#define MKVWRITER_HPP
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mkvmuxer.hpp"
|
|
|
|
#include "mkvmuxertypes.hpp"
|
|
|
|
|
|
|
|
namespace mkvmuxer {
|
|
|
|
|
|
|
|
// Default implementation of the IMkvWriter interface on Windows.
|
|
|
|
class MkvWriter : public IMkvWriter {
|
|
|
|
public:
|
|
|
|
MkvWriter();
|
2014-05-02 20:47:44 +02:00
|
|
|
explicit MkvWriter(FILE* fp);
|
2012-04-18 21:32:53 +02:00
|
|
|
virtual ~MkvWriter();
|
|
|
|
|
|
|
|
// IMkvWriter interface
|
|
|
|
virtual int64 Position() const;
|
|
|
|
virtual int32 Position(int64 position);
|
|
|
|
virtual bool Seekable() const;
|
|
|
|
virtual int32 Write(const void* buffer, uint32 length);
|
|
|
|
virtual void ElementStartNotify(uint64 element_id, int64 position);
|
|
|
|
|
|
|
|
// 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 20:18:48 +01:00
|
|
|
bool writer_owns_file_;
|
2012-04-18 21:32:53 +02:00
|
|
|
|
|
|
|
LIBWEBM_DISALLOW_COPY_AND_ASSIGN(MkvWriter);
|
|
|
|
};
|
|
|
|
|
2014-04-14 19:30:33 +02:00
|
|
|
} // end namespace mkvmuxer
|
2012-04-18 21:32:53 +02:00
|
|
|
|
2014-04-14 19:30:33 +02:00
|
|
|
#endif // MKVWRITER_HPP
|