Files
lms/lms-api/proto/media.proto
T

138 lines
3.0 KiB
Protocol Buffer

/*
* Copyright (C) 2013 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
package LmsAPI;
message MediaRequest
{
message Prepare
{
enum AudioCodecType
{
AudioCodecTypeOGA = 1;
}
enum AudioBitrate {
AudioBitrate_32_kbps = 1;
AudioBitrate_64_kbps = 2;
AudioBitrate_96_kbps = 3;
AudioBitrate_128_kbps = 4;
AudioBitrate_192_kbps = 5;
AudioBitrate_256_kbps = 6;
}
enum VideoCodecType
{
VideoCodecTypeOGV = 1;
}
enum VideoBitrate {
VideoBitrate_512_kbps = 1;
}
message Audio
{
required int64 track_id = 1; // Id if the media
required AudioCodecType codec_type = 2;
required AudioBitrate bitrate = 3;
optional uint32 stream_idx = 4;
optional uint32 offset_secs = 5;
}
message Video
{
required int64 video_id = 1; // Id if the media
required VideoCodecType codec_type = 2;
required AudioBitrate audio_bitrate = 3;
required VideoBitrate video_bitrate = 4;
optional uint32 offset_secs = 5;
optional uint32 audio_stream_idx = 6;
optional uint32 video_stream_idx = 7;
optional uint32 subtitle_stream_idx = 8;
}
enum Type {
AudioRequest = 1;
VideoRequest = 2;
}
required Type type = 1;
optional Audio audio = 2;
optional Video video = 3;
}
message GetPart
{
required uint32 handle = 1; // handle that uniquely identify the media. Get using the Prepare request
required uint32 requested_data_size = 2; // Amount of data requested. May receive more or less. May receive 0 byte if complete
}
message Terminate
{
required uint32 handle = 1;
}
enum Type
{
TypeMediaPrepare = 1;
TypeMediaGetPart = 2;
TypeMediaTerminate = 3;
}
required Type type = 1;
optional Prepare prepare = 2;
optional GetPart get_part = 3;
optional Terminate terminate = 4;
} // MediaRequest
message MediaResponse
{
message PrepareResult
{
optional uint32 handle = 1; // handle iif prepare request was ok
}
message PartResult
{
optional bytes data = 2; // 0 bytes when the media is over, nothing when the request is ill formed
}
message TerminateResult
{
}
enum Type
{
TypePrepareResult = 1;
TypePartResult = 2;
TypeTerminateResult = 3;
}
required Type type = 1;
optional PrepareResult prepare_result = 2;
optional PartResult part_result = 3;
optional TerminateResult terminate_result = 4;
}