diff options
Diffstat (limited to 'source/blender/imbuf/intern/util.c')
-rw-r--r-- | source/blender/imbuf/intern/util.c | 98 |
1 files changed, 51 insertions, 47 deletions
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 99872192e32..4820347f048 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -93,7 +93,8 @@ const char *imb_ext_image[] = { #ifdef WITH_OPENEXR ".exr", #endif - NULL}; + NULL +}; const char *imb_ext_image_qt[] = { ".gif", @@ -101,7 +102,8 @@ const char *imb_ext_image_qt[] = { ".pct", ".pict", ".pntg", ".qtif", - NULL}; + NULL +}; const char *imb_ext_movie[] = { ".avi", @@ -128,7 +130,8 @@ const char *imb_ext_movie[] = { ".divx", ".xvid", ".mxf", - NULL}; + NULL +}; /* sort of wrong being here... */ const char *imb_ext_audio[] = { @@ -145,7 +148,8 @@ const char *imb_ext_audio[] = { ".aif", ".aiff", ".m4a", - NULL}; + NULL +}; static int IMB_ispic_name(const char *name) { @@ -160,7 +164,7 @@ static int IMB_ispic_name(const char *name) if (((st.st_mode) & S_IFMT) != S_IFREG) return FALSE; - if ((fp = BLI_open(name, O_BINARY|O_RDONLY, 0)) < 0) + if ((fp = BLI_open(name, O_BINARY | O_RDONLY, 0)) < 0) return FALSE; if (read(fp, buf, 32) != 32) { @@ -174,8 +178,8 @@ static int IMB_ispic_name(const char *name) if ((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0) return JPG; - for (type=IMB_FILE_TYPES; type->is_a; type++) - if (type->is_a((uchar*)buf)) + for (type = IMB_FILE_TYPES; type->is_a; type++) + if (type->is_a((uchar *)buf)) return type->filetype; return FALSE; @@ -184,9 +188,9 @@ static int IMB_ispic_name(const char *name) int IMB_ispic(const char *filename) { if (U.uiflag & USER_FILTERFILEEXTS) { - if ( (BLI_testextensie_array(filename, imb_ext_image)) || - (G.have_quicktime && BLI_testextensie_array(filename, imb_ext_image_qt)) - ) { + if ( (BLI_testextensie_array(filename, imb_ext_image)) || + (G.have_quicktime && BLI_testextensie_array(filename, imb_ext_image_qt)) + ) { return IMB_ispic_name(filename); } else { @@ -200,15 +204,15 @@ int IMB_ispic(const char *filename) -static int isavi (const char *name) +static int isavi(const char *name) { - return AVI_is_avi (name); + return AVI_is_avi(name); } #ifdef WITH_QUICKTIME -static int isqtime (const char *name) +static int isqtime(const char *name) { - return anim_is_quicktime (name); + return anim_is_quicktime(name); } #endif @@ -241,7 +245,7 @@ void do_init_ffmpeg(void) } } -static int isffmpeg (const char *filename) +static int isffmpeg(const char *filename) { AVFormatContext *pFormatCtx; unsigned int i; @@ -252,24 +256,24 @@ static int isffmpeg (const char *filename) do_init_ffmpeg(); if (BLI_testextensie(filename, ".swf") || - BLI_testextensie(filename, ".jpg") || - BLI_testextensie(filename, ".png") || - BLI_testextensie(filename, ".dds") || - BLI_testextensie(filename, ".tga") || - BLI_testextensie(filename, ".bmp") || - BLI_testextensie(filename, ".exr") || - BLI_testextensie(filename, ".cin") || + BLI_testextensie(filename, ".jpg") || + BLI_testextensie(filename, ".png") || + BLI_testextensie(filename, ".dds") || + BLI_testextensie(filename, ".tga") || + BLI_testextensie(filename, ".bmp") || + BLI_testextensie(filename, ".exr") || + BLI_testextensie(filename, ".cin") || BLI_testextensie(filename, ".wav")) { return 0; } - if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) { + if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL) != 0) { if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n"); return 0; } - if (av_find_stream_info(pFormatCtx)<0) { + if (av_find_stream_info(pFormatCtx) < 0) { if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_find_stream_info failed\n"); av_close_input_file(pFormatCtx); return 0; @@ -278,32 +282,32 @@ static int isffmpeg (const char *filename) if (UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0); - /* Find the first video stream */ - videoStream=-1; - for (i=0; i<pFormatCtx->nb_streams; i++) + /* Find the first video stream */ + videoStream = -1; + for (i = 0; i < pFormatCtx->nb_streams; i++) if (pFormatCtx->streams[i] && - pFormatCtx->streams[i]->codec && - (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)) + pFormatCtx->streams[i]->codec && + (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)) { - videoStream=i; + videoStream = i; break; } - if (videoStream==-1) { + if (videoStream == -1) { av_close_input_file(pFormatCtx); return 0; } pCodecCtx = pFormatCtx->streams[videoStream]->codec; - /* Find the decoder for the video stream */ - pCodec=avcodec_find_decoder(pCodecCtx->codec_id); - if (pCodec==NULL) { + /* Find the decoder for the video stream */ + pCodec = avcodec_find_decoder(pCodecCtx->codec_id); + if (pCodec == NULL) { av_close_input_file(pFormatCtx); return 0; } - if (avcodec_open(pCodecCtx, pCodec)<0) { + if (avcodec_open(pCodecCtx, pCodec) < 0) { av_close_input_file(pFormatCtx); return 0; } @@ -316,9 +320,9 @@ static int isffmpeg (const char *filename) #endif #ifdef WITH_REDCODE -static int isredcode(const char * filename) +static int isredcode(const char *filename) { - struct redcode_handle * h = redcode_open(filename); + struct redcode_handle *h = redcode_open(filename); if (!h) { return 0; } @@ -328,7 +332,7 @@ static int isredcode(const char * filename) #endif -int imb_get_anim_type(const char * name) +int imb_get_anim_type(const char *name) { int type; struct stat st; @@ -336,13 +340,13 @@ int imb_get_anim_type(const char * name) if (UTIL_DEBUG) printf("in getanimtype: %s\n", name); #ifndef _WIN32 -# ifdef WITH_QUICKTIME +# ifdef WITH_QUICKTIME if (isqtime(name)) return (ANIM_QTIME); -# endif -# ifdef WITH_FFMPEG +# endif +# ifdef WITH_FFMPEG /* stat test below fails on large files > 4GB */ if (isffmpeg(name)) return (ANIM_FFMPEG); -# endif +# endif if (BLI_stat(name, &st) == -1) return(0); if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); @@ -354,12 +358,12 @@ int imb_get_anim_type(const char * name) if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); if (ismovie(name)) return (ANIM_MOVIE); -# ifdef WITH_QUICKTIME +# ifdef WITH_QUICKTIME if (isqtime(name)) return (ANIM_QTIME); -# endif -# ifdef WITH_FFMPEG +# endif +# ifdef WITH_FFMPEG if (isffmpeg(name)) return (ANIM_FFMPEG); -# endif +# endif if (isavi(name)) return (ANIM_AVI); @@ -412,5 +416,5 @@ int IMB_isanim(const char *filename) type = imb_get_anim_type(filename); } - return (type && type!=ANIM_SEQUENCE); + return (type && type != ANIM_SEQUENCE); } |