niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 14 | #include "system_wrappers/interface/scoped_ptr.h" |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 15 | #include "typedefs.h" // NOLINT |
mflodman@webrtc.org | a4863db | 2011-12-22 08:51:52 +0000 | [diff] [blame] | 16 | #include "video_engine/include/vie_file.h" |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 17 | #include "video_engine/vie_defines.h" |
| 18 | #include "video_engine/vie_frame_provider_base.h" |
| 19 | #include "video_engine/vie_ref_count.h" |
| 20 | #include "video_engine/vie_shared_data.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | class ConditionVariableWrapper; |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 25 | class CriticalSectionWrapper; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 26 | class ViESharedData; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 28 | class ViECaptureSnapshot : public ViEFrameCallback { |
| 29 | public: |
| 30 | ViECaptureSnapshot(); |
| 31 | ~ViECaptureSnapshot(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 33 | bool GetSnapshot(unsigned int max_wait_time, I420VideoFrame* video_frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 35 | // Implements ViEFrameCallback. |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 36 | virtual void DeliverFrame(int id, |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 37 | I420VideoFrame* video_frame, |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 38 | int num_csrcs = 0, |
pbos@webrtc.org | b238d12 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 39 | const uint32_t CSRC[kRtpCsrcSize] = NULL); |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 40 | virtual void DelayChanged(int id, int frame_delay) {} |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 41 | virtual int GetPreferedFrameSettings(int* width, |
| 42 | int* height, |
| 43 | int* frame_rate) { |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 44 | return -1; |
| 45 | } |
| 46 | virtual void ProviderDestroyed(int id) {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 48 | private: |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 49 | scoped_ptr<CriticalSectionWrapper> crit_; |
mflodman@webrtc.org | 2877bdc | 2012-01-17 12:18:16 +0000 | [diff] [blame] | 50 | scoped_ptr<ConditionVariableWrapper> condition_varaible_; |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 51 | I420VideoFrame* video_frame_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 54 | class ViEFileImpl |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 55 | : public ViEFile, |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 56 | public ViERefCount { |
| 57 | public: |
| 58 | // Implements ViEFile. |
| 59 | virtual int Release(); |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 60 | virtual int StartPlayFile(const char* file_nameUTF8, int& file_id, // NOLINT |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 61 | const bool loop = false, |
| 62 | const FileFormats file_format = kFileFormatAviFile); |
| 63 | virtual int StopPlayFile(const int file_id); |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 64 | virtual int RegisterObserver(int file_id, |
| 65 | ViEFileObserver& observer); // NOLINT |
| 66 | virtual int DeregisterObserver(int file_id, |
| 67 | ViEFileObserver& observer); // NOLINT |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 68 | virtual int SendFileOnChannel(const int file_id, const int video_channel); |
| 69 | virtual int StopSendFileOnChannel(const int video_channel); |
| 70 | virtual int StartPlayFileAsMicrophone(const int file_id, |
| 71 | const int audio_channel, |
| 72 | bool mix_microphone = false, |
| 73 | float volume_scaling = 1); |
| 74 | virtual int StopPlayFileAsMicrophone(const int file_id, |
| 75 | const int audio_channel); |
| 76 | virtual int StartPlayAudioLocally(const int file_id, const int audio_channel, |
| 77 | float volume_scaling = 1); |
| 78 | virtual int StopPlayAudioLocally(const int file_id, const int audio_channel); |
| 79 | virtual int StartRecordOutgoingVideo( |
| 80 | const int video_channel, |
| 81 | const char* file_nameUTF8, |
| 82 | AudioSource audio_source, |
| 83 | const CodecInst& audio_codec, |
| 84 | const VideoCodec& video_codec, |
| 85 | const FileFormats file_format = kFileFormatAviFile); |
| 86 | virtual int StartRecordIncomingVideo( |
| 87 | const int video_channel, |
| 88 | const char* file_nameUTF8, |
| 89 | AudioSource audio_source, |
| 90 | const CodecInst& audio_codec, |
| 91 | const VideoCodec& video_codec, |
| 92 | const FileFormats file_format = kFileFormatAviFile); |
| 93 | virtual int StopRecordOutgoingVideo(const int video_channel); |
| 94 | virtual int StopRecordIncomingVideo(const int video_channel); |
| 95 | virtual int GetFileInformation( |
| 96 | const char* file_name, |
| 97 | VideoCodec& video_codec, |
| 98 | CodecInst& audio_codec, |
| 99 | const FileFormats file_format = kFileFormatAviFile); |
| 100 | virtual int GetRenderSnapshot(const int video_channel, |
| 101 | const char* file_nameUTF8); |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 102 | virtual int GetRenderSnapshot(const int video_channel, |
| 103 | ViEPicture& picture); // NOLINT |
| 104 | virtual int FreePicture(ViEPicture& picture); // NOLINT |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 105 | virtual int GetCaptureDeviceSnapshot(const int capture_id, |
| 106 | const char* file_nameUTF8); |
| 107 | virtual int GetCaptureDeviceSnapshot(const int capture_id, |
| 108 | ViEPicture& picture); |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 109 | virtual int SetRenderStartImage(const int video_channel, |
| 110 | const char* file_nameUTF8); |
| 111 | virtual int SetRenderStartImage(const int video_channel, |
| 112 | const ViEPicture& picture); |
| 113 | virtual int SetRenderTimeoutImage(const int video_channel, |
| 114 | const char* file_nameUTF8, |
| 115 | const unsigned int timeout_ms); |
| 116 | virtual int SetRenderTimeoutImage(const int video_channel, |
| 117 | const ViEPicture& picture, |
| 118 | const unsigned int timeout_ms); |
mikhal@webrtc.org | e41bbdf | 2012-08-28 16:15:16 +0000 | [diff] [blame] | 119 | virtual int StartDebugRecording(int video_channel, |
| 120 | const char* file_name_utf8); |
| 121 | virtual int StopDebugRecording(int video_channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 122 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 123 | protected: |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 124 | explicit ViEFileImpl(ViESharedData* shared_data); |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 125 | virtual ~ViEFileImpl(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 126 | |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 127 | private: |
pbos@webrtc.org | b238d12 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 128 | int32_t GetNextCapturedFrame(int32_t capture_id, I420VideoFrame* video_frame); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 129 | |
| 130 | ViESharedData* shared_data_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 131 | }; |
mflodman@webrtc.org | 813b4ef | 2011-12-20 10:39:30 +0000 | [diff] [blame] | 132 | |
| 133 | } // namespace webrtc |
| 134 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 135 | #endif // WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |