1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
6#define MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
7
8#include <string>
9
10#include "media/cast/logging/encoding_event_subscriber.h"
11
12namespace media {
13namespace cast {
14
15// Serialize |frame_events|, |packet_events|, |log_metadata|
16// returned from EncodingEventSubscriber.
17// Result is written to |output|, which can hold |max_output_bytes| of data.
18// If |compress| is true, |output| will be set with data compresssed in
19// gzip format.
20// |output_bytes| will be set to number of bytes written.
21//
22// Returns |true| if serialization is successful. This function
23// returns |false| if the serialized string will exceed |max_output_bytes|.
24//
25// See .cc file for format specification.
26bool SerializeEvents(const media::cast::proto::LogMetadata& log_metadata,
27                     const FrameEventList& frame_events,
28                     const PacketEventList& packet_events,
29                     bool compress,
30                     int max_output_bytes,
31                     char* output,
32                     int* output_bytes);
33
34}  // namespace cast
35}  // namespace media
36
37#endif  // MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
38