diff options
Diffstat (limited to 'source/blender/imbuf/intern/indexer.c')
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 277f50bcdbc..002ffd409a2 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -332,7 +332,7 @@ int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size) return 3; default: return 0; - }; + } return 0; } @@ -352,7 +352,7 @@ int IMB_timecode_to_array_index(IMB_Timecode_Type tc) return 3; default: return 0; - }; + } return 0; } @@ -361,17 +361,16 @@ int IMB_timecode_to_array_index(IMB_Timecode_Type tc) * - rebuild helper functions * ---------------------------------------------------------------------- */ -static void get_index_dir(struct anim *anim, char *index_dir) +static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_len) { if (!anim->index_dir[0]) { char fname[FILE_MAXFILE]; - BLI_strncpy(index_dir, anim->name, FILE_MAXDIR); - BLI_splitdirstring(index_dir, fname); - BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, "BL_proxy"); - BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, fname); + BLI_split_dirfile(anim->name, index_dir, fname, index_dir_len, sizeof(fname)); + BLI_join_dirfile(index_dir, index_dir_len, index_dir, "BL_proxy"); + BLI_join_dirfile(index_dir, index_dir_len, index_dir, fname); } else { - BLI_strncpy(index_dir, anim->index_dir, FILE_MAXDIR); + BLI_strncpy(index_dir, anim->index_dir, index_dir_len); } } @@ -396,7 +395,7 @@ static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size, BLI_snprintf(proxy_temp_name, sizeof(proxy_temp_name), "proxy_%d%s_part.avi", (int) (proxy_fac[i] * 100), stream_suffix); - get_index_dir(anim, index_dir); + get_index_dir(anim, index_dir, sizeof(index_dir)); BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, temp ? proxy_temp_name : proxy_name); @@ -425,7 +424,7 @@ static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, BLI_snprintf(index_name, 256, index_names[i], stream_suffix); - get_index_dir(anim, index_dir); + get_index_dir(anim, index_dir, sizeof(index_dir)); BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name); @@ -492,11 +491,13 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( rv->of = avformat_alloc_context(); rv->of->oformat = av_guess_format("avi", NULL, NULL); - BLI_snprintf(rv->of->filename, sizeof(rv->of->filename), "%s", fname); + BLI_strncpy(rv->of->filename, fname, sizeof(rv->of->filename)); fprintf(stderr, "Starting work on proxy: %s\n", rv->of->filename); - rv->st = av_new_stream(rv->of, 0); + rv->st = avformat_new_stream(rv->of, NULL); + rv->st->id = 0; + rv->c = rv->st->codec; rv->c->codec_type = AVMEDIA_TYPE_VIDEO; rv->c->codec_id = CODEC_ID_MJPEG; @@ -531,8 +532,8 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( /* there's no way to set JPEG quality in the same way as in AVI JPEG and image sequence, * but this seems to be giving expected quality result */ ffmpeg_quality = (int)(1.0f + 30.0f * (1.0f - (float)quality / 100.0f) + 0.5f); - av_set_int(rv->c, "qmin", ffmpeg_quality); - av_set_int(rv->c, "qmax", ffmpeg_quality); + av_opt_set_int(rv->c, "qmin", ffmpeg_quality, 0); + av_opt_set_int(rv->c, "qmax", ffmpeg_quality, 0); if (rv->of->flags & AVFMT_GLOBALHEADER) { rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER; @@ -545,7 +546,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( return 0; } - avcodec_open(rv->c, rv->codec); + avcodec_open2(rv->c, rv->codec, NULL); rv->video_buffersize = 2000000; rv->video_buffer = (uint8_t *)MEM_mallocN( @@ -758,7 +759,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim return NULL; } - if (av_find_stream_info(context->iFormatCtx) < 0) { + if (avformat_find_stream_info(context->iFormatCtx, NULL) < 0) { av_close_input_file(context->iFormatCtx); MEM_freeN(context); return NULL; @@ -797,7 +798,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim context->iCodecCtx->workaround_bugs = 1; - if (avcodec_open(context->iCodecCtx, context->iCodec) < 0) { + if (avcodec_open2(context->iCodecCtx, context->iCodec, NULL) < 0) { av_close_input_file(context->iFormatCtx); MEM_freeN(context); return NULL; |