mirror of
https://gitee.com/openharmony/multimedia_av_codec
synced 2024-11-27 00:50:36 +00:00
Modify to maintain synchronization
Signed-off-by: 陈钰晨 <chengyuchen8@huawei.com> Change-Id: Ifee7fe53d8d922fdc628c466d09a9ce8cf57d2d1
This commit is contained in:
parent
b7eff8f562
commit
98ae3b0f02
@ -44,11 +44,11 @@ public:
|
||||
int32_t StartReferenceParser(int64_t startTimeMs) override;
|
||||
int32_t GetFrameLayerInfo(std::shared_ptr<AVBuffer> videoSample, FrameLayerInfo &frameLayerInfo) override;
|
||||
int32_t GetGopLayerInfo(uint32_t gopId, GopLayerInfo &gopLayerInfo) override;
|
||||
|
||||
int32_t GetIndexByRelativePresentationTimeUs(const uint32_t trackIndex,
|
||||
const uint64_t relativePresentationTimeUs, uint32_t &index) override;
|
||||
int32_t GetRelativePresentationTimeUsByIndex(const uint32_t trackIndex,
|
||||
const uint32_t index, uint64_t &relativePresentationTimeUs) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<MediaDemuxer> demuxerEngine_ = nullptr;
|
||||
std::string sourceUri_;
|
||||
|
@ -85,8 +85,8 @@ static std::map<AVCodecID, std::string_view> g_codecIdToMime = {
|
||||
{AV_CODEC_ID_VP8, MimeType::VIDEO_VP8},
|
||||
{AV_CODEC_ID_VP9, MimeType::VIDEO_VP9},
|
||||
{AV_CODEC_ID_AVS3DA, MimeType::AUDIO_AVS3DA},
|
||||
{AV_CODEC_ID_PCM_MULAW, MimeType::AUDIO_G711MU},
|
||||
{AV_CODEC_ID_APE, MimeType::AUDIO_APE},
|
||||
{AV_CODEC_ID_PCM_MULAW, MimeType::AUDIO_G711MU},
|
||||
{AV_CODEC_ID_SUBRIP, MimeType::TEXT_SUBRIP},
|
||||
{AV_CODEC_ID_WEBVTT, MimeType::TEXT_WEBVTT},
|
||||
{AV_CODEC_ID_FFMETADATA, MimeType::TIMED_METADATA}
|
||||
@ -688,7 +688,7 @@ void FFmpegFormatHelper::ParseInfoFromMetadata(const AVDictionary* metadata, con
|
||||
parseFromMoov = true;
|
||||
}
|
||||
if (valPtr == nullptr) {
|
||||
MEDIA_LOG_D("Parse failed");
|
||||
MEDIA_LOG_D("Parse failed.");
|
||||
return;
|
||||
}
|
||||
if (parseFromMoov) {
|
||||
|
@ -2048,35 +2048,6 @@ HWTEST_F(AVSourceUnitTest, AVSource_GetFormat_4000, TestSize.Level1)
|
||||
ASSERT_EQ(formatVal_.album, "a");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AVSource_ValidateMimeType_1000
|
||||
* @tc.desc: validate MimeType when av_codec Type is mulaw
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AVSourceUnitTest, AVSource_ValidateMimeType_1000, TestSize.Level1)
|
||||
{
|
||||
fd_ = OpenFile(g_wavPath2);
|
||||
size_ = GetFileSize(g_wavPath2);
|
||||
printf("----%s----\n", g_wavPath2.c_str());
|
||||
source_ = AVSourceMockFactory::CreateSourceWithFD(fd_, SOURCE_OFFSET, size_);
|
||||
ASSERT_NE(source_, nullptr);
|
||||
format_ = source_->GetTrackFormat(trackIndex_);
|
||||
ASSERT_NE(format_, nullptr);
|
||||
printf("[trackFormat %d]: %s\n", trackIndex_, format_->DumpInfo());
|
||||
ASSERT_TRUE(format_->GetStringValue(MediaDescriptionKey::MD_KEY_CODEC_MIME, formatVal_.codecMime));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_TRACK_TYPE, formatVal_.trackType));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_SAMPLE_RATE, formatVal_.sampleRate));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_CHANNEL_COUNT, formatVal_.channelCount));
|
||||
ASSERT_TRUE(format_->GetLongValue(MediaDescriptionKey::MD_KEY_CHANNEL_LAYOUT, formatVal_.channelLayout));
|
||||
ASSERT_TRUE(format_->GetLongValue(MediaDescriptionKey::MD_KEY_BITRATE, formatVal_.bitRate));
|
||||
ASSERT_EQ(formatVal_.codecMime, "audio/g711mu");
|
||||
ASSERT_EQ(formatVal_.trackType, MediaType::MEDIA_TYPE_AUD);
|
||||
ASSERT_EQ(formatVal_.channelLayout, 3);
|
||||
ASSERT_EQ(formatVal_.sampleRate, 44100);
|
||||
ASSERT_EQ(formatVal_.channelCount, 2);
|
||||
ASSERT_EQ(formatVal_.bitRate, 705600);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AVSource_GetFormat_1601
|
||||
* @tc.desc: get format when the file is mp4 vvc
|
||||
@ -2124,4 +2095,33 @@ HWTEST_F(AVSourceUnitTest, AVSource_GetFormat_1601, TestSize.Level1)
|
||||
ASSERT_EQ(formatVal_.width, 640);
|
||||
ASSERT_EQ(formatVal_.height, 360);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AVSource_ValidateMimeType_1000
|
||||
* @tc.desc: validate MimeType when av_codec Type is mulaw
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AVSourceUnitTest, AVSource_ValidateMimeType_1000, TestSize.Level1)
|
||||
{
|
||||
fd_ = OpenFile(g_wavPath2);
|
||||
size_ = GetFileSize(g_wavPath2);
|
||||
printf("----%s----\n", g_wavPath2.c_str());
|
||||
source_ = AVSourceMockFactory::CreateSourceWithFD(fd_, SOURCE_OFFSET, size_);
|
||||
ASSERT_NE(source_, nullptr);
|
||||
format_ = source_->GetTrackFormat(trackIndex_);
|
||||
ASSERT_NE(format_, nullptr);
|
||||
printf("[trackFormat %d]: %s\n", trackIndex_, format_->DumpInfo());
|
||||
ASSERT_TRUE(format_->GetStringValue(MediaDescriptionKey::MD_KEY_CODEC_MIME, formatVal_.codecMime));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_TRACK_TYPE, formatVal_.trackType));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_SAMPLE_RATE, formatVal_.sampleRate));
|
||||
ASSERT_TRUE(format_->GetIntValue(MediaDescriptionKey::MD_KEY_CHANNEL_COUNT, formatVal_.channelCount));
|
||||
ASSERT_TRUE(format_->GetLongValue(MediaDescriptionKey::MD_KEY_CHANNEL_LAYOUT, formatVal_.channelLayout));
|
||||
ASSERT_TRUE(format_->GetLongValue(MediaDescriptionKey::MD_KEY_BITRATE, formatVal_.bitRate));
|
||||
ASSERT_EQ(formatVal_.codecMime, "audio/g711mu");
|
||||
ASSERT_EQ(formatVal_.trackType, MediaType::MEDIA_TYPE_AUD);
|
||||
ASSERT_EQ(formatVal_.channelLayout, 3);
|
||||
ASSERT_EQ(formatVal_.sampleRate, 44100);
|
||||
ASSERT_EQ(formatVal_.channelCount, 2);
|
||||
ASSERT_EQ(formatVal_.bitRate, 705600);
|
||||
}
|
||||
} // namespace
|
@ -33,6 +33,7 @@ public:
|
||||
int32_t ReadSample(uint32_t trackIndex, std::shared_ptr<AVMemoryMock> sample,
|
||||
AVCodecBufferInfo *bufferInfo, uint32_t &flag, bool checkBufferInfo) override;
|
||||
int32_t SeekToTime(int64_t mSeconds, SeekMode mode) override;
|
||||
|
||||
int32_t GetIndexByRelativePresentationTimeUs(const uint32_t trackIndex,
|
||||
const uint64_t relativePresentationTimeUs, uint32_t &index) override;
|
||||
int32_t GetRelativePresentationTimeUsByIndex(const uint32_t trackIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user