| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ | 5 #ifndef MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ |
| 6 #define MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ | 6 #define MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Unbinds from clients and resets to initial state. | 32 // Unbinds from clients and resets to initial state. |
| 33 void Reset(); | 33 void Reset(); |
| 34 | 34 |
| 35 // Get the TimelineFunction for the reference_time (which should be 'now', | 35 // Get the TimelineFunction for the reference_time (which should be 'now', |
| 36 // approximately). | 36 // approximately). |
| 37 void SnapshotCurrentFunction(int64_t reference_time, | 37 void SnapshotCurrentFunction(int64_t reference_time, |
| 38 TimelineFunction* out, | 38 TimelineFunction* out, |
| 39 uint32_t* generation = nullptr); | 39 uint32_t* generation = nullptr); |
| 40 | 40 |
| 41 // Sets the current end_of_stream status published by the control site. |
| 42 void SetEndOfStreamPts(int64_t end_of_stream_pts); |
| 43 |
| 41 // MediaTimelineControlSite implementation. | 44 // MediaTimelineControlSite implementation. |
| 42 void GetStatus(uint64_t version_last_seen, | 45 void GetStatus(uint64_t version_last_seen, |
| 43 const GetStatusCallback& callback) override; | 46 const GetStatusCallback& callback) override; |
| 44 | 47 |
| 45 void GetTimelineConsumer( | 48 void GetTimelineConsumer( |
| 46 InterfaceRequest<TimelineConsumer> timeline_consumer) override; | 49 InterfaceRequest<TimelineConsumer> timeline_consumer) override; |
| 47 | 50 |
| 48 // TimelineConsumer implementation. | 51 // TimelineConsumer implementation. |
| 49 void SetTimelineTransform( | 52 void SetTimelineTransform( |
| 50 int64_t subject_time, | 53 int64_t subject_time, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 | 64 |
| 62 // Clears the pending timeline function and calls its associated callback | 65 // Clears the pending timeline function and calls its associated callback |
| 63 // with the indicated completed status. | 66 // with the indicated completed status. |
| 64 void ClearPendingTimelineFunctionUnsafe(bool completed); | 67 void ClearPendingTimelineFunctionUnsafe(bool completed); |
| 65 | 68 |
| 66 // Determines if an unrealized timeline function is currently pending. | 69 // Determines if an unrealized timeline function is currently pending. |
| 67 bool TimelineFunctionPendingUnsafe() { | 70 bool TimelineFunctionPendingUnsafe() { |
| 68 return pending_timeline_function_.reference_time() != kUnspecifiedTime; | 71 return pending_timeline_function_.reference_time() != kUnspecifiedTime; |
| 69 } | 72 } |
| 70 | 73 |
| 74 // Determines whether end-of-stream has been reached. |
| 75 bool ReachedEndOfStreamUnsafe(); |
| 76 |
| 71 // Unbinds from clients and resets to initial state. | 77 // Unbinds from clients and resets to initial state. |
| 72 void ResetUnsafe(); | 78 void ResetUnsafe(); |
| 73 | 79 |
| 74 static void RunCallback(SetTimelineTransformCallback callback, | 80 static void RunCallback(SetTimelineTransformCallback callback, |
| 75 bool completed); | 81 bool completed); |
| 76 | 82 |
| 77 Binding<MediaTimelineControlSite> control_site_binding_; | 83 Binding<MediaTimelineControlSite> control_site_binding_; |
| 78 Binding<TimelineConsumer> consumer_binding_; | 84 Binding<TimelineConsumer> consumer_binding_; |
| 79 MojoPublisher<GetStatusCallback> status_publisher_; | 85 MojoPublisher<GetStatusCallback> status_publisher_; |
| 80 | 86 |
| 81 base::Lock lock_; | 87 base::Lock lock_; |
| 82 // BEGIN fields synchronized using lock_. | 88 // BEGIN fields synchronized using lock_. |
| 83 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 84 TimelineFunction current_timeline_function_; | 90 TimelineFunction current_timeline_function_; |
| 85 TimelineFunction pending_timeline_function_; | 91 TimelineFunction pending_timeline_function_; |
| 86 SetTimelineTransformCallback set_timeline_transform_callback_; | 92 SetTimelineTransformCallback set_timeline_transform_callback_; |
| 87 uint32_t generation_ = 1; | 93 uint32_t generation_ = 1; |
| 94 int64_t end_of_stream_pts_ = kUnspecifiedTime; |
| 95 bool end_of_stream_published_ = false; |
| 88 // END fields synchronized using lock_. | 96 // END fields synchronized using lock_. |
| 89 }; | 97 }; |
| 90 | 98 |
| 91 } // namespace media | 99 } // namespace media |
| 92 } // namespace mojo | 100 } // namespace mojo |
| 93 | 101 |
| 94 #endif // MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ | 102 #endif // MOJO_SERVICES_MEDIA_COMMON_TIMELINE_CONTROL_SITE_IMPL_H_ |
| OLD | NEW |