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:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-04-05 17:34:36 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-04-05 17:50:24 +0300
commitea0e2f9bd3849b73a29ef1805988fdb0484bc9d4 (patch)
treef5482496a4f69bdb963a7881059cd61576660333 /source/blender/imbuf
parent6c3110a66122f33a3c4df3066c42374660dad067 (diff)
Load metadata from video files and expose via RNA
The MovieSequence and MovieClip classes now have a metadata() function that exposes the `IDProperty *` holding the video metadata. Part of: https://developer.blender.org/D2273 Reviewed by: @campbellbarton
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_metadata.h1
-rw-r--r--source/blender/imbuf/intern/IMB_anim.h3
-rw-r--r--source/blender/imbuf/intern/anim_movie.c22
3 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/imbuf/IMB_metadata.h b/source/blender/imbuf/IMB_metadata.h
index 258d6bb1c5a..0a0d2c1faf6 100644
--- a/source/blender/imbuf/IMB_metadata.h
+++ b/source/blender/imbuf/IMB_metadata.h
@@ -73,5 +73,6 @@ bool IMB_metadata_get_field(struct IDProperty *metadata, const char *key, char *
void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const char *value);
void IMB_metadata_copy(struct ImBuf *dimb, struct ImBuf *simb);
+struct IDProperty *IMB_anim_load_metadata(struct anim *anim);
#endif /* __IMB_METADATA_H__ */
diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index c4c4f4405a5..6fa31e122cc 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -93,6 +93,7 @@
struct _AviMovie;
struct anim_index;
+struct IDProperty;
struct anim {
int ib_flags;
@@ -158,6 +159,8 @@ struct anim {
char colorspace[64];
char suffix[64]; /* MAX_NAME - multiview */
+
+ struct IDProperty *metadata;
};
#endif
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index cc8a38d5bf4..f842b69418e 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -80,6 +80,7 @@
#include "IMB_anim.h"
#include "IMB_indexer.h"
+#include "IMB_metadata.h"
#ifdef WITH_FFMPEG
# include "BKE_global.h" /* ENDIAN_ORDER */
@@ -220,6 +221,7 @@ void IMB_free_anim(struct anim *anim)
free_anim_ffmpeg(anim);
#endif
IMB_free_indices(anim);
+ IMB_metadata_free(anim->metadata);
MEM_freeN(anim);
}
@@ -239,6 +241,26 @@ void IMB_close_anim_proxies(struct anim *anim)
IMB_free_indices(anim);
}
+struct IDProperty *IMB_anim_load_metadata(struct anim *anim)
+{
+#ifdef WITH_FFMPEG
+ AVDictionaryEntry *entry = NULL;
+
+ BLI_assert(anim->pFormatCtx != NULL);
+ av_log(anim->pFormatCtx, AV_LOG_DEBUG, "METADATA FETCH\n");
+
+ while (true) {
+ entry = av_dict_get(anim->pFormatCtx->metadata, "", entry, AV_DICT_IGNORE_SUFFIX);
+ if (entry == NULL) break;
+
+ /* Delay creation of the property group until there is actual metadata to put in there. */
+ IMB_metadata_ensure(&anim->metadata);
+ IMB_metadata_set_field(anim->metadata, entry->key, entry->value);
+ }
+#endif
+ return anim->metadata;
+}
+
struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex, char colorspace[IM_MAX_SPACE])
{
struct anim *anim;