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_PIPELINE_DEVICE_PARAMS_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace chromecast { | 10 namespace chromecast { |
11 class TaskRunner; | 11 class TaskRunner; |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
| 15 enum class AudioContentType; // See chromecast/public/volume_control.h |
| 16 |
15 // Supplies creation parameters to platform-specific pipeline backend. | 17 // Supplies creation parameters to platform-specific pipeline backend. |
16 struct MediaPipelineDeviceParams { | 18 struct MediaPipelineDeviceParams { |
17 enum MediaSyncType { | 19 enum MediaSyncType { |
18 // Default operation, synchronize playback using PTS with higher latency. | 20 // Default operation, synchronize playback using PTS with higher latency. |
19 kModeSyncPts = 0, | 21 kModeSyncPts = 0, |
20 // With this mode, synchronization is disabled and audio/video frames are | 22 // With this mode, synchronization is disabled and audio/video frames are |
21 // rendered "right away": | 23 // rendered "right away": |
22 // - for audio, frames are still rendered based on the sampling frequency | 24 // - for audio, frames are still rendered based on the sampling frequency |
23 // - for video, frames are rendered as soon as available at the output of | 25 // - for video, frames are rendered as soon as available at the output of |
24 // the video decoder. | 26 // the video decoder. |
25 // The assumption is that no B frames are used when synchronization is | 27 // The assumption is that no B frames are used when synchronization is |
26 // disabled, otherwise B frames would always be skipped. | 28 // disabled, otherwise B frames would always be skipped. |
27 kModeIgnorePts = 1, | 29 kModeIgnorePts = 1, |
28 // In addition to the constraints above, also do not wait for vsync. | 30 // In addition to the constraints above, also do not wait for vsync. |
29 kModeIgnorePtsAndVSync = 2, | 31 kModeIgnorePtsAndVSync = 2, |
30 }; | 32 }; |
31 | 33 |
32 enum AudioStreamType { | 34 enum AudioStreamType { |
33 // "Real" audio stream. If this stream underruns, all audio output may pause | 35 // "Real" audio stream. If this stream underruns, all audio output may pause |
34 // until more real stream data is available. | 36 // until more real stream data is available. |
35 kAudioStreamNormal = 0, | 37 kAudioStreamNormal = 0, |
36 // Sound-effects audio stream. May be interrupted if a real audio stream | 38 // Sound-effects audio stream. May be interrupted if a real audio stream |
37 // is created with a different sample rate. Underruns on an effects stream | 39 // is created with a different sample rate. Underruns on an effects stream |
38 // do not affect output of real audio streams. | 40 // do not affect output of real audio streams. |
39 kAudioStreamSoundEffects = 1, | 41 kAudioStreamSoundEffects = 1, |
40 }; | 42 }; |
41 | 43 |
42 MediaPipelineDeviceParams(TaskRunner* task_runner_in) | 44 MediaPipelineDeviceParams(TaskRunner* task_runner_in, |
| 45 AudioContentType content_type_in, |
| 46 const std::string& device_id_in) |
43 : sync_type(kModeSyncPts), | 47 : sync_type(kModeSyncPts), |
44 audio_type(kAudioStreamNormal), | 48 audio_type(kAudioStreamNormal), |
45 task_runner(task_runner_in) {} | 49 task_runner(task_runner_in), |
| 50 content_type(content_type_in), |
| 51 device_id(device_id_in) {} |
46 | 52 |
47 MediaPipelineDeviceParams(MediaSyncType sync_type_in, | 53 MediaPipelineDeviceParams(MediaSyncType sync_type_in, |
48 TaskRunner* task_runner_in) | 54 TaskRunner* task_runner_in, |
| 55 AudioContentType content_type_in, |
| 56 const std::string& device_id_in) |
49 : sync_type(sync_type_in), | 57 : sync_type(sync_type_in), |
50 audio_type(kAudioStreamNormal), | 58 audio_type(kAudioStreamNormal), |
51 task_runner(task_runner_in) {} | 59 task_runner(task_runner_in), |
| 60 content_type(content_type_in), |
| 61 device_id(device_id_in) {} |
52 | 62 |
53 MediaPipelineDeviceParams(MediaSyncType sync_type_in, | 63 MediaPipelineDeviceParams(MediaSyncType sync_type_in, |
54 AudioStreamType audio_type_in, | 64 AudioStreamType audio_type_in, |
55 TaskRunner* task_runner_in) | 65 TaskRunner* task_runner_in, |
| 66 AudioContentType content_type_in, |
| 67 const std::string& device_id_in) |
56 : sync_type(sync_type_in), | 68 : sync_type(sync_type_in), |
57 audio_type(audio_type_in), | 69 audio_type(audio_type_in), |
58 task_runner(task_runner_in) {} | 70 task_runner(task_runner_in), |
59 | 71 content_type(content_type_in), |
60 // |device_id_in| should be from media/audio/audio_device_description.h or | 72 device_id(device_id_in) {} |
61 // chromecast/media/base/audio_device_ids.h | |
62 MediaPipelineDeviceParams(MediaSyncType sync_type_in, | |
63 AudioStreamType audio_type_in, | |
64 const std::string& device_id_in, | |
65 TaskRunner* task_runner_in) | |
66 : sync_type(sync_type_in), | |
67 audio_type(audio_type_in), | |
68 device_id(device_id_in), | |
69 task_runner(task_runner_in) {} | |
70 | 73 |
71 const MediaSyncType sync_type; | 74 const MediaSyncType sync_type; |
72 const AudioStreamType audio_type; | 75 const AudioStreamType audio_type; |
73 const std::string device_id; | |
74 | 76 |
75 // task_runner allows backend implementations to post tasks to the media | 77 // task_runner allows backend implementations to post tasks to the media |
76 // thread. Since all calls from cast_shell into the backend are made on | 78 // thread. Since all calls from cast_shell into the backend are made on |
77 // the media thread, this may simplify thread management and safety for | 79 // the media thread, this may simplify thread management and safety for |
78 // some backends. | 80 // some backends. |
79 TaskRunner* const task_runner; | 81 TaskRunner* const task_runner; |
| 82 |
| 83 // Identifies the content type for volume control. |
| 84 const AudioContentType content_type; |
| 85 const std::string device_id; |
80 }; | 86 }; |
81 | 87 |
82 } // namespace media | 88 } // namespace media |
83 } // namespace chromecast | 89 } // namespace chromecast |
84 | 90 |
85 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_PARAMS_H_ | 91 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
OLD | NEW |