• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * libjingle
3  * Copyright 2004 Google Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  *  1. Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *  2. Redistributions in binary form must reproduce the above copyright notice,
11  *     this list of conditions and the following disclaimer in the documentation
12  *     and/or other materials provided with the distribution.
13  *  3. The name of the author may not be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef TALK_MEDIA_BASE_NULLVIDEOFRAME_H_
29 #define TALK_MEDIA_BASE_NULLVIDEOFRAME_H_
30 
31 #include "talk/media/base/videoframe.h"
32 
33 namespace cricket {
34 
35 // Simple subclass for use in mocks.
36 class NullVideoFrame : public VideoFrame {
37  public:
Reset(uint32 format,int w,int h,int dw,int dh,uint8 * sample,size_t sample_size,size_t pixel_width,size_t pixel_height,int64 elapsed_time,int64 time_stamp,int rotation)38   virtual bool Reset(uint32 format, int w, int h, int dw, int dh, uint8 *sample,
39                      size_t sample_size, size_t pixel_width,
40                      size_t pixel_height, int64 elapsed_time, int64 time_stamp,
41                      int rotation) {
42     return false;
43   }
InitToBlack(int w,int h,size_t pixel_width,size_t pixel_height,int64 elapsed_time,int64 time_stamp)44   virtual bool InitToBlack(int w, int h, size_t pixel_width,
45                            size_t pixel_height, int64 elapsed_time,
46                            int64 time_stamp) {
47     return false;
48   }
GetWidth()49   virtual size_t GetWidth() const { return 0; }
GetHeight()50   virtual size_t GetHeight() const { return 0; }
GetYPlane()51   virtual const uint8 *GetYPlane() const { return NULL; }
GetUPlane()52   virtual const uint8 *GetUPlane() const { return NULL; }
GetVPlane()53   virtual const uint8 *GetVPlane() const { return NULL; }
GetYPlane()54   virtual uint8 *GetYPlane() { return NULL; }
GetUPlane()55   virtual uint8 *GetUPlane() { return NULL; }
GetVPlane()56   virtual uint8 *GetVPlane() { return NULL; }
GetYPitch()57   virtual int32 GetYPitch() const { return 0; }
GetUPitch()58   virtual int32 GetUPitch() const { return 0; }
GetVPitch()59   virtual int32 GetVPitch() const { return 0; }
GetNativeHandle()60   virtual void* GetNativeHandle() const { return NULL; }
61 
GetPixelWidth()62   virtual size_t GetPixelWidth() const { return 1; }
GetPixelHeight()63   virtual size_t GetPixelHeight() const { return 1; }
GetElapsedTime()64   virtual int64 GetElapsedTime() const { return 0; }
GetTimeStamp()65   virtual int64 GetTimeStamp() const { return 0; }
SetElapsedTime(int64 elapsed_time)66   virtual void SetElapsedTime(int64 elapsed_time) {}
SetTimeStamp(int64 time_stamp)67   virtual void SetTimeStamp(int64 time_stamp) {}
GetRotation()68   virtual int GetRotation() const { return 0; }
69 
Copy()70   virtual VideoFrame *Copy() const { return NULL; }
71 
MakeExclusive()72   virtual bool MakeExclusive() { return false; }
73 
CopyToBuffer(uint8 * buffer,size_t size)74   virtual size_t CopyToBuffer(uint8 *buffer, size_t size) const { return 0; }
75 
ConvertToRgbBuffer(uint32 to_fourcc,uint8 * buffer,size_t size,int stride_rgb)76   virtual size_t ConvertToRgbBuffer(uint32 to_fourcc, uint8 *buffer,
77                                     size_t size, int stride_rgb) const {
78     return 0;
79   }
80 
StretchToPlanes(uint8 * y,uint8 * u,uint8 * v,int32 pitchY,int32 pitchU,int32 pitchV,size_t width,size_t height,bool interpolate,bool crop)81   virtual void StretchToPlanes(
82       uint8 *y, uint8 *u, uint8 *v, int32 pitchY, int32 pitchU, int32 pitchV,
83       size_t width, size_t height, bool interpolate, bool crop) const {}
84 
CreateEmptyFrame(int w,int h,size_t pixel_width,size_t pixel_height,int64 elapsed_time,int64 time_stamp)85   virtual VideoFrame *CreateEmptyFrame(int w, int h, size_t pixel_width,
86                                        size_t pixel_height, int64 elapsed_time,
87                                        int64 time_stamp) const {
88     return NULL;
89   }
90 };
91 
92 }  // namespace cricket
93 
94 #endif  // TALK_MEDIA_BASE_NULLVIDEOFRAME_H_
95