summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-15 13:30:44 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-15 13:30:44 +0000
commita9d2f4db42923f195ea05c5f30f4a32a1aa6fb04 (patch)
tree2f7777089fff99e8c7b7aa12f94e317bd565d6e1 /stream/stream_dvb.c
parent43bfd2d1283a3967b8c4d4b0b62068754b95127c (diff)
downloadmpv-a9d2f4db42923f195ea05c5f30f4a32a1aa6fb04.tar.bz2
mpv-a9d2f4db42923f195ea05c5f30f4a32a1aa6fb04.tar.xz
get rid of the file-static dvb_config and free the config at close() . Patch by Andrew Calkin and me
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25407 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/stream_dvb.c')
-rw-r--r--stream/stream_dvb.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index a4a8dd72cc..23938cd176 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -125,7 +125,6 @@ extern int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc,
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout);
extern char *dvb_dvrdev[4], *dvb_demuxdev[4], *dvb_frontenddev[4];
-static dvb_config_t *dvb_config = NULL;
static dvb_channels_list *dvb_get_channels(char *filename, int type)
@@ -425,7 +424,26 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
return list;
}
+void dvb_free_config(dvb_config_t *config)
+{
+ int i;
+ for(i=0; i<config->count; i++)
+ {
+ if(config->cards[i].name)
+ free(config->cards[i].name);
+ if(!config->cards[i].list)
+ continue;
+ if(config->cards[i].list->channels)
+ {
+ if(config->cards[i].list->channels->name)
+ free(config->cards[i].list->channels->name);
+ free(config->cards[i].list->channels);
+ }
+ free(config->cards[i].list);
+ }
+ free(config);
+}
static int dvb_streaming_read(stream_t *stream, char *buffer, int size)
{
@@ -525,7 +543,6 @@ int dvb_set_channel(stream_t *stream, int card, int n)
}
}
- dvb_config->priv = priv;
priv->card = card;
priv->list = new_list;
priv->retry = 5;
@@ -605,7 +622,7 @@ static void dvbin_close(stream_t *stream)
#endif
priv->is_on = 0;
- dvb_config->priv = NULL;
+ dvb_free_config(priv->config);
}
@@ -675,15 +692,13 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
priv = (dvb_priv_t *)stream->priv;
priv->stream = stream;
- dvb_config = dvb_get_config();
- if(dvb_config == NULL)
+ priv->config = dvb_get_config();
+ if(priv->config == NULL)
{
free(priv);
mp_msg(MSGT_DEMUX, MSGL_ERR, "DVB CONFIGURATION IS EMPTY, exit\n");
return STREAM_ERROR;
}
- dvb_config->priv = priv;
- priv->config = dvb_config;
priv->card = -1;
for(i=0; i<priv->config->count; i++)
@@ -752,8 +767,6 @@ dvb_config_t *dvb_get_config(void)
dvb_card_config_t *cards = NULL, *tmp;
dvb_config_t *conf = NULL;
- if(dvb_config != NULL)
- return dvb_config;
conf = malloc(sizeof(dvb_config_t));
if(conf == NULL)
@@ -841,7 +854,6 @@ dvb_config_t *dvb_get_config(void)
conf = NULL;
}
- dvb_config = conf;
return conf;
}