📄 options.cxx
字号:
} returnVal = grabber->SetColourFormatConverter("YUV420P"); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::FrameRateChange(int newFrameRate){ return FrameRateChange();}BOOL VideoOptions::FrameRateChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetFrameRate(0); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::FrameSizeChange(BOOL newUseLargeSize){ useLargeSize = newUseLargeSize; return FrameSizeChange();}BOOL VideoOptions::FrameSizeChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } unsigned newFrameWidth,newFrameHeight; GetVideoFrameSizeSetting(newFrameWidth, newFrameHeight); returnVal = grabber->SetFrameSizeConverter(newFrameWidth, newFrameHeight, FALSE); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::LocalVideoOrientationChange(BOOL newFlipLocal){ flipLocal = newFlipLocal; return LocalVideoOrientationChange();}BOOL VideoOptions::LocalVideoOrientationChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoOutputDevice * player = txChannel->GetVideoPlayer(); if (player == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = player->SetVFlipState(flipLocal); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::ReceivedVideoOrientationChange(BOOL newFlipReceived){ flipReceived = newFlipReceived; return ReceivedVideoOrientationChange();}BOOL VideoOptions::ReceivedVideoOrientationChange(){ int returnVal = TRUE; rxChannel->RestrictAccess(); PVideoOutputDevice * player = rxChannel->GetVideoPlayer(); if (player == NULL) { rxChannel->EnableAccess(); return FALSE; } returnVal = player->SetVFlipState(flipReceived); rxChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::BrightnessChange(int newBrightness){ brightness = newBrightness; return BrightnessChange();}BOOL VideoOptions::BrightnessChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetBrightness(brightness); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::ColourChange(int newColour){ colour = newColour; return ColourChange();}BOOL VideoOptions::ColourChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetColour(colour); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::ContrastChange(int newContrast){ contrast = newContrast; return ContrastChange();}BOOL VideoOptions::ContrastChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetContrast(contrast); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::HueChange(int newHue){ hue = newHue; return HueChange();}BOOL VideoOptions::HueChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetHue(hue); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::WhitenessChange(int newWhiteness){ whiteness = newWhiteness; return WhitenessChange();}BOOL VideoOptions::WhitenessChange(){ int returnVal = TRUE; txChannel->RestrictAccess(); PVideoInputDevice * grabber = txChannel->GetVideoReader(); if (grabber == NULL) { txChannel->EnableAccess(); return FALSE; } returnVal = grabber->SetWhiteness(whiteness); txChannel->EnableAccess(); return returnVal;}BOOL VideoOptions::DisplayLocalChange(BOOL newDisplayLocal){ displayLocal = newDisplayLocal; return DisplayLocalChange();}BOOL VideoOptions::DisplayLocalChange(){ return CPhone::GetUi().DisplayLocalIsNow(displayLocal);}BOOL VideoOptions::TransmitQualityChange(int newTxQuality){ transmitQuality = newTxQuality; return TransmitQualityChange();}BOOL VideoOptions::TransmitQualityChange(){ if (codec != NULL) codec->SetTxQualityLevel(transmitQuality); return TRUE;}BOOL VideoOptions::ReceivedQualityChange(int newRxQuality){ receiveQuality = newRxQuality; return ReceivedQualityChange();}BOOL VideoOptions::ReceivedQualityChange(){ int returnVal = TRUE; return returnVal;}BOOL VideoOptions::AttachPlayerReaderToVideoChannel(BOOL isEncoding){ return CPhone::GetUi().AttachPlayerReaderToVideoChannel(isEncoding);}PVideoInputDevice *VideoOptions::GetNewVideoGrabber(){ PVideoInputDevice * grabber = NULL; PString errMessage = ""; unsigned newFrameWidth,newFrameHeight; GetVideoFrameSizeSetting(newFrameWidth, newFrameHeight); if(videoDevice == "fake") grabber = new PFakeVideoInputDevice(); else grabber = new PVideoInputDevice(); if (!grabber->Open(videoDevice, FALSE)) { errMessage = "Failed to open the camera device " + videoDevice; goto errVideo; } if (!grabber->SetVideoFormat(palFormat ? PVideoDevice::PAL : PVideoDevice::NTSC)) { errMessage = PString("Failed to set format to ") + PString(palFormat ? "PAL" : "NTSC" ); goto errVideo; } if (!grabber->SetChannel(inputChannel)) { errMessage = PString("Failed to set channel to ") + PString(inputChannel); goto errVideo; } if (!grabber->SetColourFormatConverter("YUV420P") ) { errMessage = PString("Failed to set format to yuv420P"); goto errVideo; } if (!grabber->SetFrameRate(0)) { errMessage = PString("Failed to set framerate to default"); goto errVideo; } if (!grabber->SetFrameSizeConverter(newFrameWidth, newFrameHeight, FALSE) ) { errMessage = PString("Failed to set framesize to ") + PString(newFrameWidth) + PString("x") + PString(newFrameHeight); goto errVideo; } goto exitVideo; errVideo: delete grabber; grabber = new PTextVideoInputDevice("No Video"); grabber->SetColourFormatConverter("YUV420P"); CPhone::GetUi().DisplayMessage(errMessage); exitVideo: grabber->Start(); return grabber;}int VideoOptions::GetBrightness(){ return brightness;}int VideoOptions::GetColour(){ return colour;}int VideoOptions::GetContrast(){ return contrast;}int VideoOptions::GetHue(){ return hue;}int VideoOptions::GetWhiteness(){ return whiteness;} int VideoOptions::GetInputChannel(){ return inputChannel;}int VideoOptions::GetReceiveQuality(){ return receiveQuality;}int VideoOptions::GetTransmitQuality(){ return transmitQuality;}BOOL VideoOptions::GetPalFormat(){ return palFormat;}BOOL VideoOptions::GetNtscFormat(){ return ntscFormat;} BOOL VideoOptions::GetUseLargeSize(){ return useLargeSize;} BOOL VideoOptions::GetDisplayLocal(){ return displayLocal;}BOOL VideoOptions::GetFlipLocal(){ return flipLocal;}BOOL VideoOptions::GetFlipReceived(){ return flipReceived;}PString VideoOptions::GetVideoDevice(){ return videoDevice;}void VideoOptions::AttachVideoCodec(H323VideoCodec *newCodec){ codec = newCodec; }PStringList VideoOptions::GetRealVideoDevices(){ return realVideoDevices;}PStringList VideoOptions::GetFakeVideoDevices(){ return fakeVideoDevices;}PStringList VideoOptions::GetAllVideoDevices(){ return fakeVideoDevices + realVideoDevices;}void VideoOptions::PrintOn(ostream & strm) const{ strm << "-------------------------------------------------------" << endl << "Brightness is " << brightness << endl << "Colour is " << colour << endl << "Contrast is " << contrast << endl << "Hue is " << hue << endl << "Whiteness is " << whiteness << endl << endl << "Input Channel is " << inputChannel << endl << "Receive Quality is " << receiveQuality << endl << "Transmit Quality is " << transmitQuality << endl << endl << "pal format is " << palFormat <<endl << "ntsc format is " << ntscFormat<<endl << endl << "Use Large Size is " << useLargeSize << endl << "display Local image is " << displayLocal << endl << endl << "flip Local image is " << flipLocal << endl << "Flip Received image is " << flipReceived << endl << "Video Grab device is " << videoDevice << endl << "-------------------------------------------------------" << endl;}////////////////////////////////////////////////////////////////////LocalVideoDisplayThread::LocalVideoDisplayThread(CpVideoChannel *vChannel) : PThread(1000, NoAutoDeleteThread){ localVideoChannel = vChannel; Resume();}void LocalVideoDisplayThread::InitiateTermination(){ exitFlag.Signal();}void LocalVideoDisplayThread::Main(){ uchar *videoBuffer = new u_char[352 * 288 * 4]; while (exitFlag.WillBlock()) { PThread::Current()->Sleep(50); localVideoChannel->DisplayRawData(videoBuffer); } delete videoBuffer;} // End of File ///////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -