Ticket #5700: mythphone-uninit.patch
| File mythphone-uninit.patch, 7.4 KB (added by , 18 years ago) |
|---|
-
mythplugins/mythphone/mythphone/rtp.h
Fix initialization in ctor defects in mythphone From: Erik Hovland <erik@hovland.org> --- mythplugins/mythphone/mythphone/rtp.h | 61 ++++++++++++++++++++++------ mythplugins/mythphone/mythphone/webcam.cpp | 48 ++++++++-------------- mythplugins/mythphone/mythphone/webcam.h | 16 +++++-- 3 files changed, 76 insertions(+), 49 deletions(-) diff --git a/mythplugins/mythphone/mythphone/rtp.h b/mythplugins/mythphone/mythphone/rtp.h index 5d13c23..2d42582 100644
a b class rtp; 39 39 class RtpEvent : public QEvent 40 40 { 41 41 public: 42 enum Type { RxVideoFrame = (QEvent::User + 300), RtpDebugEv, RtpStatisticsEv, RtpRtcpStatsEv }; 43 44 RtpEvent(Type t, QString s="") : QEvent((QEvent::Type)t) { text=s; } 45 RtpEvent(Type t, rtp *r, QTime tm, int ms, int s1, int s2, int s3, int s4, int s5, int s6, 46 int s7, int s8, int s9, int s10, int s11, int s12, int s13, int s14, int s15, int s16) 47 : QEvent((QEvent::Type)t) 48 { rtpThread=r; timestamp=tm; msPeriod = ms; pkIn=s1; pkOut=s2; pkMiss=s3; pkLate=s4; 49 pkInDisc=s5; pkOutDrop=s6; 50 byteIn=s7; byteOut=s8; bytePlayed=s9; framesIn=s10; framesOut=s11; framesInDisc=s12; 51 framesOutDisc=s13; minPlayout=s14; avgPlayout=s15; maxPlayout=s16; } 52 RtpEvent(Type t, rtp *r, QTime tm, int ms, int s1, int s2) : QEvent((QEvent::Type)t) 53 { rtpThread=r; timestamp=tm; msPeriod = ms; rtcpFractionLoss=s1; rtcpTotalLoss=s2;} 42 enum Type { 43 RxVideoFrame = (QEvent::User + 300), RtpDebugEv, RtpStatisticsEv, 44 RtpRtcpStatsEv 45 }; 46 47 RtpEvent(Type t, QString s="") 48 : QEvent((QEvent::Type)t), 49 text(s), rtpThread(NULL), 50 timestamp(), msPeriod(0), 51 pkIn(0), pkOut(0), 52 pkOutDrop(0), pkMiss(0), 53 pkLate(0), pkInDisc(0), 54 framesIn(0), framesOut(0), 55 framesInDisc(0), framesOutDisc(0), 56 byteIn(0), byteOut(0), 57 bytePlayed(0), rtcpFractionLoss(0), 58 rtcpTotalLoss(0), minPlayout(0), 59 avgPlayout(0), maxPlayout(0) { } 60 61 RtpEvent(Type t, rtp *r, QTime tm, int ms, int s1, int s2, int s3, int s4, 62 int s5, int s6, int s7, int s8, int s9, int s10, int s11, int s12, 63 int s13, int s14, int s15, int s16) 64 : QEvent((QEvent::Type)t), 65 text(""), rtpThread(r), 66 timestamp(tm), msPeriod(ms), 67 pkIn(s1), pkOut(s2), 68 pkOutDrop(s6), pkMiss(s3), 69 pkLate(s4), pkInDisc(s5), 70 framesIn(s10), framesOut(s11), 71 framesInDisc(s12), framesOutDisc(s13), 72 byteIn(s7), byteOut(s8), 73 bytePlayed(s9), rtcpFractionLoss(0), 74 rtcpTotalLoss(0), minPlayout(s14), 75 avgPlayout(s15), maxPlayout(s16) { } 76 77 RtpEvent(Type t, rtp *r, QTime tm, int ms, int s1, int s2) 78 : QEvent((QEvent::Type)t), 79 text(""), rtpThread(r), 80 timestamp(tm), msPeriod(ms), 81 pkIn(0), pkOut(0), 82 pkOutDrop(0), pkMiss(0), 83 pkLate(0), pkInDisc(0), 84 framesIn(0), framesOut(0), 85 framesInDisc(0), framesOutDisc(0), 86 byteIn(0), byteOut(0), 87 bytePlayed(0), rtcpFractionLoss(s1), 88 rtcpTotalLoss(s2), minPlayout(0), 89 avgPlayout(0), maxPlayout(0) { } 90 54 91 ~RtpEvent() { } 55 92 QString msg() { return text;} 56 93 rtp *owner() { return rtpThread; } -
mythplugins/mythphone/mythphone/webcam.cpp
diff --git a/mythplugins/mythphone/mythphone/webcam.cpp b/mythplugins/mythphone/mythphone/webcam.cpp index 9e345fb..3195f96 100644
a b using namespace std; 31 31 #include "h263.h" 32 32 #include "webcam.h" 33 33 34 #ifdef WIN3235 34 QWidget *wcMainWidget; 35 #ifdef WIN32 36 36 HWND wcMainHwnd; 37 37 #endif 38 38 39 39 Webcam::Webcam(QWidget *parent, QWidget *localVideoWidget) 40 : hDev(0), DevName(""), 41 picbuff1(NULL), imageLen(0), 42 frameSize(0), fps(5), 43 actualFps(fps), killWebcamThread(true), // Leave true whilst its not running 44 wcFormat(0), wcFlip(false), 45 cameraTime(), frameCount(0), 46 totalCaptureMs(0) 40 47 { 41 hDev = 0;42 DevName = "";43 picbuff1 = 0;44 imageLen = 0;45 frameSize = 0;46 fps = 5;47 killWebcamThread = true; // Leave true whilst its not running48 wcFormat = 0;49 wcFlip = false;50 51 #ifndef WIN3252 (void)parent;53 (void)localVideoWidget;54 vCaps.name[0] = 0;55 vCaps.maxwidth = 0;56 vCaps.maxheight = 0;57 vCaps.minwidth = 0;58 vCaps.minheight = 0;59 memset(&vWin, 0, sizeof(struct video_window));60 vWin.width = 0;61 vWin.height = 0;62 vPic.brightness = 0;63 vPic.depth = 0;64 vPic.palette = 0;65 vPic.colour = 0;66 vPic.contrast = 0;67 vPic.hue = 0;68 69 #else70 48 wcMainWidget = parent; 49 #ifdef WIN32 71 50 hwndWebcam = localVideoWidget->winId(); 72 51 wcMainHwnd = hwndCap = capCreateCaptureWindow(NULL, WS_CHILD | WS_VISIBLE, 2, 2, 73 52 localVideoWidget->width()-4, 74 53 localVideoWidget->height()-4, 75 54 hwndWebcam, 1); 76 77 55 capSetCallbackOnVideoStream(hwndCap, frameReadyCallbackProc); 78 56 capSetCallbackOnError(hwndCap, ErrorCallbackProc) ; 79 57 capSetCallbackOnStatus(hwndCap, StatusCallbackProc) ; 80 58 capDriverConnect(hwndCap, 0); 81 59 capSetUserData(hwndCap, (long)this); 82 60 #endif 61 62 #ifdef __linux__ 63 (void)localVideoWidget; 64 bzero(&vCaps, sizeof(vCaps)); 65 bzero(&vWin, sizeof(vWin)); 66 bzero(&vPic, sizeof(vPic)); 67 bzero(&vClips, sizeof(vClips)); 68 #endif 83 69 } 84 70 85 71 -
mythplugins/mythphone/mythphone/webcam.h
diff --git a/mythplugins/mythphone/mythphone/webcam.h b/mythplugins/mythphone/mythphone/webcam.h index 0e66dae..eabc311 100644
a b class WebcamEvent : public QEvent 86 86 public: 87 87 enum Type { FrameReady = (QEvent::User + 200), WebcamErrorEv, WebcamDebugEv }; 88 88 89 WebcamEvent(Type t, wcClient *c) : QEvent((QEvent::Type)t) { client=c; } 90 WebcamEvent(Type t, QString s) : QEvent((QEvent::Type)t) { text=s; } 89 WebcamEvent(Type t, wcClient *c) 90 : QEvent((QEvent::Type)t), client(c), text() { } 91 WebcamEvent(Type t, QString s) 92 : QEvent((QEvent::Type)t), client(NULL), text(s) { } 91 93 ~WebcamEvent() {} 92 94 93 95 wcClient *getClient() { return client; } … … class Webcam : public QThread 151 153 void WebcamThreadWorker(); 152 154 153 155 #ifdef WIN32 154 HWND hwndCap;155 HWND hwndWebcam;156 156 static LRESULT CALLBACK frameReadyCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr); 157 157 static LRESULT CALLBACK ErrorCallbackProc(HWND hWnd, int nErrID, LPSTR lpErrorText); 158 158 static LRESULT CALLBACK StatusCallbackProc(HWND hWnd, int nID, LPSTR lpStatusText); … … class Webcam : public QThread 180 180 int frameCount; 181 181 int totalCaptureMs; 182 182 183 // OS specific data structures183 // OS specific members 184 184 #ifdef WIN32 185 HWND hwndCap; 186 HWND hwndWebcam; 185 187 CAPTUREPARMS capParams; 186 188 BITMAPINFO bitmapInfo; 187 #else 189 #endif 190 191 #ifdef __linux__ 188 192 struct video_capability vCaps; 189 193 struct video_window vWin; 190 194 struct video_picture vPic;
