00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef H263_CONTAINER_H_
00010 #define H263_CONTAINER_H_
00011
00012
00013 #ifndef WIN32
00014 #include <mythtv/mythwidgets.h>
00015 #include <mythtv/dialogbox.h>
00016
00017
00018 #include "directory.h"
00019 #endif
00020
00021 #include "webcam.h"
00022 #include "sipfsm.h"
00023 #include "rtp.h"
00024
00025 extern "C" {
00026 #ifdef WIN32
00027 #include "libavcodec/avcodec.h"
00028 #else
00029 #include "mythtv/ffmpeg/avcodec.h"
00030 #endif
00031 }
00032
00033
00034 #define MAX_RGB_704_576 (704*576*4)
00035 #define MAX_YUV_704_576 (800*576*3/2) // Add a little onto the width in case the stride is bigger than the width
00036
00037
00038
00039 void YUV422PtoYUV420P(int width, int height, unsigned char *image);
00040 void RGB24toRGB32(const unsigned char *rgb24, unsigned char *rgb32, int len);
00041 void YUV422PtoRGB32(int width, int height, const unsigned char *src, unsigned char *dst, int dstSize);
00042 void YUV420PtoRGB32(const uchar *py, const uchar *pu, const uchar *pv, int width, int height, int stride, unsigned char *dst, int dstSize);
00043 void YUV420PtoRGB32(int width, int height, int stride, const unsigned char *src, unsigned char *dst, int dstSize);
00044 void scaleYuvImage(const uchar *yuvBuffer, int ow, int oh, int dw, int dh, uchar *dst);
00045 void cropYuvImage(const uchar *yuvBuffer, int ow, int oh, int cx, int cy, int cw, int ch, uchar *dst);
00046 void flipRgb32Image(const uchar *rgbBuffer, int w, int h, uchar *dst);
00047 void flipYuv420pImage(const uchar *yuvBuffer, int w, int h, uchar *dst);
00048 void flipYuv422pImage(const uchar *yuvBuffer, int w, int h, uchar *dst);
00049 void flipRgb24Image(const uchar *rgbBuffer, int w, int h, uchar *dst);
00050
00051
00052
00053 class H263Container
00054 {
00055 public:
00056 H263Container(void);
00057 virtual ~H263Container(void);
00058
00059 bool H263StartEncoder(int w, int h, int fps);
00060 bool H263StartDecoder(int w, int h);
00061 uchar *H263EncodeFrame(const uchar *yuvFrame, int *len);
00062 uchar *H263DecodeFrame(const uchar *h263Frame, int h263FrameLen, uchar *rgbBuffer, int rgbBufferSize);
00063 void H263ForceIFrame();
00064 void H263StopEncoder();
00065 void H263StopDecoder();
00066
00067 private:
00068 AVFrame pictureOut, *pictureIn;
00069 AVCodec *h263Encoder, *h263Decoder;
00070 AVCodecContext *h263EncContext, *h263DecContext;
00071 int MaxPostEncodeSize, lastCompressedSize;
00072 unsigned char *PostEncodeFrame, *PreEncodeFrame;
00073
00074 };
00075
00076 #endif