Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r--source/blender/imbuf/intern/anim_movie.c4
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c4
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c8
-rw-r--r--source/blender/imbuf/intern/indexer.c12
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp46
-rw-r--r--source/blender/imbuf/intern/util.c30
6 files changed, 64 insertions, 40 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 63790cf7d25..271e52da1d4 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -477,7 +477,7 @@ static int startffmpeg(struct anim *anim)
const int *inv_table;
#endif
- if (anim == 0) return(-1);
+ if (anim == NULL) return(-1);
streamcount = anim->streamindex;
@@ -960,7 +960,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position,
int new_frame_index = 0; /* To quiet gcc barking... */
int old_frame_index = 0; /* To quiet gcc barking... */
- if (anim == 0) return (0);
+ if (anim == NULL) return (0);
av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position);
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 1481b2aaa66..fddfa2618c2 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -277,10 +277,10 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
return NULL;
}
- if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refLowData))
+ if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32)
cineon->element[i].refLowData = 0;
- if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refHighData))
+ if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32)
cineon->element[i].refHighData = (unsigned int)cineon->element[i].maxValue;
if (cineon->element[i].refLowQuantity == CINEON_UNDEFINED_R32 || isnan(cineon->element[i].refLowQuantity))
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 5a4371d84ba..e839c2fce90 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -300,10 +300,10 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
case descriptor_RGB:
case descriptor_RGBA:
case descriptor_ABGR:
- if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+ if (dpx->element[i].refLowData == DPX_UNDEFINED_U32)
dpx->element[i].refLowData = 0;
- if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+ if (dpx->element[i].refHighData == DPX_UNDEFINED_U32)
dpx->element[i].refHighData = (unsigned int)dpx->element[i].maxValue;
if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
@@ -324,10 +324,10 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
case descriptor_CbYCr:
case descriptor_CbYACrYA:
case descriptor_CbYCrA:
- if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+ if (dpx->element[i].refLowData == DPX_UNDEFINED_U32)
dpx->element[i].refLowData = 16.0f / 255.0f * dpx->element[i].maxValue;
- if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+ if (dpx->element[i].refHighData == DPX_UNDEFINED_U32)
dpx->element[i].refHighData = 235.0f / 255.0f * dpx->element[i].maxValue;
if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 93324b94cdc..49a40c461ac 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -656,7 +656,6 @@ static int add_to_proxy_output_ffmpeg(
static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx,
int rollback)
{
- int i;
char fname[FILE_MAX];
char fname_tmp[FILE_MAX];
@@ -674,18 +673,12 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx,
avcodec_close(ctx->c);
- for (i = 0; i < ctx->of->nb_streams; i++) {
- if (&ctx->of->streams[i]) {
- av_freep(&ctx->of->streams[i]);
- }
- }
-
if (ctx->of->oformat) {
if (!(ctx->of->oformat->flags & AVFMT_NOFILE)) {
avio_close(ctx->of->pb);
}
}
- av_free(ctx->of);
+ avformat_free_context(ctx->of);
MEM_freeN(ctx->video_buffer);
@@ -854,6 +847,9 @@ static void index_rebuild_ffmpeg_finish(FFmpegIndexBuilderContext *context, int
}
}
+ avcodec_close(context->iCodecCtx);
+ avformat_close_input(&context->iFormatCtx);
+
MEM_freeN(context);
}
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 838343dce35..fe74b8f7cce 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -98,11 +98,20 @@ static ImBuf *imb_oiio_load_image(ImageInput *in, int width, int height, int com
try
{
- in->read_image(TypeDesc::UINT8,
- (uchar *)ibuf->rect + (height - 1) * scanlinesize,
- AutoStride,
- -scanlinesize,
- AutoStride);
+ if (!in->read_image(TypeDesc::UINT8,
+ (uchar *)ibuf->rect + (height - 1) * scanlinesize,
+ AutoStride,
+ -scanlinesize,
+ AutoStride))
+ {
+ std::cerr << __func__ << ": ImageInput::read_image() failed:" << std::endl
+ << in->geterror() << std::endl;
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+
+ return NULL;
+ }
}
catch (const std::exception &exc)
{
@@ -128,11 +137,20 @@ static ImBuf *imb_oiio_load_image_float(ImageInput *in, int width, int height, i
try
{
- in->read_image(TypeDesc::FLOAT,
- (uchar *)ibuf->rect_float + (height - 1) * scanlinesize,
- AutoStride,
- -scanlinesize,
- AutoStride);
+ if (!in->read_image(TypeDesc::FLOAT,
+ (uchar *)ibuf->rect_float + (height - 1) * scanlinesize,
+ AutoStride,
+ -scanlinesize,
+ AutoStride))
+ {
+ std::cerr << __func__ << ": ImageInput::read_image() failed:" << std::endl
+ << in->geterror() << std::endl;
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+
+ return NULL;
+ }
}
catch (const std::exception &exc)
{
@@ -191,12 +209,18 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
in = ImageInput::create(filename);
- if (!in) return NULL;
+ if (!in) {
+ std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl
+ << OpenImageIO::geterror() << std::endl;
+ return NULL;
+ }
ImageSpec spec, config;
config.attribute("oiio:UnassociatedAlpha", (int) 1);
if (!in->open(filename, spec, config)) {
+ std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl
+ << in->geterror() << std::endl;
delete in;
return NULL;
}
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index ecf6458ac57..9d1ff79960c 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -120,6 +120,17 @@ const char *imb_ext_image_qt[] = {
NULL
};
+const char *imb_ext_movie_qt[] = {
+ ".avi",
+ ".flc",
+ ".dv",
+ ".r3d",
+ ".mov",
+ ".movie",
+ ".mv",
+ NULL
+};
+
const char *imb_ext_movie[] = {
".avi",
".flc",
@@ -131,10 +142,13 @@ const char *imb_ext_movie[] = {
".m2t",
".m2ts",
".mts",
+ ".ts",
".mv",
".avs",
".wmv",
".ogv",
+ ".ogg",
+ ".r3d",
".dv",
".mpeg",
".mpg",
@@ -145,6 +159,7 @@ const char *imb_ext_movie[] = {
".divx",
".xvid",
".mxf",
+ ".webm",
NULL
};
@@ -448,14 +463,7 @@ int IMB_isanim(const char *filename)
if (U.uiflag & USER_FILTERFILEEXTS) {
if (G.have_quicktime) {
- if (BLI_testextensie(filename, ".avi") ||
- BLI_testextensie(filename, ".flc") ||
- BLI_testextensie(filename, ".dv") ||
- BLI_testextensie(filename, ".r3d") ||
- BLI_testextensie(filename, ".mov") ||
- BLI_testextensie(filename, ".movie") ||
- BLI_testextensie(filename, ".mv"))
- {
+ if (BLI_testextensie_array(filename, imb_ext_movie_qt)) {
type = imb_get_anim_type(filename);
}
else {
@@ -463,11 +471,7 @@ int IMB_isanim(const char *filename)
}
}
else { /* no quicktime */
- if (BLI_testextensie(filename, ".avi") ||
- BLI_testextensie(filename, ".dv") ||
- BLI_testextensie(filename, ".r3d") ||
- BLI_testextensie(filename, ".mv"))
- {
+ if (BLI_testextensie_array(filename, imb_ext_movie)) {
type = imb_get_anim_type(filename);
}
else {