From 21a2bd14c7d6961c24c448b1d8f04bc70fabe718 Mon Sep 17 00:00:00 2001 From: Frank Galligan Date: Fri, 21 Sep 2012 16:21:03 -0700 Subject: [PATCH] Make AddCuePoint function public. Change-Id: I08df2b604185d6ae1d63eb360e68e84efa2cebfa --- mkvmuxer.cpp | 46 +++++++++++++++++++++++----------------------- mkvmuxer.hpp | 10 +++++----- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mkvmuxer.cpp b/mkvmuxer.cpp index 55471d5..a33323e 100644 --- a/mkvmuxer.cpp +++ b/mkvmuxer.cpp @@ -1600,6 +1600,29 @@ uint64 Segment::AddVideoTrack(int32 width, int32 height, int32 number) { return vid_track->number(); } +bool Segment::AddCuePoint(uint64 timestamp, uint64 track) { + if (cluster_list_size_ < 1) + return false; + + const Cluster* const cluster = cluster_list_[cluster_list_size_-1]; + if (!cluster) + return false; + + CuePoint* const cue = new (std::nothrow) CuePoint(); // NOLINT + if (!cue) + return false; + + cue->set_time(timestamp / segment_info_.timecode_scale()); + cue->set_block_number(cluster->blocks_added() + 1); + cue->set_cluster_pos(cluster->position_for_cues()); + cue->set_track(track); + if (!cues_.AddCue(cue)) + return false; + + new_cuepoint_ = false; + return true; +} + uint64 Segment::AddAudioTrack(int32 sample_rate, int32 channels, int32 number) { @@ -2046,29 +2069,6 @@ bool Segment::CheckHeaderInfo() { return true; } -bool Segment::AddCuePoint(uint64 timestamp, uint64 track) { - if (cluster_list_size_ < 1) - return false; - - const Cluster* const cluster = cluster_list_[cluster_list_size_-1]; - if (!cluster) - return false; - - CuePoint* const cue = new (std::nothrow) CuePoint(); // NOLINT - if (!cue) - return false; - - cue->set_time(timestamp / segment_info_.timecode_scale()); - cue->set_block_number(cluster->blocks_added() + 1); - cue->set_cluster_pos(cluster->position_for_cues()); - cue->set_track(track); - if (!cues_.AddCue(cue)) - return false; - - new_cuepoint_ = false; - return true; -} - bool Segment::UpdateChunkName(const char* ext, char** name) const { if (!name || !ext) return false; diff --git a/mkvmuxer.hpp b/mkvmuxer.hpp index 1552502..cdf1217 100644 --- a/mkvmuxer.hpp +++ b/mkvmuxer.hpp @@ -674,6 +674,11 @@ class Segment { // the track number. uint64 AddAudioTrack(int32 sample_rate, int32 channels, int32 number); + // Adds a cue point to the Cues element. |timestamp| is the time in + // nanoseconds of the cue's time. |track| is the Track of the Cue. Returns + // true on success. + bool AddCuePoint(uint64 timestamp, uint64 track); + // Adds a frame to be output in the file. Returns true on success. // Inputs: // frame: Pointer to the data @@ -744,11 +749,6 @@ class Segment { const SegmentInfo* segment_info() const { return &segment_info_; } private: - // Adds a cue point to the Cues element. |timestamp| is the time in - // nanoseconds of the cue's time. |track| is the Track of the Cue. Returns - // true on success. - bool AddCuePoint(uint64 timestamp, uint64 track); - // Checks if header information has been output and initialized. If not it // will output the Segment element and initialize the SeekHead elment and // Cues elements.