changeset 5810:8a357300d0ec

Added demuxer uninit
author albeu
date Wed, 24 Apr 2002 15:36:07 +0000
parents 4b24942acdbb
children 7c6cf46a44ce
files libmpdemux/demux_bmp.c libmpdemux/demux_film.c libmpdemux/demux_fli.c libmpdemux/demux_mf.c libmpdemux/demux_nuv.c libmpdemux/demux_real.c libmpdemux/demux_roq.c libmpdemux/demux_y4m.c libmpdemux/demuxer.c
diffstat 9 files changed, 101 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_bmp.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_bmp.c	Wed Apr 24 15:36:07 2002 +0000
@@ -109,3 +109,11 @@
 
   return demuxer;
 }
+
+void demux_close_bmp(demuxer_t* demuxer) {
+  bmp_image_t *bmp_image = demuxer->priv;
+
+  if(!bmp_image)
+    return;
+  free(bmp_image);
+}
--- a/libmpdemux/demux_film.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_film.c	Wed Apr 24 15:36:07 2002 +0000
@@ -413,3 +413,14 @@
 
   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);
+  
+}
--- a/libmpdemux/demux_fli.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_fli.c	Wed Apr 24 15:36:07 2002 +0000
@@ -153,3 +153,18 @@
 
   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);
+
+}
--- a/libmpdemux/demux_mf.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_mf.c	Wed Apr 24 15:36:07 2002 +0000
@@ -122,3 +122,11 @@
 
   return demuxer;
 }
+
+void demux_close_mf(demuxer_t* demuxer) {
+  demuxer_mf_t *dmf = demuxer->priv;
+
+  if(!dmf)
+    return;
+  free(dmf);  
+}
--- a/libmpdemux/demux_nuv.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_nuv.c	Wed Apr 24 15:36:07 2002 +0000
@@ -302,3 +302,16 @@
 	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);
+}
--- a/libmpdemux/demux_real.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_real.c	Wed Apr 24 15:36:07 2002 +0000
@@ -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 @@
 		{
 		    buf = malloc(len+1);
 		    stream_read(demuxer->stream, buf, len);
+		    buf[len] = 0;
 		    demux_info_add(demuxer, "name", buf);
 		    free(buf);
 		}
--- a/libmpdemux/demux_roq.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_roq.c	Wed Apr 24 15:36:07 2002 +0000
@@ -242,3 +242,12 @@
 
   return demuxer;
 }
+
+void demux_close_roq(demuxer_t* demuxer) {
+  roq_data_t *roq_data = demuxer->priv;
+
+  if(!roq_data)
+    return;
+  free(roq_data);
+}
+  
--- a/libmpdemux/demux_y4m.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demux_y4m.c	Wed Apr 24 15:36:07 2002 +0000
@@ -255,7 +255,9 @@
 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);
--- a/libmpdemux/demuxer.c	Wed Apr 24 12:28:03 2002 +0000
+++ b/libmpdemux/demuxer.c	Wed Apr 24 15:36:07 2002 +0000
@@ -137,9 +137,39 @@
     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]);