mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-19 14:19:58 +01:00
Check if file is a regular file
git-svn-id: svn://code.dyne.org/veejay/trunk@499 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <libel/lav_io.h>
|
#include <libel/lav_io.h>
|
||||||
//#include <veejay/vj-lib.h>
|
//#include <veejay/vj-lib.h>
|
||||||
#include <libvjmsg/vj-common.h>
|
#include <libvjmsg/vj-common.h>
|
||||||
@@ -771,7 +772,23 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size)
|
|||||||
lav_fd->is_MJPG = 0;
|
lav_fd->is_MJPG = 0;
|
||||||
lav_fd->MJPG_chroma = CHROMAUNKNOWN;
|
lav_fd->MJPG_chroma = CHROMAUNKNOWN;
|
||||||
lav_fd->mmap_size = mmap_size;
|
lav_fd->mmap_size = mmap_size;
|
||||||
/* open video file, try AVI first */
|
|
||||||
|
|
||||||
|
/* open file, check if file is a file */
|
||||||
|
struct stat s;
|
||||||
|
if( stat(filename, &s ) != 0 )
|
||||||
|
{
|
||||||
|
if(lav_fd) free(lav_fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!S_ISREG( s.st_mode) )
|
||||||
|
{
|
||||||
|
veejay_msg(VEEJAY_MSG_ERROR, "'%s' is not a regular file",filename);
|
||||||
|
if(lav_fd) free(lav_fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
lav_fd->avi_fd = AVI_open_input_file(filename,1,mmap_size);
|
lav_fd->avi_fd = AVI_open_input_file(filename,1,mmap_size);
|
||||||
video_format = 'a'; /* for error messages */
|
video_format = 'a'; /* for error messages */
|
||||||
|
|||||||
Reference in New Issue
Block a user