7 #ifndef MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_
8 #define MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_
10 #include <gtest/gtest.h>
12 #include "packager/media/base/media_sample.h"
13 #include "packager/media/base/muxer_options.h"
14 #include "packager/media/base/status.h"
15 #include "packager/media/base/stream_info.h"
16 #include "packager/media/base/test/status_test_util.h"
17 #include "packager/media/base/video_stream_info.h"
18 #include "packager/media/file/file_closer.h"
19 #include "packager/media/file/file_test_util.h"
20 #include "packager/media/file/memory_file.h"
21 #include "packager/media/formats/webm/mkv_writer.h"
22 #include "packager/media/formats/webm/segmenter.h"
23 #include "packager/media/formats/webm/webm_parser.h"
42 void SetUp()
override;
43 void TearDown()
override;
50 std::unique_ptr<webm::Segmenter>* result)
const {
51 std::unique_ptr<S> segmenter(
new S(options));
53 ASSERT_OK(segmenter->Initialize(info,
nullptr ,
55 *result = std::move(segmenter);
59 std::shared_ptr<MediaSample>
CreateSample(KeyFrameFlag key_frame_flag,
61 SideDataFlag side_data_flag);
81 void PopulateFromCluster(
const std::string& file_name);
82 void PopulateFromSegment(
const std::string& file_name);
84 size_t GetFrameCountForCluster(
size_t cluster_index)
const;
85 int64_t GetFrameTimecode(
size_t cluster_index,
size_t frame_index)
const;
87 size_t cluster_count()
const;
92 bool OnListEnd(
int id)
override;
93 bool OnUInt(
int id, int64_t val)
override;
94 bool OnFloat(
int id,
double val)
override;
95 bool OnBinary(
int id,
const uint8_t* data,
int size)
override;
96 bool OnString(
int id,
const std::string& str)
override;
99 int64_t cluster_timecode_ = -1;
101 std::vector<std::vector<int64_t>> frame_timecodes_;
102 bool in_cluster_ =
false;
106 void set_cur_timestamp(uint64_t timestamp) { cur_timestamp_ = timestamp; }
108 std::string output_file_name_;
109 std::string segment_template_;
110 uint64_t cur_timestamp_;
111 bool single_segment_;
117 #endif // MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_