changeset 5812:f9d23c2aa6b7

Uninit added
author albeu
date Wed, 24 Apr 2002 17:28:23 +0000
parents 7c6cf46a44ce
children 737920323eb8
files libmpdemux/demux_audio.c libmpdemux/demux_demuxers.c libmpdemux/demux_ogg.c libmpdemux/demuxer.c
diffstat 4 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Wed Apr 24 16:47:37 2002 +0000
+++ b/libmpdemux/demux_audio.c	Wed Apr 24 17:28:23 2002 +0000
@@ -317,6 +317,14 @@
 
 }
 
+void demux_close_audio(demuxer_t* demuxer) {
+  da_priv_t* priv = demuxer->priv;
+
+  if(!priv)
+    return;
+  free(priv);
+}
+
 /****************** Options stuff ******************/
 
 #include "../cfgparser.h"
--- a/libmpdemux/demux_demuxers.c	Wed Apr 24 16:47:37 2002 +0000
+++ b/libmpdemux/demux_demuxers.c	Wed Apr 24 17:28:23 2002 +0000
@@ -81,3 +81,24 @@
       demux_seek(priv->sd,pos,1);
 
 }
+
+void demux_close_demuxers(demuxer_t* demuxer) {
+  int i;
+  dd_priv_t* priv = demuxer->priv;
+
+  if(priv->vd)
+    free_demuxer(priv->vd);
+  if(priv->ad && priv->ad != priv->vd)
+    free_demuxer(priv->ad);
+  if(priv->sd && priv->sd != priv->vd && priv->sd != priv->ad)
+    free_demuxer(priv->sd);
+
+  free(priv);
+  if(demuxer->info) {
+    for(i=0;demuxer->info[i] != NULL; i++)
+      free(demuxer->info[i]);
+    free(demuxer->info);
+  }
+  free(demuxer);
+}
+  
--- a/libmpdemux/demux_ogg.c	Wed Apr 24 16:47:37 2002 +0000
+++ b/libmpdemux/demux_ogg.c	Wed Apr 24 17:28:23 2002 +0000
@@ -27,6 +27,10 @@
   demuxer->audio->id = -2;
   return demuxer;
 }
+
+void demux_close_ogg(demuxer_t* demuxer) {
+
+}
 #else
 
 #include <ogg/ogg.h>
@@ -695,6 +699,7 @@
   ogg_d = (ogg_demuxer_t*)calloc(1,sizeof(ogg_demuxer_t));
   ogg_d->num_sub = 1;
   ogg_d->subs = (ogg_stream_t*)malloc(sizeof(ogg_stream_t));
+  ogg_d->subs[0].vorbis = 1;
 
    // Init the ogg physical stream
   ogg_sync_init(&ogg_d->sync);
@@ -870,4 +875,17 @@
 
 }
 
+void demux_close_ogg(demuxer_t* demuxer) {
+  ogg_demuxer_t* ogg_d = demuxer->priv;
+
+  if(!ogg_d)
+    return;
+
+  if(ogg_d->subs)
+    free(ogg_d->subs);
+  if(ogg_d->syncpoints)
+    free(ogg_d->syncpoints);
+  free(ogg_d);
+}
+
 #endif
--- a/libmpdemux/demuxer.c	Wed Apr 24 16:47:37 2002 +0000
+++ b/libmpdemux/demuxer.c	Wed Apr 24 17:28:23 2002 +0000
@@ -146,6 +146,9 @@
 extern void demux_close_bmp(demuxer_t* demuxer);
 extern void demux_close_fli(demuxer_t* demuxer);
 extern void demux_close_nuv(demuxer_t* demuxer);
+extern void demux_close_audio(demuxer_t* demuxer);
+extern void demux_close_ogg(demuxer_t* demuxer);
+extern void demux_close_demuxers(demuxer_t* demuxer);
 
 void free_demuxer(demuxer_t *demuxer){
     int i;
@@ -169,6 +172,12 @@
       demux_close_fli(demuxer); break;
     case DEMUXER_TYPE_NUV:
       demux_close_nuv(demuxer); break;
+    case DEMUXER_TYPE_AUDIO:
+      demux_close_audio(demuxer); break;
+    case DEMUXER_TYPE_OGG:
+      demux_close_ogg(demuxer); break;
+    case DEMUXER_TYPE_DEMUXERS:
+      demux_close_demuxers(demuxer); return;
     }
     // free streams:
     for(i=0;i<256;i++){