#include "media/filters/audio_video_metadata_extractor.h"
#include <memory>
#include "base/hash/sha1.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "media/base/test_data_util.h"
#include "media/filters/file_data_source.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
std::unique_ptr<AudioVideoMetadataExtractor> GetExtractor(
const std::string& filename,
bool extract_attached_images,
bool expected_result,
double expected_duration,
int expected_width,
int expected_height) { … }
const std::string GetTagValue(
const media::AudioVideoMetadataExtractor::TagDictionary& tags,
const char* tag_name) { … }
const std::string TagsToString(
const media::AudioVideoMetadataExtractor::TagDictionary& tags) { … }
TEST(AudioVideoMetadataExtractorTest, InvalidFile) { … }
TEST(AudioVideoMetadataExtractorTest, AudioOGG) { … }
TEST(AudioVideoMetadataExtractorTest, AudioWAV) { … }
TEST(AudioVideoMetadataExtractorTest, AudioFLAC) { … }
TEST(AudioVideoMetadataExtractorTest, VideoWebM) { … }
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
TEST(AudioVideoMetadataExtractorTest, AndroidRotatedMP4Video) {
std::unique_ptr<AudioVideoMetadataExtractor> extractor =
GetExtractor("90rotation.mp4", true, true, 0.196056, 1920, 1080);
EXPECT_EQ(90, extractor->rotation());
EXPECT_EQ(3u, extractor->stream_infos().size());
EXPECT_EQ("mov,mp4,m4a,3gp,3g2,mj2", extractor->stream_infos()[0].type);
EXPECT_EQ(4u, extractor->stream_infos()[0].tags.size());
EXPECT_EQ("isom3gp4", GetTagValue(extractor->stream_infos()[0].tags,
"compatible_brands"));
EXPECT_EQ("2014-02-11T00:39:25.000000Z",
GetTagValue(extractor->stream_infos()[0].tags, "creation_time"));
EXPECT_EQ("isom",
GetTagValue(extractor->stream_infos()[0].tags, "major_brand"));
EXPECT_EQ("0",
GetTagValue(extractor->stream_infos()[0].tags, "minor_version"));
EXPECT_EQ("h264", extractor->stream_infos()[1].type);
EXPECT_EQ(6u, extractor->stream_infos()[1].tags.size())
<< "Tags: " << TagsToString(extractor->stream_infos()[1].tags);
EXPECT_EQ("2014-02-11T00:39:25.000000Z",
GetTagValue(extractor->stream_infos()[1].tags, "creation_time"));
EXPECT_EQ("VideoHandle",
GetTagValue(extractor->stream_infos()[1].tags, "handler_name"));
EXPECT_EQ("MOTO", GetTagValue(extractor->stream_infos()[1].tags, "encoder"));
EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[1].tags, "language"));
EXPECT_EQ("90", GetTagValue(extractor->stream_infos()[1].tags, "rotate"));
EXPECT_EQ("aac", extractor->stream_infos()[2].type);
EXPECT_EQ(4u, extractor->stream_infos()[2].tags.size())
<< "Tags: " << TagsToString(extractor->stream_infos()[2].tags);
EXPECT_EQ("2014-02-11T00:39:25.000000Z",
GetTagValue(extractor->stream_infos()[2].tags, "creation_time"));
EXPECT_EQ("SoundHandle",
GetTagValue(extractor->stream_infos()[2].tags, "handler_name"));
EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[2].tags, "language"));
EXPECT_EQ(0u, extractor->attached_images_bytes().size());
}
#endif
TEST(AudioVideoMetadataExtractorTest, AudioMP3) { … }
TEST(AudioVideoMetadataExtractorTest, AudioFLACInMp4) { … }
}