Mercurial > mplayer.hg
comparison stream/tvi_dshow.c @ 25064:f9a966f36dae
Move setting media format code
closer to connection establishment routine.
author | voroshil |
---|---|
date | Sun, 18 Nov 2007 10:55:51 +0000 |
parents | 29260745e4fa |
children | 54dba785e683 |
comparison
equal
deleted
inserted
replaced
25063:29260745e4fa | 25064:f9a966f36dae |
---|---|
1367 hr = OLE_QUERYINTERFACE(pSGF, IID_ISampleGrabber, pSG); | 1367 hr = OLE_QUERYINTERFACE(pSGF, IID_ISampleGrabber, pSG); |
1368 if(FAILED(hr)){ | 1368 if(FAILED(hr)){ |
1369 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: QueryInterface(IID_ISampleGrabber) call failed. Error:0x%x\n", (unsigned int)hr); | 1369 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: QueryInterface(IID_ISampleGrabber) call failed. Error:0x%x\n", (unsigned int)hr); |
1370 break; | 1370 break; |
1371 } | 1371 } |
1372 // hr = OLE_CALL_ARGS(pSG, SetCallback, (ISampleGrabberCB *) pCSGCB, 1); //we want to receive copy of sample's data | |
1373 hr = OLE_CALL_ARGS(pSG, SetCallback, (ISampleGrabberCB *) priv->pCSGCB, 0); //we want to receive sample | |
1374 | |
1375 if(FAILED(hr)){ | |
1376 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetCallback(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1377 break; | |
1378 } | |
1379 hr = OLE_CALL_ARGS(pSG, SetOneShot, FALSE); //... for all frames | |
1380 if(FAILED(hr)){ | |
1381 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetOneShot(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1382 break; | |
1383 } | |
1384 hr = OLE_CALL_ARGS(pSG, SetBufferSamples, FALSE); //... do not buffer samples in sample grabber | |
1385 if(FAILED(hr)){ | |
1386 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetBufferSamples(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1387 break; | |
1388 } | |
1389 if(priv->tv_param->normalize_audio_chunks && !memcmp(&(arpmt[nFormatProbed]->majortype),&(MEDIATYPE_Audio),16)){ | |
1390 set_buffer_preference(20,(WAVEFORMATEX*)(arpmt[nFormatProbed]->pbFormat),pCapturePin,pSGIn); | |
1391 } | |
1392 | |
1372 hr = OLE_CALL_ARGS(pSG, SetMediaType, arpmt[nFormatProbed]); //set desired mediatype | 1393 hr = OLE_CALL_ARGS(pSG, SetMediaType, arpmt[nFormatProbed]); //set desired mediatype |
1373 if(FAILED(hr)){ | 1394 if(FAILED(hr)){ |
1374 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetMediaType(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | 1395 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetMediaType(pSG) call failed. Error:0x%x\n", (unsigned int)hr); |
1375 break; | 1396 break; |
1376 } | 1397 } |
1377 // hr = OLE_CALL_ARGS(pSG, SetCallback, (ISampleGrabberCB *) pCSGCB, 1); //we want to receive copy of sample's data | |
1378 hr = OLE_CALL_ARGS(pSG, SetCallback, (ISampleGrabberCB *) priv->pCSGCB, 0); //we want to receive sample | |
1379 | |
1380 if(FAILED(hr)){ | |
1381 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetCallback(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1382 break; | |
1383 } | |
1384 hr = OLE_CALL_ARGS(pSG, SetOneShot, FALSE); //... for all frames | |
1385 if(FAILED(hr)){ | |
1386 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetOneShot(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1387 break; | |
1388 } | |
1389 hr = OLE_CALL_ARGS(pSG, SetBufferSamples, FALSE); //... do not buffer samples in sample grabber | |
1390 if(FAILED(hr)){ | |
1391 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetBufferSamples(pSG) call failed. Error:0x%x\n", (unsigned int)hr); | |
1392 break; | |
1393 } | |
1394 OLE_RELEASE_SAFE(pSG); | |
1395 | |
1396 if(priv->tv_param->normalize_audio_chunks && !memcmp(&(arpmt[nFormatProbed]->majortype),&(MEDIATYPE_Audio),16)){ | |
1397 set_buffer_preference(20,(WAVEFORMATEX*)(arpmt[nFormatProbed]->pbFormat),pCapturePin,pSGIn); | |
1398 } | |
1399 | |
1400 /* connecting filters together: VideoCapture --> SampleGrabber */ | 1398 /* connecting filters together: VideoCapture --> SampleGrabber */ |
1401 hr = OLE_CALL_ARGS(priv->pGraph, Connect, pCapturePin, pSGIn); | 1399 hr = OLE_CALL_ARGS(priv->pGraph, Connect, pCapturePin, pSGIn); |
1402 if(FAILED(hr)){ | 1400 if(FAILED(hr)){ |
1403 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: Unable to create pCapturePin<->pSGIn connection. Error:0x%x\n", (unsigned int)hr); | 1401 mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: Unable to create pCapturePin<->pSGIn connection. Error:0x%x\n", (unsigned int)hr); |
1404 break; | 1402 break; |
1405 } | 1403 } |
1404 OLE_RELEASE_SAFE(pSG); | |
1406 | 1405 |
1407 hr = OLE_CALL_ARGS(pCapturePin, ConnectionMediaType, pmt); | 1406 hr = OLE_CALL_ARGS(pCapturePin, ConnectionMediaType, pmt); |
1408 if(FAILED(hr)) | 1407 if(FAILED(hr)) |
1409 { | 1408 { |
1410 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_GetActualMediatypeFailed, (unsigned int)hr); | 1409 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_GetActualMediatypeFailed, (unsigned int)hr); |