comparison libmpdemux/tvi_v4l2.c @ 16185:973b82bf1187

do not crash when /dev/video0 is not present
author faust3
date Sat, 06 Aug 2005 18:19:58 +0000
parents 51aafa55f44c
children e861f9b7a70e
comparison
equal deleted inserted replaced
16184:04dd5945fab8 16185:973b82bf1187
855 static int uninit(priv_t *priv) 855 static int uninit(priv_t *priv)
856 { 856 {
857 int i, frames, dropped = 0; 857 int i, frames, dropped = 0;
858 858
859 priv->shutdown = 1; 859 priv->shutdown = 1;
860 pthread_join(priv->video_grabber_thread, NULL); 860 if(priv->video_grabber_thread)
861 pthread_join(priv->video_grabber_thread, NULL);
861 pthread_mutex_destroy(&priv->video_buffer_mutex); 862 pthread_mutex_destroy(&priv->video_buffer_mutex);
862 863
863 if (priv->streamon) { 864 if (priv->streamon) {
864 struct v4l2_buffer buf; 865 struct v4l2_buffer buf;
865 866
904 } 905 }
905 906
906 /* free memory and close device */ 907 /* free memory and close device */
907 free(priv->map); priv->map = NULL; 908 free(priv->map); priv->map = NULL;
908 priv->mapcount = 0; 909 priv->mapcount = 0;
909 close(priv->video_fd); priv->video_fd = -1; 910 if(priv->video_fd!=-1)close(priv->video_fd); priv->video_fd = -1;
910 free(priv->video_dev); priv->video_dev = NULL; 911 free(priv->video_dev); priv->video_dev = NULL;
911 912
912 if (priv->video_ringbuffer) { 913 if (priv->video_ringbuffer) {
913 int i; 914 int i;
914 for (i = 0; i < priv->video_buffer_size_current; i++) { 915 for (i = 0; i < priv->video_buffer_size_current; i++) {