webrtc_m130/src/video_engine/vie_frame_provider_base.h
mflodman@webrtc.org d32c44738a Changed constructor used for CriticalSectionScoped in ViE.
Only changed:
- Name of some of the critsects.
- All critsects (but one) are now scoped_ptr.
- Use of ptr constructor of CriticalSectionScoped instead of reference version.

BUG=184
TEST=vie_auto_test

Review URL: http://webrtc-codereview.appspot.com/330015

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1291 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-22 14:17:53 +00:00

100 lines
3.1 KiB
C++

/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
#define WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
#include "modules/interface/module_common_types.h"
#include "system_wrappers/interface/map_wrapper.h"
#include "system_wrappers/interface/scoped_ptr.h"
#include "typedefs.h"
namespace webrtc {
class CriticalSectionWrapper;
class VideoEncoder;
// ViEFrameCallback shall be implemented by all classes receiving frames from a
// frame provider.
class ViEFrameCallback {
public:
virtual void DeliverFrame(int id,
VideoFrame& video_frame,
int num_csrcs = 0,
const WebRtc_UWord32 CSRC[kRtpCsrcSize] = NULL) = 0;
// The capture delay has changed from the provider. |frame_delay| is given in
// ms.
virtual void DelayChanged(int id, int frame_delay) = 0;
// Get the width, height and frame rate preferred by this observer.
virtual int GetPreferedFrameSettings(int& width,
int& height,
int& frame_rate) = 0;
// ProviderDestroyed is called when the frame is about to be destroyed. There
// must not be any more calls to the frame provider after this.
virtual void ProviderDestroyed(int id) = 0;
virtual ~ViEFrameCallback() {}
};
// ViEFrameProviderBase is a base class that will deliver frames to all
// registered ViEFrameCallbacks.
class ViEFrameProviderBase {
public:
ViEFrameProviderBase(int Id, int engine_id);
virtual ~ViEFrameProviderBase();
// Returns the frame provider id.
int Id();
// Register frame callbacks, i.e. a receiver of the captured frame.
virtual int RegisterFrameCallback(int observer_id,
ViEFrameCallback* callback_object);
virtual int DeregisterFrameCallback(const ViEFrameCallback* callback_object);
virtual bool IsFrameCallbackRegistered(
const ViEFrameCallback* callback_object);
int NumberOfRegisteredFrameCallbacks();
// FrameCallbackChanged
// Inherited classes should check for new frame_settings and reconfigure
// output if possible.
virtual int FrameCallbackChanged() = 0;
protected:
void DeliverFrame(VideoFrame& video_frame,
int num_csrcs = 0,
const WebRtc_UWord32 CSRC[kRtpCsrcSize] = NULL);
void SetFrameDelay(int frame_delay);
int FrameDelay();
int GetBestFormat(int& best_width,
int& best_height,
int& best_frame_rate);
int id_;
int engine_id_;
// Frame callbacks.
MapWrapper frame_callbacks_;
scoped_ptr<CriticalSectionWrapper> provider_cs_;
private:
VideoFrame* extra_frame_;
int frame_delay_;
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_