diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-19 19:45:01 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-19 19:45:01 +0000 |
commit | 423882fe73912b2f0987ebba8d8135fb656db235 (patch) | |
tree | adf9bb137df4f4a3a6ade262a58cd52fa19c8f7a /stream | |
parent | 54203fe1d13618c761a431b6c0834def0821d3b4 (diff) |
Move common chain uninit code into separate routine.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25113 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/tvi_dshow.c | 90 |
1 files changed, 38 insertions, 52 deletions
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index bffc6eca77..13e39575b6 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -2938,6 +2938,43 @@ static int init(priv_t * priv) } /** + * \brief chain uninitialization + * \param chain chain data structure + */ +static void destroy_chain(chain_t *chain) +{ + int i; + + if(!chain) + return; + + OLE_RELEASE_SAFE(chain->pStreamConfig); + OLE_RELEASE_SAFE(chain->pCaptureFilter); + if (chain->pmt) + DeleteMediaType(chain->pmt); + + if (chain->arpmt) { + for (i = 0; chain->arpmt[i]; i++) { + DeleteMediaType(chain->arpmt[i]); + } + free(chain->arpmt); + } + + if (chain->arStreamCaps) { + for (i = 0; chain->arStreamCaps[i]; i++) { + free(chain->arStreamCaps[i]); + } + free(chain->arStreamCaps); + } + + if (chain->rbuf) { + destroy_ringbuffer(chain->rbuf); + free(chain->rbuf); + chain->rbuf = NULL; + } + free(chain); +} +/** * \brief driver uninitialization * * \param priv driver's private data structure @@ -2971,61 +3008,11 @@ static int uninit(priv_t * priv) OLE_CALL_ARGS(priv->pGraph, RemoveFilter, priv->chains[1]->pCaptureFilter); } OLE_RELEASE_SAFE(priv->pCrossbar); - OLE_RELEASE_SAFE(priv->chains[0]->pStreamConfig); - OLE_RELEASE_SAFE(priv->chains[1]->pStreamConfig); OLE_RELEASE_SAFE(priv->pVideoProcAmp); - OLE_RELEASE_SAFE(priv->chains[0]->pCaptureFilter); - OLE_RELEASE_SAFE(priv->chains[1]->pCaptureFilter); OLE_RELEASE_SAFE(priv->pGraph); OLE_RELEASE_SAFE(priv->pBuilder); OLE_RELEASE_SAFE(priv->pCSGCB); - if (priv->chains[0]->pmt) - DeleteMediaType(priv->chains[0]->pmt); - if (priv->chains[1]->pmt) - DeleteMediaType(priv->chains[1]->pmt); - if (priv->chains[2]->pmt) - DeleteMediaType(priv->chains[2]->pmt); - - if (priv->chains[0]->arpmt) { - for (i = 0; priv->chains[0]->arpmt[i]; i++) { - DeleteMediaType(priv->chains[0]->arpmt[i]); - } - free(priv->chains[0]->arpmt); - } - if (priv->chains[0]->arStreamCaps) { - for (i = 0; priv->chains[0]->arStreamCaps[i]; i++) { - free(priv->chains[0]->arStreamCaps[i]); - } - free(priv->chains[0]->arStreamCaps); - } - if (priv->chains[1]->arpmt) { - for (i = 0; priv->chains[1]->arpmt[i]; i++) { - DeleteMediaType(priv->chains[1]->arpmt[i]); - } - free(priv->chains[1]->arpmt); - } - if (priv->chains[1]->arStreamCaps) { - for (i = 0; priv->chains[1]->arStreamCaps[i]; i++) { - free(priv->chains[1]->arStreamCaps[i]); - } - free(priv->chains[1]->arStreamCaps); - } - if (priv->chains[1]->rbuf) { - destroy_ringbuffer(priv->chains[1]->rbuf); - free(priv->chains[1]->rbuf); - priv->chains[1]->rbuf = NULL; - } - if (priv->chains[0]->rbuf) { - destroy_ringbuffer(priv->chains[0]->rbuf); - free(priv->chains[0]->rbuf); - priv->chains[0]->rbuf = NULL; - } - if (priv->chains[2]->rbuf) { - destroy_ringbuffer(priv->chains[2]->rbuf); - free(priv->chains[2]->rbuf); - priv->chains[2]->rbuf = NULL; - } if(priv->freq_table){ priv->freq_table_len=-1; free(priv->freq_table); @@ -3034,8 +3021,7 @@ static int uninit(priv_t * priv) for(i=0; i<3;i++) { - if(priv->chains[i]) - free(priv->chains[i]); + destroy_chain(priv->chains[i]); priv->chains[i] = NULL; } CoUninitialize(); |