OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ | 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ |
6 #define MEDIA_BASE_MEDIA_LOG_H_ | 6 #define MEDIA_BASE_MEDIA_LOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/media_log_event.h" | 10 #include "media/base/media_log_event.h" |
| 11 #include "media/base/pipeline_impl.h" |
11 | 12 |
12 namespace media { | 13 namespace media { |
13 | 14 |
14 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 15 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
15 public: | 16 public: |
16 // Return a string to represent an EventType. | 17 // Convert various enums to strings. |
17 static const char* EventTypeToString(MediaLogEvent::Type type); | 18 static const char* EventTypeToString(MediaLogEvent::Type type); |
| 19 static const char* PipelineStateToString(PipelineImpl::State); |
18 | 20 |
19 MediaLog(); | 21 MediaLog(); |
20 | 22 |
21 // Add an event to this log. Overriden by inheritors to actually do something | 23 // Add an event to this log. Overriden by inheritors to actually do something |
22 // with it. | 24 // with it. |
23 // Takes ownership of |event|. | 25 // Takes ownership of |event|. |
24 virtual void AddEvent(MediaLogEvent* event); | 26 virtual void AddEvent(MediaLogEvent* event); |
25 | 27 |
26 // Helper methods to create events and their parameters. | 28 // Helper methods to create events and their parameters. |
27 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); | 29 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); |
28 MediaLogEvent* CreateLoadEvent(const std::string& url); | 30 MediaLogEvent* CreateLoadEvent(const std::string& url); |
| 31 MediaLogEvent* CreateSeekEvent(float seconds); |
| 32 MediaLogEvent* CreatePipelineStateChangedEvent(PipelineImpl::State state); |
29 MediaLogEvent* CreateBufferedExtentsChangedEvent(size_t start, size_t current, | 33 MediaLogEvent* CreateBufferedExtentsChangedEvent(size_t start, size_t current, |
30 size_t end); | 34 size_t end); |
31 | 35 |
32 protected: | 36 protected: |
33 friend class base::RefCountedThreadSafe<MediaLog>; | 37 friend class base::RefCountedThreadSafe<MediaLog>; |
34 virtual ~MediaLog(); | 38 virtual ~MediaLog(); |
35 | 39 |
36 private: | 40 private: |
37 // A unique (to this process) id for this MediaLog. | 41 // A unique (to this process) id for this MediaLog. |
38 int32 id_; | 42 int32 id_; |
39 | 43 |
40 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 44 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
41 }; | 45 }; |
42 | 46 |
43 } // namespace media | 47 } // namespace media |
44 | 48 |
45 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 49 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |