Anki/proto/anki/media.proto
shivraj1182 8e868559c9
feat(proto): extend AddMediaFile to accept file paths for streaming support
- Modify AddMediaFileRequest message to support both inline byte data and file path references
- Use oneof construct to ensure exactly one data source is provided (backward compatible)
- This enables memory-efficient streaming uploads for large media files on mobile clients
- Addresses issue #608: AnkiDroid OutOfMemoryError when adding large media files
2025-12-03 11:48:56 +05:30

48 lines
1.3 KiB
Protocol Buffer

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
syntax = "proto3";
option java_multiple_files = true;
package anki.media;
import "anki/generic.proto";
import "anki/notetypes.proto";
service MediaService {
rpc CheckMedia(generic.Empty) returns (CheckMediaResponse);
rpc AddMediaFile(AddMediaFileRequest) returns (generic.String);
rpc TrashMediaFiles(TrashMediaFilesRequest) returns (generic.Empty);
rpc EmptyTrash(generic.Empty) returns (generic.Empty);
rpc RestoreTrash(generic.Empty) returns (generic.Empty);
rpc ExtractStaticMediaFiles(notetypes.NotetypeId)
returns (generic.StringList);
}
// Implicitly includes any of the above methods that are not listed in the
// backend service.
service BackendMediaService {}
message CheckMediaResponse {
repeated string unused = 1;
repeated string missing = 2;
repeated int64 missing_media_notes = 3;
string report = 4;
bool have_trash = 5;
}
message TrashMediaFilesRequest {
repeated string fnames = 1;
}
// AddMediaFileRequest now supports both inline byte data and file path references.
// Using oneof ensures backward compatibility - exactly one must be provided.
message AddMediaFileRequest {
string desired_name = 1;
oneof data_source {
bytes data = 2;
string file_path = 3;
}
}