diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-24 15:36:07 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-24 15:36:07 +0000 |
commit | 2b955d3b05a888b153f2315a195fe7d910539d85 (patch) | |
tree | a38a80ab891e5a69dd735cac1c1ebe86c2d6a88f /libmpdemux | |
parent | 314ec6091b85efbdb3f3d05c2bff442f52c6511a (diff) | |
download | mpv-2b955d3b05a888b153f2315a195fe7d910539d85.tar.bz2 mpv-2b955d3b05a888b153f2315a195fe7d910539d85.tar.xz |
Added demuxer uninit
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5811 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_bmp.c | 8 | ||||
-rw-r--r-- | libmpdemux/demux_film.c | 11 | ||||
-rw-r--r-- | libmpdemux/demux_fli.c | 15 | ||||
-rw-r--r-- | libmpdemux/demux_mf.c | 8 | ||||
-rw-r--r-- | libmpdemux/demux_nuv.c | 13 | ||||
-rw-r--r-- | libmpdemux/demux_real.c | 4 | ||||
-rw-r--r-- | libmpdemux/demux_roq.c | 9 | ||||
-rw-r--r-- | libmpdemux/demux_y4m.c | 4 | ||||
-rw-r--r-- | libmpdemux/demuxer.c | 30 |
9 files changed, 101 insertions, 1 deletions
diff --git a/libmpdemux/demux_bmp.c b/libmpdemux/demux_bmp.c index df28daee37..093c2ffa04 100644 --- a/libmpdemux/demux_bmp.c +++ b/libmpdemux/demux_bmp.c @@ -109,3 +109,11 @@ demuxer_t* demux_open_bmp(demuxer_t* demuxer) return demuxer; } + +void demux_close_bmp(demuxer_t* demuxer) { + bmp_image_t *bmp_image = demuxer->priv; + + if(!bmp_image) + return; + free(bmp_image); +} diff --git a/libmpdemux/demux_film.c b/libmpdemux/demux_film.c index f182a9ea76..2b0b9a5948 100644 --- a/libmpdemux/demux_film.c +++ b/libmpdemux/demux_film.c @@ -413,3 +413,14 @@ demuxer_t* demux_open_film(demuxer_t* demuxer) return demuxer; } + +void demux_close_film(demuxer_t* demuxer) { + film_data_t *film_data = demuxer->priv; + + if(!film_data) + return; + if(film_data->chunks) + free(film_data->chunks); + free(film_data); + +} diff --git a/libmpdemux/demux_fli.c b/libmpdemux/demux_fli.c index c5fa992821..1f485e7cd0 100644 --- a/libmpdemux/demux_fli.c +++ b/libmpdemux/demux_fli.c @@ -153,3 +153,18 @@ demuxer_t* demux_open_fli(demuxer_t* demuxer){ return demuxer; } + +void demux_close_fli(demuxer_t* demuxer) { + fli_frames_t *frames = demuxer->priv; + + if(!frames) + return; + + if(frames->filepos) + free(frames->filepos); + if(frames->frame_size) + free(frames->frame_size); + + free(frames); + +} diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c index adb2cb67ab..0e81c762a0 100644 --- a/libmpdemux/demux_mf.c +++ b/libmpdemux/demux_mf.c @@ -122,3 +122,11 @@ demuxer_t* demux_open_mf(demuxer_t* demuxer){ return demuxer; } + +void demux_close_mf(demuxer_t* demuxer) { + demuxer_mf_t *dmf = demuxer->priv; + + if(!dmf) + return; + free(dmf); +} diff --git a/libmpdemux/demux_nuv.c b/libmpdemux/demux_nuv.c index d4cb357641..983e8cd2e9 100644 --- a/libmpdemux/demux_nuv.c +++ b/libmpdemux/demux_nuv.c @@ -302,3 +302,16 @@ int nuv_check_file ( demuxer_t* demuxer ) stream_seek ( demuxer->stream, orig_pos ); return 1; } + +void demux_close_nuv(demuxer_t* demuxer) { + nuv_priv_t* priv = demuxer->priv; + nuv_position_t* pos; + if(!priv) + return; + for(pos = priv->index_list ; pos != NULL ; ) { + nuv_position_t* p = pos; + pos = pos->next; + free(p); + } + free(priv); +} diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c index 1004424c6e..77ba7c5ffe 100644 --- a/libmpdemux/demux_real.c +++ b/libmpdemux/demux_real.c @@ -8,6 +8,9 @@ TODO: fix the whole syncing mechanism $Log$ + Revision 1.10 2002/04/24 15:36:06 albeu + Added demuxer uninit + Revision 1.9 2002/03/15 15:51:37 alex added PRE-ALPHA seeking ability and index table generator (like avi's one) @@ -510,6 +513,7 @@ void demux_open_real(demuxer_t* demuxer) { buf = malloc(len+1); stream_read(demuxer->stream, buf, len); + buf[len] = 0; demux_info_add(demuxer, "name", buf); free(buf); } diff --git a/libmpdemux/demux_roq.c b/libmpdemux/demux_roq.c index ebc181b3fa..9cfbd0d71b 100644 --- a/libmpdemux/demux_roq.c +++ b/libmpdemux/demux_roq.c @@ -242,3 +242,12 @@ demuxer_t* demux_open_roq(demuxer_t* demuxer) return demuxer; } + +void demux_close_roq(demuxer_t* demuxer) { + roq_data_t *roq_data = demuxer->priv; + + if(!roq_data) + return; + free(roq_data); +} + diff --git a/libmpdemux/demux_y4m.c b/libmpdemux/demux_y4m.c index 8cfcc2b537..c259308928 100644 --- a/libmpdemux/demux_y4m.c +++ b/libmpdemux/demux_y4m.c @@ -255,7 +255,9 @@ int demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, int flags) { void demux_close_y4m(demuxer_t *demuxer) { y4m_priv_t* priv = demuxer->priv; - + + if(!priv) + return; if (!priv->is_older) y4m_fini_stream_info(((y4m_priv_t*)demuxer->priv)->si); free(((y4m_priv_t*)demuxer->priv)->si); diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index c3c4a4db51..e12d2af415 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -137,9 +137,39 @@ void free_sh_video(sh_video_t* sh){ free(sh); } +extern void demux_close_vivo(demuxer_t *demuxer); +extern void demux_close_real(demuxer_t *demuxer); +extern void demux_close_y4m(demuxer_t *demuxer); +extern void demux_close_mf(demuxer_t* demuxer); +extern void demux_close_roq(demuxer_t* demuxer); +extern void demux_close_film(demuxer_t* demuxer); +extern void demux_close_bmp(demuxer_t* demuxer); +extern void demux_close_fli(demuxer_t* demuxer); +extern void demux_close_nuv(demuxer_t* demuxer); + void free_demuxer(demuxer_t *demuxer){ int i; mp_msg(MSGT_DEMUXER,MSGL_V,"DEMUXER: freeing demuxer at %p \n",demuxer); + switch(demuxer->type) { + case DEMUXER_TYPE_VIVO: + demux_close_vivo(demuxer); break; + case DEMUXER_TYPE_REAL: + demux_close_real(demuxer); break; + case DEMUXER_TYPE_Y4M: + demux_close_y4m(demuxer); break; + case DEMUXER_TYPE_MF: + demux_close_mf(demuxer); break; + case DEMUXER_TYPE_ROQ: + demux_close_roq(demuxer); break; + case DEMUXER_TYPE_FILM: + demux_close_film(demuxer); break; + case DEMUXER_TYPE_BMP: + demux_close_bmp(demuxer); break; + case DEMUXER_TYPE_FLI: + demux_close_fli(demuxer); break; + case DEMUXER_TYPE_NUV: + demux_close_nuv(demuxer); break; + } // free streams: for(i=0;i<256;i++){ if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]); |