AppStreamCompose.Media¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class AppStreamCompose.Media(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Return type:
Creates a new
AppStreamCompose.Media.Added in version 1.2.0.
- ensure_worker(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone- Raises:
- Returns:
Trueif the worker is running.- Return type:
Ensure a media worker process is running, spawning one if necessary. This function is called implicitly by all media operations, calling it explicitly is only useful to make worker startup problems surface early.
Added in version 1.2.0.
- get_memory_limit()¶
- Return type:
Get the address space limit applied to the worker process in MiB, or 0 if the worker may use as much memory as it wants.
Added in version 1.2.0.
- process_image(source, targets, out_dir, cancellable)¶
- Parameters:
source (
AppStreamCompose.ImageSource) – TheAppStreamCompose.ImageSourcedescribing the image to process.targets ([
AppStreamCompose.ImageTarget] orNone) – Renditions to generate, orNoneto just read image info.out_dir (
str) – Directory to store the renditions in, may beNoneif targets is empty.cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
Trueif the image was processed.- Return type:
Load an image (in the media worker process) and store an arbitrary set of scaled renditions of it in the given output directory. The directory is created if it does not exist yet.
On success, the dimensions the source image was loaded at are recorded in source, and the result fields of all targets are updated. Individual renditions may still have failed - this is recorded in their error message and does not affect the return value of this function.
Cancelling this operation terminates the media worker process, as its pending reply would otherwise desynchronize the next request. A fresh worker is spawned automatically for the next operation.
Added in version 1.2.0.
- set_memory_limit(limit_mib)¶
- Parameters:
limit_mib (
int) – Address space limit for the worker process in MiB, 0 for no limit.
Limit the amount of memory the worker process may use. The limit is applied when the next worker process is spawned.
Added in version 1.2.0.
- set_request_timeout(seconds)¶
- Parameters:
seconds (
int) – New timeout in seconds, 0 for no timeout.
Set the time a single media operation may take before the worker is assumed to hang and gets killed.
Added in version 1.2.0.
- stop()¶
Stop the worker process of this instance, if it is running. A new worker will be spawned automatically if another media operation is requested.
Added in version 1.2.0.