1 /*
2 * real_encoder.h --
3 *
4 * FIXME: This file needs a description here.
5 *
6 * Copyright (c) 2001-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #include <unistd.h>
35 #include <sys/time.h>
36 #include "pipe_rend.h"
37 #include <sys/types.h>
38 #include <fcntl.h>
39 #include <sys/stat.h>
40 #include <errno.h>
41
42 // for the RealSDK
43 #include "pntypes.h"
44 #include "pnresult.h"
45 //#include "setdllac.h"
46 //#include "rmaiids.h"
47 // from realproducersdk/samples/live/guids.cpp
48 #include "pncom.h"
49 #include "rmaerror.h"
50 #include "pnwintyp.h"
51 #include "engtypes.h"
52 #include "engtargs.h"
53 #include "rmbldeng.h"
54 #include "rmaenum.h"
55 #include "rmmetain.h"
56 #include "progsink.h"
57 #include "rmamon.h"
58 #include "rmapckts.h"
59 #include "engstats.h"
60 #include "engcodec.h"
61
62 // this is for testing only, it is to buffer video frames before giving it to the real encoder, in the cast that they need to be buffered to stay on track with the audio.
63 /*struct frameBuffer {
64 ULONG32 TimeStamp;
65 u_int8_t* frame;
66 };*/
67
68 class RealWindow : public Renderer {
69 public:
70 RealWindow(const char*,const char*,const char*,const char*,int,int,const char*,int,const char*,const char*,const char*,const char*,int,int,int);
71 ~RealWindow();
72 void setup_encoder();
73 int command(int argc, const char*const* argv);
74 void setcolor(int x) {};
75 void recv(Buffer* b, int, int) {recv(b);};
76 void recv(Buffer* b);
77 void planar422toI420(char* dest, char* src);
78 int SuggestAudioBufferSize() { return nSuggestedAudioBufferSize;};
79 void encodeAudio(u_short* buf, int size, ULONG32 now);
80 private:
81 PN_RESULT res;
82
83 IRMABuildEngine *pBuildEngine;
84 IRMAMediaSample *pSample;
85 UINT32 cVideoFormat_Width;
86 UINT32 cVideoFormat_Height;
87 UINT32 cVideoFormat_FrameRate;
88 UINT32 cAudioFormat_SampleRate;
89 UINT32 cAudioFormat_NumChannels;
90 UINT32 cAudioFormat_BitsPerSample;
91 UINT32 nSuggestedAudioBufferSize;
92 IRMAInputPin *pAudioPin;
93 IRMAInputPin *pVideoPin;
94 ULONG32 nAudioTimestamp;
95 ULONG32 nSystemTimestamp;
96 ULONG32 nAudioBufferDuration;
97 INT32 nBufferSize;
98 u_int8_t* translate_frame;
99 int colorModel;
100 // frameBuffer* videoBuffer;
101 int nextIn;
102 int nextOut;
103
104 // constructor information
105 char server[512];
106 char filename[512];
107 char username[512];
108 char password[512];
109 int portNum;
110 char data_rate[512];
111 int save_file;
112 char local_file_name[512];
113 char title[512];
114 char author[512];
115 char copyright[512];
116 int useAudio;
117 int useVideo;
118 int sureStream;
119 };
120
121 ULONG32 GetTime();
122
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.