张源 a écrit : > > > 2009/7/5 Laurent Tarrisse <[email protected] <mailto:[email protected]>> > > What is the result with this patch ? > > Laurent > > Laurent Tarrisse a écrit : > > 张源 a écrit : > > > >> 2009/7/5 张源 <[email protected] > <mailto:[email protected]> <mailto:[email protected] > <mailto:[email protected]>>> > >> > >> > >> > >> 2009/7/5 Laurent Tarrisse <[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] <mailto:[email protected]>>> > >> > >> Are you using external or internal ffmpeg ? > >> > >> Laurent > >> > >> Laurent Tarrisse a écrit : > >> > 张源 a écrit : > >> > > >> >> 2009/7/4 Laurent Tarrisse <[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] <mailto:[email protected]>> > <mailto:[email protected] <mailto:[email protected]> > >> <mailto:[email protected] <mailto:[email protected]>>>> > >> >> > >> >> Do you know what palettes are supported by your webcam ? > >> >> > >> >> Laurent > >> >> > >> >> 张源 a écrit : > >> >> > > >> >> > > >> >> > 2009/7/2 Laurent Tarrisse <[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] <mailto:[email protected]>> > >> >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> > >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > >> >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>>> > >> >> > > >> >> > Can you make a small test : > >> >> > > >> >> > nmake webcam-test-visu-c > >> >> > > >> >> > ... > >> >> > > >> >> > launch webcam-test-visu-c.exe > >> >> > > >> >> > Is it the same result ? > >> >> > > >> >> > Laurent > >> >> > > >> >> > 张源 a écrit : > >> >> > > > >> >> > > > >> >> > > 2009/7/1 Laurent Tarrisse <[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] <mailto:[email protected]>> > >> >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> > >> >> > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>> > >> >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> > >> >> > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > >> <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>>>> > >> >> > > > >> >> > > Laurent Tarrisse a écrit : > >> >> > > > 张源 a écrit : > >> >> > > > > >> >> > > >> I have built qutecom-2-2-3faed9597730(debug),with vs > >> 2005 on > >> >> > > windows > >> >> > > >> xp Chinese simplified but there are some problems with > >> >> > Qutecom when > >> >> > > >> making a webcam preview or a video call . > >> >> > > >> > >> >> > > >> The problems are as follows: when entering Video > >> settings ,then > >> >> > > click > >> >> > > >> Webcam Preview button ,after a while ,the Label on > >> the right > >> >> > > side just > >> >> > > >> shows a gray rectangle. The Video call is also just > >> shows a > >> >> gray > >> >> > > >> rectangle,and after a while it crashed . > >> >> > > >> Webcam Preview.png (/image/png/) 5K > >> >> > > >> > >> >> > > > >> >> > > >> >> > >> > <?ui=2&ik=ab85a7e087&view=att&th=1223455e9356b51f&attid=0.1&disp=attd> > >> >> > > >> The piximage has been sucessfully catched by > >> WebcamDriver. > >> >> > > >> I found the problem may lie in this code section: > >> >> > > >> pixertool.cpp > >> >> > > >> > >> >> > > >> *...* > >> >> > > >> pixerrorcode* pix_convert*(int flags, piximage * > >> img_dst, > >> >> > > piximage * > >> >> > > >> img_src) { > >> >> > > >> *...* > >> >> > > >> if (*img_convert*(&avp_target, pix_fmt_target, > >> >> > > >> &avp_tmp_target, pix_fmt_source, > >> >> > > >> img_dst->width, img_dst->height) *== -1*) { > >> >> > > >> av_free(buf_tmp_target); > >> >> > > >> return PIX_NOK; > >> >> > > >> } > >> >> > > >> * ...* > >> >> > > >> } > >> >> > > >> > >> >> > > > Can you give me img_src->palette and img_src->dst ? > >> >> > > > > >> >> > > Oups, > >> >> > > > >> >> > > it is img_src->palette and img_dst->palette. > >> >> > > > >> >> > > Laurent > >> >> > > >> *...* > >> >> > > >> when calling * pix_convert*() ,the function > >> *img_convert()* > >> >> > allways > >> >> > > >> return -1 which means the image conversion fails. > >> >> > > >> > >> >> > > >> Has anyone face the same problem ,please help me > >> >> > > >> > >> >> > > >> > >> >> > > > >> >> > > >> >> > >> > ------------------------------------------------------------------------ > >> >> > > >> > >> >> > > >> > >> >> > > > >> >> > > >> >> > >> > ------------------------------------------------------------------------ > >> >> > > >> > >> >> > > >> _______________________________________________ > >> >> > > >> QuteCom-dev mailing list > >> >> > > >> [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>> > >> >> > > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>>> > >> >> > > >> http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> >> > > >> > >> >> > > >> > >> >> > > > > >> >> > > > _______________________________________________ > >> >> > > > QuteCom-dev mailing list > >> >> > > > [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>>> > >> >> > > > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> >> > > > > >> >> > > > >> >> > > _______________________________________________ > >> >> > > QuteCom-dev mailing list > >> >> > > [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> > <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>>> > >> >> > > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> >> > > > >> >> > > > >> >> > > Thank you ! > >> >> > > the functions are called as follows:1――>2――>3 > >> >> > > *1 *void QtVideoSettings::frameCapturedEventHandler > >> >> (IWebcamDriver * > >> >> > > sender, piximage * image) {//重要函数 > >> >> > > > >> >> > > * ...* > >> >> > > QSize qs(_ui->webcamPreviewLabel->width(), > >> >> > > _ui->webcamPreviewLabel->height()); > >> >> > > QImage tmpRgbImage(qs, QImage::Format_RGB32); > >> >> > > *QtVideoQt::convertPixImageToQImage(image, qs, > >> &tmpRgbImage);* > >> >> > > QPixmap tmp = QPixmap::fromImage(tmpRgbImage); > >> >> > > * ...* > >> >> > > > >> >> > > } > >> >> > > *2 * void QtVideoQt::convertPixImageToQImage(piximage* > >> pixImage, > >> >> > const > >> >> > > QSize& size, QImage* image) { > >> >> > > * ...* > >> >> > > piximage resizedPixImage; > >> >> > > resizedPixImage.palette = PIX_OSI_RGB32; > >> >> > > resizedPixImage.width = image->width(); > >> >> > > resizedPixImage.height = image->height(); > >> >> > > resizedPixImage.data = image->bits(); > >> >> > > > >> >> > > * pix_convert(PIX_NO_FLAG, &resizedPixImage, pixImage); > >> >> > > * //测试// > >> >> > > } > >> >> > > > >> >> > > * so the img_dst->palette == PIX_OSI_RGB32 > >> img_src->palette == > >> >> > > PIX_OSI_YUV420P* > >> >> > > *3* pixerrorcode pix_convert(int flags, piximage * img_dst, > >> >> > piximage * > >> >> > > img_src) { > >> >> > > > >> >> > > * ...* > >> >> > > enum PixelFormat pix_fmt_source > >> >> > > =(PixelFormat)pix_ffmpeg_from_pix_osi(img_src->palette); > >> >> > > enum PixelFormat pix_fmt_target = > >> >> > > (PixelFormat)pix_ffmpeg_from_pix_osi(img_dst->palette); > >> >> > > > >> >> > > > >> >> > > *...* > >> >> > > > >> >> > > > >> >> > > #ifndef HAVE_SWSCALE > >> >> > > //TODO optimize this part but will need the preparation of > >> >> contexts > >> >> > > ImgReSampleContext * resample_context = > >> >> > > img_resample_init(img_dst->width, img_dst->height, > >> >> > > img_src->width, img_src->height); > >> >> > > > >> >> > > if (!resample_context) { > >> >> > > return PIX_NOK; > >> >> > > } > >> >> > > > >> >> > > AVPicture avp_tmp_target; > >> >> > > > >> >> > > //we need to prepare a tmp buffer > >> >> > > uint8_t * buf_tmp_target = (uint8_t > >> >> > > *)av_malloc(avpicture_get_size(pix_fmt_source, > >> img_dst->width, > >> >> > > img_dst->height) * sizeof(uint8_t)); > >> >> > > avpicture_fill(&avp_tmp_target, buf_tmp_target, > >> pix_fmt_source, > >> >> > > img_dst->width, img_dst->height); > >> >> > > // > >> >> > > > >> >> > > //do the resampling > >> >> > > img_resample(resample_context, &avp_tmp_target, > >> &avp_source); > >> >> > > img_resample_close(resample_context); > >> >> > > // > >> >> > > > >> >> > > //do the conversion > >> >> > > if (*img_convert*(&avp_target, pix_fmt_target, > >> >> > > &avp_tmp_target, pix_fmt_source, > >> >> > > img_dst->width, img_dst->height) == -1) { > >> >> > > av_free(buf_tmp_target); > >> >> > > return PIX_NOK;//转换没有成功 > >> >> > > } > >> >> > > * ...* > >> >> > > } > >> >> > > *img_dst->palette : PIX_OSI_RGB32* > >> >> > > * img_src->palette : PIX_OSI_YUV420P* > >> >> > > pix_fmt_target : *PIX_FMT_BGR32* > >> >> > > pix_fmt_source : *PIX_FMT_YUV420P* > >> >> > > img_convert()is a function in ffmpeg library,so the > >> problems > >> >> > might be > >> >> > > in parameters passed into it .It involves encoding and > >> decoding > >> >> > which > >> >> > > I totally don't know how to deal with . > >> >> > > Thanks again ! > >> >> > > > >> >> > > > >> >> > > >> >> > _______________________________________________ > >> >> > QuteCom-dev mailing list > >> >> > [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>>> > >> >> > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> >> > > >> >> > > >> >> > > >> >> > Thank you Laurent > >> >> > I have made a small test with webcam-test-visu-c.exe. the > >> >> results are > >> >> > as follows: > >> >> > * <error>15:32:03 [Common] > >> DirectXWebcamDriver::setCaps:failed caps > >> >> > request:(19,15,320,240) > >> >> > > >> >> > Using width:320 ,height:240 FPS:15 > >> >> > **Starting capture... > >> >> > I am called!! > >> >> > frame _captured > >> >> > ..... > >> >> > > >> >> > * > >> >> > * * > >> >> > setCaps error.png (/image/png/) 7K > >> >> > > >> >> > >> > <?ui=2&ik=ab85a7e087&view=att&th=1223a64d4bdb3ee5&attid=0.2&disp=attd> > >> >> > webcam widget.png (/image/png/) 5K > >> >> > > >> >> > >> > <?ui=2&ik=ab85a7e087&view=att&th=1223a64d4bdb3ee5&attid=0.1&disp=attd> > >> >> > The picture still coulid not show on the webcam widget > >> >> > The execution results show below: > >> >> > > >> >> > DirectXWebcamDriver .cpp > >> >> > * ...* > >> >> > ** > >> >> > WebcamErrorCode DirectXWebcamDriver::setDevice(const > >> std::string & > >> >> > deviceName) { > >> >> > > >> >> > //TODO: test if a webcam is already open > >> >> > //TODO: refactor the COM initialization phase to avoid > >> >> > //multiple initalisations and better handle unitialization > >> >> > //cf trac ticket #1008 > >> >> > // We really need to refactor that point > >> >> > // I leave this line here just because the phapi thread > >> >> > // must call this function (one time). We must move this > >> >> elsewhere ... > >> >> > CoInitialize(NULL); > >> >> > //// > >> >> > _pGraph.CoCreateInstance(CLSID_FilterGraph); > >> >> > if (!_pGraph) { > >> >> > LOG_ERROR("failed to create Graph builder"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > _pBuild.CoCreateInstance(CLSID_CaptureGraphBuilder2); > >> >> > if (!_pBuild) { > >> >> > LOG_ERROR("failed to create Capture Graph builder"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > _pBuild->SetFiltergraph(_pGraph); > >> >> > //Create the Sample Grabber > >> >> > HRESULT hr = CoCreateInstance(CLSID_SampleGrabber, NULL, > >> >> > CLSCTX_INPROC_SERVER, IID_IBaseFilter, > >> (void**)&(_pGrabberF)); > >> >> > if (hr != S_OK) { > >> >> > LOG_ERROR("failed to create COM instance"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > //Add the filter to the graph > >> >> > hr = (_pGraph)->AddFilter(_pGrabberF, L"Sample Grabber"); > >> >> > if (hr != S_OK) { > >> >> > LOG_ERROR("failed to add filter"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > //Query the Sample Grabber for the ISampleGrabber interface. > >> >> > _pGrabberF->QueryInterface(IID_ISampleGrabber, > >> (void**)&_pGrabber); > >> >> > hr = _pGrabber->SetBufferSamples(FALSE); > >> >> > hr = _pGrabber->SetOneShot(FALSE); > >> >> > //Set the Sample Grabber callback > >> >> > //0: SampleCB (the buffer is the original buffer, not a copy) > >> >> > //1: BufferCB (the buffer is a copy of the original buffer) > >> >> > if (_pGrabber->SetCallback(this, 0) != S_OK) { > >> >> > LOG_ERROR("failed to assign callback"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > CComBSTR bstrName(deviceName.c_str()); > >> >> > hr = FindMyCaptureDevice(&_pCap, bstrName); > >> >> > if ((hr != S_OK) || !_pCap) { > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > //initialize IAMStreamConfig > >> >> > _iam = GetIAMStreamConfig(_pCap); > >> >> > if (!_iam) { > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > //add the capture filter to the graph > >> >> > hr = (_pGraph)->AddFilter(_pCap, L""); > >> >> > if (hr != S_OK) { > >> >> > LOG_ERROR("failed to add filter"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > //Add a null renderer filter > >> >> > hr = CoCreateInstance(CLSID_NullRenderer, NULL, > >> >> > CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&_pNull); > >> >> > hr = (_pGraph)->AddFilter(_pNull, L"NullRender"); > >> >> > _pBuild->RenderStream(&PIN_CATEGORY_CAPTURE, NULL, _pCap, > >> NULL, > >> >> > _pGrabberF); > >> >> > //try to assign some palette until the webcam supports it > >> >> > if (*setCaps*(PIX_OSI_YUV420P, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_YUV420P, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_I420, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_I420, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB32, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB32, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB24, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB24, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_YUV422, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_YUV422, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB565, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB565, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB555, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_RGB555, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_YUY2, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_YUY2, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_UYVY, _cachedFPS, 176, 144) != > >> WEBCAM_OK) { > >> >> > if (*setCaps*(PIX_OSI_UYVY, _cachedFPS, 160, 120) != > >> WEBCAM_OK) { > >> >> > }}}}}}}}}}}}}}}}}} > >> >> > ** > >> >> > *all of the 18 "if(setCaps(...)!=WEBCAM_OK)" above are > >> executed > >> >> > .That's to say all the 18 " setCaps() " return WEBCAM_NOK;* > >> >> > ** > >> >> > ** > >> >> > *readCaps();* > >> >> > if (getPalette() == PIX_OSI_UNSUPPORTED) { > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > _isOpen = true; > >> >> > return WEBCAM_OK; > >> >> > > >> >> > } > >> >> > WebcamErrorCode DirectXWebcamDriver::setCaps(pixosi palette, > >> >> unsigned > >> >> > fps, unsigned resolutionWidth, unsigned resolutionHeight) { > >> >> > _cachedFPS = fps; > >> >> > > >> >> > if (!isOpen()) { > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > > >> >> > if (!_pCap) { > >> >> > LOG_FATAL("webcam not initialized"); > >> >> > } > >> >> > if (!_iam) { > >> >> > LOG_FATAL("webcam not initialized"); > >> >> > } > >> >> > > >> >> > int iCount, iSize; > >> >> > HRESULT hr = _iam->GetNumberOfCapabilities(&iCount, &iSize); > >> >> > > >> >> > VIDEO_STREAM_CONFIG_CAPS scc; > >> >> > if (sizeof(scc) != iSize) { > >> >> > LOG_ERROR("wrong config structure"); > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > > >> >> > for (int i = 0; i < iCount; i++) { > >> >> > AM_MEDIA_TYPE * pmt = NULL; > >> >> > hr = _iam->GetStreamCaps(i, &pmt, reinterpret_cast<BYTE > >> *>(&scc)); > >> >> > if (hr == S_OK) { > >> >> > pixosi wc_palette = pix_directx_to_pix_osi(pmt->subtype); > >> >> > if (wc_palette != palette) { > >> >> > hr = E_FAIL; > >> >> > continue; > >> >> > } > >> >> > VIDEOINFOHEADER * pvi = (VIDEOINFOHEADER *) pmt->pbFormat; > >> >> > pvi->bmiHeader.biWidth = resolutionWidth; > >> >> > pvi->bmiHeader.biHeight = resolutionHeight; > >> >> > pvi->AvgTimePerFrame = (LONGLONG) (10000000. / (double)fps); > >> >> > hr = _iam->SetFormat(pmt); > >> >> > if (hr != S_OK) { > >> >> > hr = E_FAIL; > >> >> > continue; > >> >> > } else { > >> >> > LOG_DEBUG("assigned caps : (" > >> >> > + String::fromNumber(palette) > >> >> > + "," + String::fromNumber(fps) > >> >> > + "," + String::fromNumber(resolutionWidth) > >> >> > + "," + String::fromNumber(resolutionHeight) > >> >> > + ")"); > >> >> > break; > >> >> > } > >> >> > } > >> >> > } > >> >> > > >> >> > readCaps(); > >> >> > > >> >> > if (hr == S_OK) { > >> >> > return WEBCAM_OK; > >> >> > } > >> >> > > >> >> > *LOG_ERROR("failed caps request: (" > >> >> > + String::fromNumber(palette) > >> >> > + "," + String::fromNumber(fps) > >> >> > + "," + String::fromNumber(resolutionWidth) > >> >> > + "," + String::fromNumber(resolutionHeight) > >> >> > + ")");* > >> >> > > >> >> > *error occured , I am trying to figure out which function > >> >> > (DirectXWebcamDriver::setResolution() or > >> >> > DirectXWebcamDriver::setPalette() or others)calling setCaps() > >> >> results > >> >> > in this error * > >> >> > > >> >> > > >> >> > return WEBCAM_NOK; > >> >> > } > >> >> > void DirectXWebcamDriver::*readCaps*() { > >> >> > > >> >> > VIDEOINFOHEADER * pvi; > >> >> > pixosi palette; > >> >> > AM_MEDIA_TYPE * pmt = NULL; > >> >> > HRESULT hr = _iam->GetFormat(&pmt); > >> >> > if (pmt->formattype == FORMAT_VideoInfo) { > >> >> > pvi = (VIDEOINFOHEADER *) pmt->pbFormat; > >> >> > palette = pix_directx_to_pix_osi(pmt->subtype); > >> >> > } > >> >> > _cachedPalette = palette; > >> >> > _cachedWidth = pvi->bmiHeader.biWidth; > >> >> > _cachedHeight = pvi->bmiHeader.biHeight; > >> >> > > >> >> > > >> >> > } > >> >> > > >> >> > > >> >> > > >> >> > >> > ------------------------------------------------------------------------ > >> >> > > >> >> > > >> >> > > >> >> > >> > ------------------------------------------------------------------------ > >> >> > > >> >> > >> >> _______________________________________________ > >> >> QuteCom-dev mailing list > >> >> [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> <mailto:[email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>>> > >> >> http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> Thank you very much > >> >> > >> >> > >> >> /********************************** > >> >> webcam/DirectXWebcamDriver.cpp******************************/ > >> >> > >> >> WebcamErrorCode DirectXWebcamDriver::setCaps(pixosi > >> palette, unsigned > >> >> fps, unsigned resolutionWidth, unsigned resolutionHeight) { > >> >> * ...* > >> >> if (sizeof(scc) != iSize) { > >> >> LOG_ERROR("wrong config structure"); > >> >> return WEBCAM_NOK; > >> >> } > >> >> > >> >> for (int i = 0; i < iCount; i++) { > >> >> AM_MEDIA_TYPE * pmt = NULL; > >> >> hr = _iam->GetStreamCaps(i, *&pmt*, reinterpret_cast<BYTE > >> >> *>(&scc));//i 为 6 时 > >> >> if (hr == S_OK) { > >> >> pixosi wc_palette =* pix_directx_to_pix_osi*(pmt->subtype); > >> >> if (wc_palette != palette) { > >> >> hr = E_FAIL; > >> >> continue; > >> >> } > >> >> ... > >> >> } > >> >> > >> >> > >> >> > >> > > /**********************************pixertool/directx-pixertool.h***************************************/ > >> >> > >> >> pixosi *pix_directx_to_pix_os**i*(GUID *pix*) { > >> >> register unsigned i; > >> >> pixosi palette = PIX_OSI_UNSUPPORTED; > >> >> > >> >> for (i = 0; i < sizeof(_ms_table) / sizeof(pixms_pixosi); > >> i++) { > >> >> if (memcmp(&_ms_table[i].pix_ms, &pix, sizeof(GUID)) == 0) { > >> >> palette = _ms_table[i].pix_osi; > >> >> break; > >> >> } > >> >> } > >> >> return *palette*; > >> >> } > >> >> > >> >> > >> >> I have debug the *pix_directx_to_pix_osi*(GUID pix) many > >> times,and > >> >> found my > >> >> webcam only supports the following two palettes : > >> >> *1,{ MEDIASUBTYPE_RGB24, PIX_OSI_RGB24 }* > >> >> ( *21* in enum pixosi) > >> >> *2,{ OUR_MEDIASUBTYPE_I420, PIX_OSI_YUV420P }* > >> >> ( *0 * in enum* *pixosi) > >> >> > >> >> This can be used to expalain the error : > >> >> > >> >>> I have made a small test with webcam-test-visu-c.exe. the > >> results are > >> >>> as follows: > >> >>> * <error>15:32:03 [Common] DirectXWebcamDriver::setCaps: > >> >>> > >> >> failed caps > >> >> > >> >>> request:(*19*,15,320,240) > >> >>> > >> >> My webcam* does't support { MEDIASUBTYPE_RGB32, > >> PIX_OSI_RGB32 }* > >> >> (*19* in enum pixosi) > >> >> *,resulting image conversion failure:* > >> >> > >> >> > >> >> void QtVideoQt::convertPixImageToQImage(piximage* pixImage, > >> const > >> >> QSize& size, QImage* image) { > >> >> Q_ASSERT(image); > >> >> > >> >> if (image->size() != size || image->format() !=* > >> QImage::Format_RGB32*) { > >> >> *image = QImage(size, QImage::*Format_RGB32*); > >> >> } > >> >> > >> >> > >> >> resizedPixImage.palette = *PIX_OSI_RGB32*; //* error!, my > >> webcam > >> >> dosen't support * > >> >> > >> > Ok you're webcam doesn't support PIX_OSI_RGB32* > >> > *But here you're webcam is not engaged : > >> > I mean, convertPixImageToQImage will convert pixImage to > >> QImage without > >> > access to webcam driver ... > >> > If you're pixImage format is not PIX_OSI_RGB32 it will be > >> converted with > >> > ffmpeg* > >> > * > >> > > >> >> resizedPixImage.width = image->width(); > >> >> resizedPixImage.height = image->height(); > >> >> resizedPixImage.data = image->bits(); > >> >> > >> >> *pix_convert*(PIX_NO_FLAG, &resizedPixImage, pixImage); > >> >> //测试// > >> >> > >> >> > >> >> } > >> >> pixertool.cpp > >> >> > >> >> * ...* > >> >> pixerrorcode* pix_convert*(int flags, piximage * img_dst, > >> piximage * > >> >> img_src) { > >> >> *...* > >> >> if (*img_convert*(&avp_target, pix_fmt_target, > >> >> &avp_tmp_target, pix_fmt_source, > >> >> img_dst->width, img_dst->height) *== -1*) { > >> >> av_free(buf_tmp_target); > >> >> return PIX_NOK; // *img _convert () failure*, *always > >> return PIX_NOK* > >> >> } > >> >> * ...* > >> >> } > >> >> * ...* > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> I have just changed "resizedPixImage.palette = > >> PIX_OSI_RGB*32" * to* > >> >> *resizedPixImage.palette = PIX_OSI_RGB*24 > >> >> and now ,the video can show on the Label widget ,However, > >> the picture > >> >> showed on the label is not clear and overlapped *Webcam > >> Preview.png > >> >> (/image/png/) 39K > >> >> > >> > > <http://?ui=2&ik=ab85a7e087&view=att&th=122461d06b4f0e4c&attid=0.1&disp=attd> > >> >> > >> >> > >> >> Clearly ,the problem resulted from the following conflicts > >> :GUI shows > >> >> QImage(size, QImage::*Format_RGB32*) while the converted > >> picture is > >> >> RGB*24*, it conflicts .My Qt library version is 4.3.2,amd > >> Qt don't > >> >> support QImage::Format_RGB888 until version 4.4 > >> >> > >> > I think there is something wrong with format value of > >> piximage in > >> > convertPixImageToQImage() > >> > Can you verify that pixImage->palette in > >> convertPixImageToQImage() is > >> > equal to PIX_OSI_RGB24 ?* > >> > * > >> > > >> >> what makes me puzzled is that: I have downloaded Qutecom > >> release > >> >> version on my computer ,installed it ,and the Qutecom > >> workeds well, > >> >> the video workes well,everything is ok.but when i compiled > >> the source > >> >> code ,the debug version faced the problem mentioned previously. > >> >> > >> >> It makes me puzzled . My webcam dosen't support *PIX_OSI_RGB32: > >> >> * > >> >> * Is it due to my DirectX library or windows server > >> platform SDK?* > >> >> * > >> >> Does QImage::Format_RGB888 equal to RGB24? if true, I would > >> rather > >> >> compile a higher Qt version to make Qt support > >> QImage::Format_ RGB24 > >> >> Would you please give me some other guidance *, *thanks > >> again! * > >> >> > >> >> > >> >> > >> >> > >> >> > >> > ------------------------------------------------------------------------ > >> >> > >> >> > >> > > >> > _______________________________________________ > >> > QuteCom-dev mailing list > >> > [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> > > >> > >> _______________________________________________ > >> QuteCom-dev mailing list > >> [email protected] > <mailto:[email protected]> > >> <mailto:[email protected] > <mailto:[email protected]>> > >> http://lists.qutecom.org/mailman/listinfo/qutecom-dev > >> > >> > >> > >> I think "convertPixImageToQImage will convert pixImage to QImage > >> without > >> access to webcam driver ..." is true ,but i have no other > >> explanations > >> i use ffmpeg in qutecom project > >> > >> > >> What is the difference between external or internal ffmpeg ?I don't > >> know this concept .I din't change any thing with ffmpeg in qutecom > >> project > >> > >> > > If you have changed nothing : you are using internal ffmpeg. > > I'm preparing a patch for you it will ready in few minutes ... > > > > Laurent > > _______________________________________________ > > QuteCom-dev mailing list > > [email protected] <mailto:[email protected]> > > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > > > > > diff -r 88ae1e6d0e25 libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c > --- a/libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c Sat May 16 > 03:50:06 2009 +0200 > +++ b/libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c Sun Jul 05 > 08:31:51 2009 +0200 > @@ -53,7 +53,7 @@ > case PIX_FMT_RGB565: > palette = PIX_OSI_RGB565; > break; > - case PIX_FMT_RGBA: > + case PIX_FMT_RGBA32: > palette = PIX_OSI_RGBA32; > break; > case PIX_FMT_YUV420P: > @@ -62,7 +62,7 @@ > case PIX_FMT_YUV422P: > palette = PIX_OSI_YUV422P; > break; > - case PIX_FMT_YUYV422: > + case PIX_FMT_YUV422: > palette = PIX_OSI_YUY2; > break; > case PIX_FMT_YUV444P: > @@ -98,7 +98,7 @@ > case PIX_OSI_ARGB32: > case PIX_OSI_RGB32: > case PIX_OSI_RGBA32: > - palette = PIX_FMT_RGBA; > + palette = PIX_FMT_RGBA32; > break; > case PIX_OSI_YUV420P: > palette = PIX_FMT_YUV420P; > @@ -112,7 +112,7 @@ > case PIX_OSI_YUV422: > case PIX_OSI_YUYV: > case PIX_OSI_YUY2: > - palette = PIX_FMT_YUYV422; > + palette = PIX_FMT_YUV422; > break; > /* DOES not compile on MacOS X with current version of fink/ffmpeg > (11/9/2006) > case PIX_OSI_UYVY: > > _______________________________________________ > QuteCom-dev mailing list > [email protected] <mailto:[email protected]> > http://lists.qutecom.org/mailman/listinfo/qutecom-dev > > > It works ,it's OK > Thank you Laurent > I want to commit a patch on the repository but my previous is not correct. it works only with old ffmpeg.
Can you check this one ? I want to be sure it is ok before commit. Laurent
# HG changeset patch # User Laurent Tarrisse <[email protected]> # Date 1246783100 -7200 # Node ID ef3e9c185beb544fc4b15b26eab1dda7261b964b # Parent 88ae1e6d0e251d12f6309a00e716e9fef0648d0a bug fix : libavutil define diff -r 88ae1e6d0e25 -r ef3e9c185beb libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c --- a/libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c Sat May 16 03:50:06 2009 +0200 +++ b/libs/pixertool/src/ffmpeg/ffmpeg-pixertool.c Sun Jul 05 10:38:20 2009 +0200 @@ -53,7 +53,11 @@ case PIX_FMT_RGB565: palette = PIX_OSI_RGB565; break; +#if LIBAVUTIL_VERSION_INT < (50<<16) + case PIX_FMT_RGB32: +#else case PIX_FMT_RGBA: +#endif palette = PIX_OSI_RGBA32; break; case PIX_FMT_YUV420P: @@ -98,7 +102,11 @@ case PIX_OSI_ARGB32: case PIX_OSI_RGB32: case PIX_OSI_RGBA32: +#if LIBAVUTIL_VERSION_INT < (50<<16) + palette = PIX_FMT_RGBA32; +#else palette = PIX_FMT_RGBA; +#endif break; case PIX_OSI_YUV420P: palette = PIX_FMT_YUV420P;
_______________________________________________ QuteCom-dev mailing list [email protected] http://lists.qutecom.org/mailman/listinfo/qutecom-dev
