| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CHROMECAST_PUBLIC_MEDIA_MEDIA_COMPONENT_DEVICE_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_ADAPTER_MEDIA_COMPONENT_DEVICE_H_ |
| 6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_COMPONENT_DEVICE_H_ | 6 #define CHROMECAST_MEDIA_CMA_ADAPTER_MEDIA_COMPONENT_DEVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "cast_key_system.h" | 11 #include "chromecast/public/media/cast_key_system.h" |
| 12 #include "chromecast/public/media/media_pipeline_backend.h" |
| 12 | 13 |
| 13 namespace chromecast { | 14 namespace chromecast { |
| 14 namespace media { | 15 namespace media { |
| 15 class CastDecoderBuffer; | 16 class CastDecoderBuffer; |
| 16 class DecryptContext; | 17 class DecryptContext; |
| 17 | 18 |
| 18 // Common base interface for both platform-specific audio and video pipeline | 19 // Common base interface for both platform-specific audio and video pipeline |
| 19 // backends. Both follow this state machine: | 20 // backends. Both follow this state machine: |
| 20 // +------------- kRunning <--+ | 21 // +------------- kRunning <--+ |
| 21 // | ^ | | 22 // | ^ | |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 64 |
| 64 // Client callbacks interface | 65 // Client callbacks interface |
| 65 class Client { | 66 class Client { |
| 66 public: | 67 public: |
| 67 virtual ~Client() {} | 68 virtual ~Client() {} |
| 68 virtual void OnEndOfStream() = 0; | 69 virtual void OnEndOfStream() = 0; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 // The statistics are computed since the media component left the idle state. | 72 // The statistics are computed since the media component left the idle state. |
| 72 // For video, a sample is defined as a frame. | 73 // For video, a sample is defined as a frame. |
| 73 struct Statistics { | 74 typedef MediaPipelineBackend::Decoder::Statistics Statistics; |
| 74 uint64_t decoded_bytes; | 75 typedef MediaPipelineBackend::AudioDecoder::RenderingDelay RenderingDelay; |
| 75 uint64_t decoded_samples; | |
| 76 uint64_t dropped_samples; | |
| 77 }; | |
| 78 | |
| 79 // Info on pipeline latency: amount of data in pipeline not rendered yet, | |
| 80 // and timestamp of system clock (must be CLOCK_MONOTONIC) at which delay | |
| 81 // measurement was taken. Both times in microseconds. | |
| 82 struct RenderingDelay { | |
| 83 RenderingDelay() | |
| 84 : delay_microseconds(INT64_MIN), timestamp_microseconds(INT64_MIN) {} | |
| 85 RenderingDelay(int64_t delay_microseconds_in, | |
| 86 int64_t timestamp_microseconds_in) | |
| 87 : delay_microseconds(delay_microseconds_in), | |
| 88 timestamp_microseconds(timestamp_microseconds_in) {} | |
| 89 int64_t delay_microseconds; | |
| 90 int64_t timestamp_microseconds; | |
| 91 }; | |
| 92 | 76 |
| 93 virtual ~MediaComponentDevice() {} | 77 virtual ~MediaComponentDevice() {} |
| 94 | 78 |
| 95 // Registers |client| as the media event handler. Implementation | 79 // Registers |client| as the media event handler. Implementation |
| 96 // takes ownership of |client| and call OnEndOfStream when an end-of-stream | 80 // takes ownership of |client| and call OnEndOfStream when an end-of-stream |
| 97 // buffer is processed. | 81 // buffer is processed. |
| 98 virtual void SetClient(Client* client) = 0; | 82 virtual void SetClient(Client* client) = 0; |
| 99 | 83 |
| 100 // Changes the state and performs any necessary transitions. | 84 // Changes the state and performs any necessary transitions. |
| 101 // Returns true when successful. | 85 // Returns true when successful. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 132 | 116 |
| 133 // Returns the playback statistics since the last transition from idle state. | 117 // Returns the playback statistics since the last transition from idle state. |
| 134 // Returns true when successful. | 118 // Returns true when successful. |
| 135 // Is only invoked in state kStateRunning. | 119 // Is only invoked in state kStateRunning. |
| 136 virtual bool GetStatistics(Statistics* stats) const = 0; | 120 virtual bool GetStatistics(Statistics* stats) const = 0; |
| 137 }; | 121 }; |
| 138 | 122 |
| 139 } // namespace media | 123 } // namespace media |
| 140 } // namespace chromecast | 124 } // namespace chromecast |
| 141 | 125 |
| 142 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_H_ | 126 #endif // CHROMECAST_MEDIA_CMA_ADAPTER_MEDIA_COMPONENT_DEVICE_H_ |
| OLD | NEW |