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