Merge "Add output of elements to separate files."
This commit is contained in:
64
mkvmuxer.hpp
64
mkvmuxer.hpp
@@ -16,6 +16,8 @@
|
||||
|
||||
namespace mkvmuxer {
|
||||
|
||||
class MkvWriter;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Interface used by the mkvmuxer to write out the Mkv data.
|
||||
class IMkvWriter {
|
||||
@@ -436,8 +438,10 @@ class Tracks {
|
||||
// Cluster element
|
||||
class Cluster {
|
||||
public:
|
||||
// |timecode| is the absolute timecode of the cluster.
|
||||
Cluster(uint64 timecode, IMkvWriter* writer);
|
||||
// |timecode| is the absolute timecode of the cluster. |cues_pos| is the
|
||||
// position for the cluster within the segment that should be written in
|
||||
// the cues element.
|
||||
Cluster(uint64 timecode, IMkvWriter* writer, int64 cues_pos);
|
||||
~Cluster();
|
||||
|
||||
// Adds a frame to be output in the file. The frame is written out through
|
||||
@@ -462,6 +466,9 @@ class Cluster {
|
||||
// cluster's size if |writer_| is seekable. Returns true on success.
|
||||
bool Finalize();
|
||||
|
||||
// Returns the size in bytes for the entire Cluster element.
|
||||
uint64 Size() const;
|
||||
|
||||
int32 blocks_added() const { return blocks_added_; }
|
||||
uint64 payload_size() const { return payload_size_; }
|
||||
int64 position_for_cues() const { return position_for_cues_; }
|
||||
@@ -653,6 +660,18 @@ class Segment {
|
||||
// Toggles whether to output a cues element.
|
||||
void OutputCues(bool output_cues);
|
||||
|
||||
// Sets if the muxer will output files in chunks or not. |chunking| is a
|
||||
// flag telling whether or not to turn on chunking. |filename| is the base
|
||||
// filename for the chunk files. The header chunk file will be named
|
||||
// |filename|.hdr and the data chunks will be named
|
||||
// |filename|_XXXXXX.chk. Chunking implies that the muxer will be writing
|
||||
// to files so the muxer will use the default MkvWriter class to control
|
||||
// what data is written to what files. Returns true on success.
|
||||
// TODO: Should we change the IMkvWriter Interface to add Open and Close?
|
||||
// That will force the interface to be dependent on files.
|
||||
bool SetChunking(bool chunking, const char* filename);
|
||||
|
||||
bool chunking() const { return chunking_; }
|
||||
uint64 cues_track() const { return cues_track_; }
|
||||
void set_max_cluster_duration(uint64 max_cluster_duration) {
|
||||
max_cluster_duration_ = max_cluster_duration;
|
||||
@@ -677,6 +696,16 @@ class Segment {
|
||||
// Cues elements.
|
||||
bool CheckHeaderInfo();
|
||||
|
||||
// Sets |name| according to how many chunks have been written. |ext| is the
|
||||
// file extension. |name| must be deleted by the calling app. Returns true
|
||||
// on success.
|
||||
bool UpdateChunkName(const char* ext, char** name) const;
|
||||
|
||||
// Returns the maximum offset within the segment's payload. When chunking
|
||||
// this function is needed to determine offsets of elements within the
|
||||
// chunked files. Returns -1 on error.
|
||||
int64 MaxOffset();
|
||||
|
||||
// Adds the frame to our frame array.
|
||||
bool QueueFrame(Frame* frame);
|
||||
|
||||
@@ -699,6 +728,31 @@ class Segment {
|
||||
SegmentInfo segment_info_;
|
||||
Tracks tracks_;
|
||||
|
||||
// Number of chunks written.
|
||||
int chunk_count_;
|
||||
|
||||
// Current chunk filename.
|
||||
char* chunk_name_;
|
||||
|
||||
// Default MkvWriter object created by this class used for writing clusters
|
||||
// out in separate files.
|
||||
MkvWriter* chunk_writer_cluster_;
|
||||
|
||||
// Default MkvWriter object created by this class used for writing Cues
|
||||
// element out to a file.
|
||||
MkvWriter* chunk_writer_cues_;
|
||||
|
||||
// Default MkvWriter object created by this class used for writing the
|
||||
// Matroska header out to a file.
|
||||
MkvWriter* chunk_writer_header_;
|
||||
|
||||
// Flag telling whether or not the muxer is chunking output to multiple
|
||||
// files.
|
||||
bool chunking_;
|
||||
|
||||
// Base filename for the chunked files.
|
||||
char* chunking_base_name_;
|
||||
|
||||
// List of clusters.
|
||||
Cluster** cluster_list_;
|
||||
|
||||
@@ -763,8 +817,10 @@ class Segment {
|
||||
// The file position of the element's size.
|
||||
int64 size_position_;
|
||||
|
||||
// Pointer to the writer object. Not owned by this class.
|
||||
IMkvWriter* writer_;
|
||||
// Pointer to the writer objects. Not owned by this class.
|
||||
IMkvWriter* writer_cluster_;
|
||||
IMkvWriter* writer_cues_;
|
||||
IMkvWriter* writer_header_;
|
||||
|
||||
LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Segment);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user