diff options
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index f745a840cea..85582ceea4c 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -53,6 +53,7 @@ #include "BKE_global.h" #include "BKE_idprop.h" +#include "BKE_image.h" #include "BKE_main.h" #include "BKE_report.h" #include "BKE_sound.h" @@ -62,6 +63,8 @@ #include "ffmpeg_compat.h" +struct StampData; + typedef struct FFMpegContext { int ffmpeg_type; int ffmpeg_codec; @@ -94,6 +97,8 @@ typedef struct FFMpegContext { bool audio_deinterleave; int audio_sample_size; + struct StampData *stamp_data; + #ifdef WITH_AUDASPACE AUD_Device *audio_mixdown_device; #endif @@ -836,6 +841,12 @@ static void ffmpeg_dict_set_float(AVDictionary **dict, const char *key, float va av_dict_set(dict, key, buffer, 0); } +static void ffmpeg_add_metadata_callback(void *data, const char *propname, char *propvalue, int len) +{ + AVDictionary **metadata = (AVDictionary **)data; + av_dict_set(metadata, propname, propvalue, 0); +} + static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports) { /* Handle to the output file */ @@ -994,6 +1005,11 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int goto fail; } } + + if (context->stamp_data != NULL) { + BKE_stamp_info_callback(&of->metadata, context->stamp_data, ffmpeg_add_metadata_callback, false); + } + if (avformat_write_header(of, NULL) < 0) { BKE_report(reports, RPT_ERROR, "Could not initialize streams, probably unsupported codec combination"); goto fail; @@ -1168,6 +1184,7 @@ int BKE_ffmpeg_start(void *context_v, struct Scene *scene, RenderData *rd, int r context->ffmpeg_autosplit_count = 0; context->ffmpeg_preview = preview; + context->stamp_data = BKE_stamp_info_from_scene_static(scene); success = start_ffmpeg_impl(context, rd, rectx, recty, suffix, reports); #ifdef WITH_AUDASPACE @@ -1734,6 +1751,7 @@ void *BKE_ffmpeg_context_create(void) context->ffmpeg_autosplit = 0; context->ffmpeg_autosplit_count = 0; context->ffmpeg_preview = false; + context->stamp_data = NULL; return context; } @@ -1741,9 +1759,13 @@ void *BKE_ffmpeg_context_create(void) void BKE_ffmpeg_context_free(void *context_v) { FFMpegContext *context = context_v; - if (context) { - MEM_freeN(context); + if (context == NULL) { + return; + } + if (context->stamp_data) { + MEM_freeN(context->stamp_data); } + MEM_freeN(context); } #endif /* WITH_FFMPEG */ |