# HG changeset patch # User diego # Date 1284249195 0 # Node ID 535ebcd085e445cf4919f7abadf334f0649df1e3 # Parent 7f6ac03eb2ce9d194f405061fba55c72dc04d05d Move TV input free_handle static function to tv.c and make it non-static. There is no need to pointlessly duplicate the function in the binary. diff -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tv.c --- a/stream/tv.c Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tv.c Sat Sep 11 23:53:15 2010 +0000 @@ -81,6 +81,17 @@ 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 -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tv.h --- a/stream/tv.h Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tv.h Sat Sep 11 23:53:15 2010 +0000 @@ -255,6 +255,8 @@ 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 -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tvi_def.h --- a/stream/tvi_def.h Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tvi_def.h Sat Sep 11 23:53:15 2010 +0000 @@ -68,17 +68,6 @@ 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 -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tvi_dshow.c --- a/stream/tvi_dshow.c Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tvi_dshow.c Sat Sep 11 23:53:15 2010 +0000 @@ -3078,12 +3078,12 @@ priv->dev_index = a; } else { mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceParam, tv_param->device); - free_handle(h); + tv_free_handle(h); return NULL; } if (priv->dev_index < 0) { mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceIndex, a); - free_handle(h); + tv_free_handle(h); return NULL; } } @@ -3092,12 +3092,12 @@ priv->adev_index = a; } else { mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceParam, tv_param->adevice); - free_handle(h); + tv_free_handle(h); return NULL; } if (priv->dev_index < 0) { mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceIndex, a); - free_handle(h); + tv_free_handle(h); return NULL; } } diff -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tvi_v4l.c --- a/stream/tvi_v4l.c Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tvi_v4l.c Sat Sep 11 23:53:15 2010 +0000 @@ -330,7 +330,7 @@ /* allocation failed */ if (!priv->video_device) { - free_handle(h); + tv_free_handle(h); return NULL; } diff -r 7f6ac03eb2ce -r 535ebcd085e4 stream/tvi_v4l2.c --- a/stream/tvi_v4l2.c Sat Sep 11 23:30:52 2010 +0000 +++ b/stream/tvi_v4l2.c Sat Sep 11 23:53:15 2010 +0000 @@ -1077,7 +1077,7 @@ 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 @@ 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; } }