Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ protobuf_generate(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../samples/android/external/install_arm64-v8a/include
PROTOS
plugins/honor_live_photo/honor_live_photo_metadata.proto
plugins/legacy_micro_video/legacy_micro_video_metadata.proto
motion_photo/proto/metadata_collection.proto
motion_photo/proto/motion_photo_metadata.proto
Expand Down Expand Up @@ -203,6 +204,7 @@ if (NOT ANDROID)
# Tests
add_executable(motion_photo_tests
motion_photo/tests/test_main.cc
plugins/honor_live_photo/honor_live_photo_provider_test.cc
plugins/legacy_micro_video/legacy_micro_video_provider_test.cc
motion_photo/tests/motion_photo_builder_test.cc
motion_photo/tests/motion_photo_checker_test.cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ class JpegContainerSplitter : public ContainerSplitter,
block.format_identifier = "container.trailer";
block.offset = trailer_start;
block.total_payload_size = trailer_length;
// Copy only header bytes needed for format verification (e.g. ftyp, moov)
// to avoid allocating/copying large video payloads (up to 120 MB) into
// RAM.
size_t bytes_to_copy = std::min<size_t>(trailer_length, 64);
if (CopyFromDataSource(data_source, trailer_start, bytes_to_copy,
if (CopyFromDataSource(data_source, trailer_start, trailer_length,
&block.bytes)) {
blocks_.push_back(std::move(block));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <vector>

#include "motion_photo/metadata_provider.h"
#include "plugins/honor_live_photo/honor_live_photo_provider.h"
#include "plugins/legacy_micro_video/legacy_micro_video_provider.h"

namespace libmotionphoto {
Expand All @@ -46,6 +47,7 @@ std::vector<std::shared_ptr<IMetadataProvider>>&
MetadataProviderRegistry::Registry() {
static auto* registry =
new std::vector<std::shared_ptr<IMetadataProvider>>{
std::make_shared<HonorLivePhotoProvider>(),
std::make_shared<LegacyMicroVideoProvider>(),
};
return *registry;
Expand Down
49 changes: 49 additions & 0 deletions lib/core/plugins/honor_live_photo/honor_live_photo_metadata.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package libmotionphoto.motion_photo;

option java_multiple_files = true;
option java_package = "com.google.libmotionphoto.motionphoto.proto";
option optimize_for = LITE_RUNTIME;

// Metadata for Honor / Huawei Moving Picture ("HiHonor_*", "LivePhoto_*",
// and "LIVE_<size>" trailer formats).
message HonorLivePhotoMetadata {
// Trailer format variant ("hihonor_tlv", "livephoto_tlv", or "live_footer").
string format_variant = 1;

// True if an embedded MP4 video stream was found in the trailer.
bool has_embedded_video = 2;

// Byte offset of the embedded MP4 stream relative to the start of the
// trailer block.
uint64 video_offset = 3;

// Byte length of the embedded MP4 stream.
uint64 video_length = 4;

// Camera sceneMode parsed from HiHonor_OfflineData JSON (e.g., 73 for
// Moving Photo mode), or 0 if absent.
int32 scene_mode = 5;

// Presentation / cover frame timestamp in microseconds, if present.
int64 primary_image_timestamp_us = 6;

// Backward-linked 20-byte TLV tags discovered in the trailer (ordered from
// EOF backward).
repeated string tlv_tags = 7;
}
Loading
Loading