Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "content/public/common/media_stream_request.h"
      6 
      7 #include "base/logging.h"
      8 
      9 namespace content {
     10 
     11 bool IsAudioMediaType(MediaStreamType type) {
     12   return (type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
     13           type == content::MEDIA_TAB_AUDIO_CAPTURE ||
     14           type == content::MEDIA_SYSTEM_AUDIO_CAPTURE);
     15 }
     16 
     17 bool IsVideoMediaType(MediaStreamType type) {
     18   return (type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
     19           type == content::MEDIA_TAB_VIDEO_CAPTURE ||
     20           type == content::MEDIA_DESKTOP_VIDEO_CAPTURE);
     21 }
     22 
     23 MediaStreamDevice::MediaStreamDevice() : type(MEDIA_NO_SERVICE) {}
     24 
     25 MediaStreamDevice::MediaStreamDevice(
     26     MediaStreamType type,
     27     const std::string& id,
     28     const std::string& name)
     29     : type(type),
     30       id(id),
     31       name(name),
     32       sample_rate(0),
     33       channel_layout(0) {
     34 }
     35 
     36 MediaStreamDevice::MediaStreamDevice(
     37     MediaStreamType type,
     38     const std::string& id,
     39     const std::string& name,
     40     int sample_rate,
     41     int channel_layout)
     42     : type(type),
     43       id(id),
     44       name(name),
     45       sample_rate(sample_rate),
     46       channel_layout(channel_layout) {
     47 }
     48 
     49 MediaStreamDevice::~MediaStreamDevice() {}
     50 
     51 MediaStreamRequest::MediaStreamRequest(
     52     int render_process_id,
     53     int render_view_id,
     54     int page_request_id,
     55     const std::string& tab_capture_device_id,
     56     const GURL& security_origin,
     57     MediaStreamRequestType request_type,
     58     const std::string& requested_audio_device_id,
     59     const std::string& requested_video_device_id,
     60     MediaStreamType audio_type,
     61     MediaStreamType video_type)
     62     : render_process_id(render_process_id),
     63       render_view_id(render_view_id),
     64       page_request_id(page_request_id),
     65       tab_capture_device_id(tab_capture_device_id),
     66       security_origin(security_origin),
     67       request_type(request_type),
     68       requested_audio_device_id(requested_audio_device_id),
     69       requested_video_device_id(requested_video_device_id),
     70       audio_type(audio_type),
     71       video_type(video_type) {
     72 }
     73 
     74 MediaStreamRequest::~MediaStreamRequest() {}
     75 
     76 }  // namespace content
     77