andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 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 | |
| 11 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |
| 13 | |
| 14 | #include "system_wrappers/interface/scoped_ptr.h" |
| 15 | #include "typedefs.h" // NOLINT |
| 16 | #include "video_engine/include/vie_file.h" |
| 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" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class ConditionVariableWrapper; |
| 25 | class CriticalSectionWrapper; |
| 26 | class ViESharedData; |
| 27 | |
| 28 | class ViECaptureSnapshot : public ViEFrameCallback { |
| 29 | public: |
| 30 | ViECaptureSnapshot(); |
| 31 | ~ViECaptureSnapshot(); |
| 32 | |
mikhal@webrtc.org | dc7e6cf | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 33 | bool GetSnapshot(unsigned int max_wait_time, I420VideoFrame* video_frame); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 34 | |
| 35 | // Implements ViEFrameCallback. |
| 36 | virtual void DeliverFrame(int id, |
mikhal@webrtc.org | dc7e6cf | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 37 | I420VideoFrame* video_frame, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 38 | int num_csrcs = 0, |
| 39 | const WebRtc_UWord32 CSRC[kRtpCsrcSize] = NULL); |
| 40 | virtual void DelayChanged(int id, int frame_delay) {} |
| 41 | virtual int GetPreferedFrameSettings(int* width, |
| 42 | int* height, |
| 43 | int* frame_rate) { |
| 44 | return -1; |
| 45 | } |
| 46 | virtual void ProviderDestroyed(int id) {} |
| 47 | |
| 48 | private: |
| 49 | scoped_ptr<CriticalSectionWrapper> crit_; |
| 50 | scoped_ptr<ConditionVariableWrapper> condition_varaible_; |
mikhal@webrtc.org | dc7e6cf | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 51 | I420VideoFrame* video_frame_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | class ViEFileImpl |
| 55 | : public ViEFile, |
| 56 | public ViERefCount { |
| 57 | public: |
| 58 | // Implements ViEFile. |
| 59 | virtual int Release(); |
| 60 | virtual int StartPlayFile(const char* file_nameUTF8, int& file_id, // NOLINT |
| 61 | const bool loop = false, |
| 62 | const FileFormats file_format = kFileFormatAviFile); |
| 63 | virtual int StopPlayFile(const int file_id); |
| 64 | virtual int RegisterObserver(int file_id, |
| 65 | ViEFileObserver& observer); // NOLINT |
| 66 | virtual int DeregisterObserver(int file_id, |
| 67 | ViEFileObserver& observer); // NOLINT |
| 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); |
| 102 | virtual int GetRenderSnapshot(const int video_channel, |
| 103 | ViEPicture& picture); // NOLINT |
| 104 | virtual int FreePicture(ViEPicture& picture); // NOLINT |
| 105 | virtual int GetCaptureDeviceSnapshot(const int capture_id, |
| 106 | const char* file_nameUTF8); |
| 107 | virtual int GetCaptureDeviceSnapshot(const int capture_id, |
| 108 | ViEPicture& picture); |
| 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); |
| 119 | virtual int StartDebugRecording(int video_channel, |
| 120 | const char* file_name_utf8); |
| 121 | virtual int StopDebugRecording(int video_channel); |
| 122 | |
| 123 | protected: |
| 124 | explicit ViEFileImpl(ViESharedData* shared_data); |
| 125 | virtual ~ViEFileImpl(); |
| 126 | |
| 127 | private: |
| 128 | WebRtc_Word32 GetNextCapturedFrame(WebRtc_Word32 capture_id, |
mikhal@webrtc.org | dc7e6cf | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 129 | I420VideoFrame* video_frame); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 130 | |
| 131 | ViESharedData* shared_data_; |
| 132 | }; |
| 133 | |
| 134 | } // namespace webrtc |
| 135 | |
| 136 | #endif // WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_ |