[]Struct gstreamer_editing_services::Asset

pub struct Asset(_, _);

The Assets in the GStreamer Editing Services represent the resources that can be used. You can create assets for any type that implements the Extractable interface, for example GESClips, Formatter, and TrackElement do implement it. This means that assets will represent for example a GESUriClips, BaseEffect etc, and then you can extract objects of those types with the appropriate parameters from the asset using the AssetExt::extract method:

GESAsset *effect_asset;
GESEffect *effect;

// You create an asset for an effect
effect_asset = ges_asset_request (GES_TYPE_EFFECT, "agingtv", NULL);

// And now you can extract an instance of GESEffect from that asset
effect = GES_EFFECT (ges_asset_extract (effect_asset));

In that example, the advantages of having a Asset are that you can know what effects you are working with and let your user know about the avalaible ones, you can add metadata to the Asset through the MetaContainer interface and you have a model for your custom effects. Note that Asset management is making easier thanks to the Project class.

Each asset is represented by a pair of extractable_type and id (string). Actually the extractable_type is the type that implements the Extractable interface, that means that for example for a UriClip, the type that implements the Extractable interface is Clip. The identifier represents different things depending on the extractable_type and you should check the documentation of each type to know what the ID of Asset actually represents for that type. By default, we only have one Asset per type, and the id is the name of the type, but this behaviour is overriden to be more useful. For example, for GESTransitionClips, the ID is the vtype of the transition you will extract from it (ie crossfade, box-wipe-rc etc..) For Effect the ID is the bin-description property of the extracted objects (ie the gst-launch style description of the bin that will be used).

Each and every Asset is cached into GES, and you can query those with the ges_list_assets function. Also the system will automatically register GESAssets for GESFormatters and GESTransitionClips and standard effects (actually not implemented yet) and you can simply query those calling:

   GList *formatter_assets, *tmp;

   //  List all  the transitions
   formatter_assets = ges_list_assets (GES_TYPE_FORMATTER);

   // Print some infos about the formatter GESAsset
   for (tmp = formatter_assets; tmp; tmp = tmp->next) {
     g_print ("Name of the formatter: %s, file extension it produces: %s",
       ges_meta_container_get_string (GES_META_CONTAINER (tmp->data), GES_META_FORMATTER_NAME),
       ges_meta_container_get_string (GES_META_CONTAINER (tmp->data), GES_META_FORMATTER_EXTENSION));
   }

   g_list_free (transition_assets);

You can request the creation of GESAssets using either Asset::request or Asset::request_async. All the GESAssets are cached and thus any asset that has already been created can be requested again without overhead.

Implements

AssetExt, glib::object::ObjectExt

Methods

impl Asset[src]

pub fn needs_reload(extractable_type: Type, id: &str) -> bool[src]

Sets an asset from the internal cache as needing reload. An asset needs reload in the case where, for example, we were missing a GstPlugin to use it and that plugin has been installed, or, that particular asset content as changed meanwhile (in the case of the usage of proxies).

Once an asset has been set as "needs reload", requesting that asset again will lead to it being re discovered, and reloaded as if it was not in the cache before.

extractable_type

The glib::Type of the object that can be extracted from the asset to be reloaded.

id

The identifier of the asset to mark as needing reload

Returns

true if the asset was in the cache and could be set as needing reload, false otherwise.

pub fn request(
    extractable_type: Type,
    id: Option<&str>
) -> Result<Option<Asset>, Error>
[src]

Create a Asset in the most simple cases, you should look at the extractable_type documentation to see if that constructor can be called for this particular type

As it is recommanded not to instanciate assets for GESUriClip synchronously, it will not work with this method, but you can instead use the specific UriClipAsset::request_sync method if you really want to.

extractable_type

The glib::Type of the object that can be extracted from the new asset.

id

The Identifier or None

Returns

A reference to the wanted Asset or None

pub fn request_async<P: IsA<Cancellable>, Q: FnOnce(Result<Asset, Error>) + Send + 'static>(
    extractable_type: Type,
    id: &str,
    cancellable: Option<&P>,
    callback: Q
)
[src]

The callback will be called from a running glib::MainLoop which is iterating a glib::MainContext. Note that, users should ensure the glib::MainContext, since this method will notify callback from the thread which was associated with a thread default glib::MainContext at calling ges_init. For example, if a user wants non-default glib::MainContext to be associated with callback, ges_init must be called after g_main_context_push_thread_default () with custom glib::MainContext.

Request a new Asset asyncronously, callback will be called when the materail is ready to be used or if an error occured.

Example of request of a GESAsset async:

// The request callback
static void
asset_loaded_cb (GESAsset * source, GAsyncResult * res, gpointer user_data)
{
  GESAsset *asset;
  GError *error = NULL;

  asset = ges_asset_request_finish (res, &error);
  if (asset) {
   g_print ("The file: %s is usable as a FileSource",
       ges_asset_get_id (asset));
  } else {
   g_print ("The file: %s is *not* usable as a FileSource because: %s",
       ges_asset_get_id (source), error->message);
  }

  gst_object_unref (mfs);
}

// The request:
ges_asset_request_async (GES_TYPE_URI_CLIP, some_uri, NULL,
   (GAsyncReadyCallback) asset_loaded_cb, user_data);

extractable_type

The glib::Type of the object that can be extracted from the new asset. The class must implement the Extractable interface.

id

The Identifier of the asset we want to create. This identifier depends of the extractable, type you want. By default it is the name of the class itself (or None), but for example for a GESEffect, it will be the pipeline description, for a GESUriClip it will be the name of the file, etc... You should refer to the documentation of the Extractable type you want to create a Asset for.

cancellable

optional gio::Cancellable object, None to ignore.

callback

a GAsyncReadyCallback to call when the initialization is finished, Note that the source of the callback will be the Asset, but you need to make sure that the asset is properly loaded using the Asset::request_finish method. This asset can not be used as is.

user_data

The user data to pass when callback is called

pub fn request_async_future(
    extractable_type: Type,
    id: &str
) -> Pin<Box_<dyn Future<Output = Result<Asset, Error>> + 'static>>
[src]

Trait Implementations

impl Clone for Asset

impl Debug for Asset

impl Eq for Asset

impl Hash for Asset

impl IsA<Asset> for Project

impl IsA<Asset> for UriClipAsset

impl IsA<Asset> for UriSourceAsset

impl Ord for Asset

impl<T: ObjectType> PartialEq<T> for Asset

impl<T: ObjectType> PartialOrd<T> for Asset

impl StaticType for Asset

Auto Trait Implementations

impl RefUnwindSafe for Asset

impl !Send for Asset

impl !Sync for Asset

impl Unpin for Asset

impl UnwindSafe for Asset

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<O> GObjectExtManualGst for O where
    O: IsA<Object>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.