Make AddCuePoint function public.

Change-Id: I08df2b604185d6ae1d63eb360e68e84efa2cebfa
This commit is contained in:
Frank Galligan 2012-09-21 16:21:03 -07:00
parent 9ec562f72d
commit 21a2bd14c7
2 changed files with 28 additions and 28 deletions

View File

@ -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;

View File

@ -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.