Mercurial > mplayer.hg
changeset 25084:f72ebba1e6d1
pass chain structure instead of several variables to build_sub_graph
author | voroshil |
---|---|
date | Mon, 19 Nov 2007 19:33:53 +0000 |
parents | b0f91db30cb2 |
children | da7c8d1b7a36 |
files | stream/tvi_dshow.c |
diffstat | 1 files changed, 16 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/tvi_dshow.c Mon Nov 19 19:25:25 2007 +0000 +++ b/stream/tvi_dshow.c Mon Nov 19 19:33:53 2007 +0000 @@ -1302,10 +1302,7 @@ * * \note routine does not frees memory, allocated for grabber_rinbuffer_s structure */ -static HRESULT build_sub_graph(priv_t * priv, IBaseFilter * pCaptureFilter, - grabber_ringbuffer_t * pbuf, - AM_MEDIA_TYPE ** arpmt, - AM_MEDIA_TYPE* pmt, const GUID* ppin_category) +static HRESULT build_sub_graph(priv_t * priv, chain_t * chain, const GUID* ppin_category) { HRESULT hr; int nFormatProbed = 0; @@ -1323,14 +1320,14 @@ hr=S_OK; //No supported formats - if(!arpmt[0]) + if(!chain->arpmt[0]) return E_FAIL; do{ hr = OLE_CALL_ARGS(priv->pBuilder, FindPin, - (IUnknown *) pCaptureFilter, + (IUnknown *) chain->pCaptureFilter, PINDIR_OUTPUT, ppin_category, - &(arpmt[nFormatProbed]->majortype), FALSE, 0, &pCapturePin); + chain->majortype, FALSE, 0, &pCapturePin); if(FAILED(hr)){ mp_msg(MSGT_TV,MSGL_DBG2, "tvi_dshow: FindPin(pCapturePin) call failed. Error:0x%x\n", (unsigned int)hr); break; @@ -1358,7 +1355,7 @@ } /* creating ringbuffer for video samples */ - priv->pCSGCB = CSampleGrabberCB_Create(pbuf); + priv->pCSGCB = CSampleGrabberCB_Create(chain->rbuf); if(!priv->pCSGCB){ mp_msg(MSGT_TV,MSGL_DBG2, "tvi_dshow: CSampleGrabberCB_Create(pbuf) call failed. Error:0x%x\n", (unsigned int)E_OUTOFMEMORY); break; @@ -1387,14 +1384,15 @@ mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetBufferSamples(pSG) call failed. Error:0x%x\n", (unsigned int)hr); break; } - if(priv->tv_param->normalize_audio_chunks && !memcmp(&(arpmt[nFormatProbed]->majortype),&(MEDIATYPE_Audio),16)){ - set_buffer_preference(20,(WAVEFORMATEX*)(arpmt[nFormatProbed]->pbFormat),pCapturePin,pSGIn); + + if(priv->tv_param->normalize_audio_chunks && chain->type==audio){ + set_buffer_preference(20,(WAVEFORMATEX*)(chain->arpmt[nFormatProbed]->pbFormat),pCapturePin,pSGIn); } - for(nFormatProbed=0; arpmt[nFormatProbed]; nFormatProbed++) + for(nFormatProbed=0; chain->arpmt[nFormatProbed]; nFormatProbed++) { - DisplayMediaType("Probing format", arpmt[nFormatProbed]); - hr = OLE_CALL_ARGS(pSG, SetMediaType, arpmt[nFormatProbed]); //set desired mediatype + DisplayMediaType("Probing format", chain->arpmt[nFormatProbed]); + hr = OLE_CALL_ARGS(pSG, SetMediaType, chain->arpmt[nFormatProbed]); //set desired mediatype if(FAILED(hr)){ mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetMediaType(pSG) call failed. Error:0x%x\n", (unsigned int)hr); continue; @@ -1409,14 +1407,14 @@ } OLE_RELEASE_SAFE(pSG); - if(!arpmt[nFormatProbed]) + if(!chain->arpmt[nFormatProbed]) { mp_msg(MSGT_TV, MSGL_WARN, "tvi_dshow: Unable to negotiate media format\n"); hr = E_FAIL; break; } - hr = OLE_CALL_ARGS(pCapturePin, ConnectionMediaType, pmt); + hr = OLE_CALL_ARGS(pCapturePin, ConnectionMediaType, chain->pmt); if(FAILED(hr)) { mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_GetActualMediatypeFailed, (unsigned int)hr); @@ -2456,7 +2454,7 @@ } priv->chains[0]->rbuf->buffersize *= 1024 * 1024; - hr=build_sub_graph(priv, priv->chains[0]->pCaptureFilter, priv->chains[0]->rbuf, priv->chains[0]->arpmt, priv->chains[0]->pmt, &PIN_CATEGORY_CAPTURE); + hr=build_sub_graph(priv, priv->chains[0], &PIN_CATEGORY_CAPTURE); if(FAILED(hr)){ mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildVideoSubGraph,(unsigned int)hr); return hr; @@ -2499,7 +2497,7 @@ (((VIDEOINFOHEADER *) priv->chains[0]->pmt->pbFormat)->dwBitRate), (((WAVEFORMATEX *) (priv->chains[1]->pmt->pbFormat))->nAvgBytesPerSec)); - hr=build_sub_graph(priv, priv->chains[1]->pCaptureFilter, priv->chains[1]->rbuf,priv->chains[1]->arpmt,priv->chains[1]->pmt,&PIN_CATEGORY_CAPTURE); + hr=build_sub_graph(priv, priv->chains[1],&PIN_CATEGORY_CAPTURE); if(FAILED(hr)){ mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildAudioSubGraph,(unsigned int)hr); return 0; @@ -2530,7 +2528,7 @@ init_ringbuffer(priv->chains[2]->rbuf,24,priv->tsp.bufsize); - hr=build_sub_graph(priv, priv->chains[0]->pCaptureFilter, priv->chains[2]->rbuf,priv->chains[2]->arpmt,NULL,&PIN_CATEGORY_VBI); + hr=build_sub_graph(priv, priv->chains[2],&PIN_CATEGORY_VBI); if(FAILED(hr)){ mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildVBISubGraph,(unsigned int)hr); return 0;