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_DESERIALIZER_H_
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
85c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include <map>
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include <string>
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
115c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "base/memory/linked_ptr.h"
125c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "media/cast/logging/logging_defines.h"
135c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "media/cast/logging/proto/raw_events.pb.h"
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace media {
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace cast {
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
185c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liutypedef std::map<RtpTimestamp,
195c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                 linked_ptr<media::cast::proto::AggregatedFrameEvent> >
205c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu    FrameEventMap;
215c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liutypedef std::map<RtpTimestamp,
225c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                 linked_ptr<media::cast::proto::AggregatedPacketEvent> >
235c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu    PacketEventMap;
245c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
250529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch// Represents deserialized raw event logs for a particular stream.
260529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochstruct DeserializedLog {
270529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  DeserializedLog();
280529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  ~DeserializedLog();
290529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  proto::LogMetadata metadata;
300529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  FrameEventMap frame_events;
310529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PacketEventMap packet_events;
320529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch};
330529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// This function takes the output of LogSerializer and deserializes it into
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// its original format. Returns true if deserialization is successful. All
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// output arguments are valid if this function returns true.
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// |data|: Serialized event logs with length |data_bytes|.
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// |compressed|: true if |data| is compressed in gzip format.
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// |log_metadata|: This will be populated with deserialized LogMetadata proto.
400529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch// |audio_log|, |video_log|: These will be populated with deserialized
410529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch// log data for audio and video streams, respectively.
420529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochbool DeserializeEvents(const char* data,
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       int data_bytes,
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       bool compressed,
450529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                       DeserializedLog* audio_log,
460529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                       DeserializedLog* video_log);
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace cast
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace media
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif  // MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_
52