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/makesrna/intern/rna_sequencer.c
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/makesrna/intern/rna_sequencer.c')
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 81c05433e66..33621af69af 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -41,6 +41,8 @@
#include "BKE_sequencer.h"
#include "BKE_sound.h"
+#include "IMB_metadata.h"
+
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
@@ -587,6 +589,27 @@ static IDProperty *rna_Sequence_idprops(PointerRNA *ptr, bool create)
return seq->prop;
}
+static PointerRNA rna_MovieSequence_metadata_get(Sequence *seq)
+{
+ if (seq == NULL || seq->anims.first == NULL) {
+ return PointerRNA_NULL;
+ }
+
+ StripAnim *sanim = seq->anims.first;
+ if (sanim->anim == NULL) {
+ return PointerRNA_NULL;
+ }
+
+ IDProperty *metadata = IMB_anim_load_metadata(sanim->anim);
+ if (metadata == NULL) {
+ return PointerRNA_NULL;
+ }
+
+ PointerRNA ptr;
+ RNA_pointer_create(NULL, &RNA_IDPropertyWrapPtr, metadata, &ptr);
+ return ptr;
+}
+
static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal = &iter->internal.listbase;
@@ -1963,7 +1986,9 @@ static void rna_def_movie(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
-
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
srna = RNA_def_struct(brna, "MovieSequence", "Sequence");
RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
RNA_def_struct_sdna(srna, "Sequence");
@@ -1995,6 +2020,14 @@ static void rna_def_movie(BlenderRNA *brna)
"rna_Sequence_filepath_set");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
+ /* metadata */
+ func = RNA_def_function(srna, "metadata", "rna_MovieSequence_metadata_get");
+ RNA_def_function_ui_description(func, "Retrieve metadata of the movie file");
+ /* return type */
+ parm = RNA_def_pointer(func, "metadata", "IDPropertyWrapPtr", "", "Dict-like object containing the metadata");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
/* multiview */
prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS);