mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
Fix retrieving asset metadata on project reload.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/202>
This commit is contained in:
parent
697102fbf3
commit
9f202a0a72
2 changed files with 33 additions and 0 deletions
|
@ -718,6 +718,10 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, PendingAsset * passet)
|
|||
ges_asset_try_proxy (asset, passet->proxy_id);
|
||||
}
|
||||
|
||||
if (passet->metadatas)
|
||||
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (asset),
|
||||
passet->metadatas);
|
||||
|
||||
/* And now add to the project */
|
||||
ges_project_add_asset (self->project, asset);
|
||||
gst_object_unref (self);
|
||||
|
|
|
@ -100,3 +100,32 @@ class TestTimeline(GESSimpleTimelineTest):
|
|||
GES.Asset.needs_reload(GES.UriClip, uri)
|
||||
GES.Asset.request_async(GES.UriClip, uri, None, asset_loaded_cb, mainloop)
|
||||
mainloop.run()
|
||||
|
||||
def test_asset_metadata_on_reload(self):
|
||||
mainloop = GLib.MainLoop()
|
||||
|
||||
unused, xges_path = tempfile.mkstemp(suffix=".xges")
|
||||
project_uri = Gst.filename_to_uri(os.path.abspath(xges_path))
|
||||
|
||||
asset_uri = Gst.filename_to_uri(os.path.join(__file__, "../../assets/audio_video.ogg"))
|
||||
xges = """<ges version='0.3'>
|
||||
<project properties='properties;' metadatas='metadatas;'>
|
||||
<ressources>
|
||||
<asset id='%(uri)s' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)2003000000;' metadatas='metadatas, container-format=(string)Matroska, language-code=(string)und, application-name=(string)Lavc56.60.100, encoder-version=(uint)0, audio-codec=(string)Vorbis, nominal-bitrate=(uint)80000, bitrate=(uint)80000, video-codec=(string)"On2\ VP8", file-size=(guint64)223340, foo=(string)bar;' >
|
||||
</asset>
|
||||
</ressources>
|
||||
</project>
|
||||
</ges>"""% {"uri": asset_uri}
|
||||
with open(xges_path, "w") as xges_file:
|
||||
xges_file.write(xges)
|
||||
|
||||
|
||||
def loaded_cb(project, timeline):
|
||||
asset = project.list_assets(GES.Extractable)[0]
|
||||
self.assertEqual(asset.get_meta("foo"), "bar")
|
||||
mainloop.quit()
|
||||
|
||||
loaded_project = GES.Project(uri=project_uri, extractable_type=GES.Timeline)
|
||||
loaded_project.connect("loaded", loaded_cb)
|
||||
timeline = loaded_project.extract()
|
||||
mainloop.run()
|
||||
|
|
Loading…
Reference in a new issue