From a64cd8d3c802f91ae77d1cf20ee9300bea079cd6 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 11 Sep 2010 23:53:15 +0000 Subject: stream/tv: move free_handle() from header to tv.c Move TV input free_handle static function to tv.c and make it non-static. There is no need to duplicate the function in the binary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32174 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tv.c | 11 +++++++++++ stream/tv.h | 2 ++ stream/tvi_def.h | 11 ----------- stream/tvi_dshow.c | 8 ++++---- stream/tvi_v4l.c | 2 +- stream/tvi_v4l2.c | 4 ++-- 6 files changed, 20 insertions(+), 18 deletions(-) (limited to 'stream') diff --git a/stream/tv.c b/stream/tv.c index cb1fe59fee..55b7033adb 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -80,6 +80,17 @@ static const tvi_info_t* tvi_driver_list[]={ NULL }; +void tv_free_handle(tvi_handle_t *h) +{ + if (h) { + if (h->priv) + free(h->priv); + if (h->scan) + free(h->scan); + free(h); + } +} + void tv_start_scan(tvi_handle_t *tvh, int start) { mp_msg(MSGT_TV,MSGL_INFO,"start scan\n"); diff --git a/stream/tv.h b/stream/tv.h index c2e8e05120..ed5fd135d7 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -255,6 +255,8 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm); void tv_start_scan(tvi_handle_t *tvh, int start); +void tv_free_handle(tvi_handle_t *h); + #define TV_NORM_PAL 1 #define TV_NORM_NTSC 2 #define TV_NORM_SECAM 3 diff --git a/stream/tvi_def.h b/stream/tvi_def.h index 43de8c6423..01c2222621 100644 --- a/stream/tvi_def.h +++ b/stream/tvi_def.h @@ -68,17 +68,6 @@ static tvi_handle_t *new_handle(void) return h; } -static void free_handle(tvi_handle_t *h) -{ - if (h) { - if (h->priv) - free(h->priv); - if (h->scan) - free(h->scan); - free(h); - } -} - /** Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2. Other formats will be filled with 0xC0 diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 0b60fff255..1aedc10642 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -3077,12 +3077,12 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param) priv->dev_index = a; } else { mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong device parameter: %s\n", tv_param->device); - free_handle(h); + tv_free_handle(h); return NULL; } if (priv->dev_index < 0) { mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong device index: %d\n", a); - free_handle(h); + tv_free_handle(h); return NULL; } } @@ -3091,12 +3091,12 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param) priv->adev_index = a; } else { mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong adevice parameter: %s\n", tv_param->adevice); - free_handle(h); + tv_free_handle(h); return NULL; } if (priv->dev_index < 0) { mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong adevice index: %d\n", a); - free_handle(h); + tv_free_handle(h); return NULL; } } diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c index 4f73c03bec..cc16e92e22 100644 --- a/stream/tvi_v4l.c +++ b/stream/tvi_v4l.c @@ -330,7 +330,7 @@ static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param) /* allocation failed */ if (!priv->video_device) { - free_handle(h); + tv_free_handle(h); return NULL; } diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index 91f574f901..4bdf4c499d 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -1077,7 +1077,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param) PRIV->video_dev = strdup(tv_param->device? tv_param->device: "/dev/video0"); if (!PRIV->video_dev) { - free_handle(tvi_handle); + tv_free_handle(tvi_handle); return NULL; } @@ -1085,7 +1085,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param) PRIV->audio_dev = strdup(tv_param->adevice); if (!PRIV->audio_dev) { free(PRIV->video_dev); - free_handle(tvi_handle); + tv_free_handle(tvi_handle); return NULL; } } -- cgit v1.2.3