Top | ![]() |
![]() |
![]() |
![]() |
ApertureViewfinderApertureViewfinder — A GTK widget for displaying a camera feed and taking pictures and videos from it |
ApertureCamera * | camera | Read / Write |
gboolean | detect-barcodes | Read / Write |
ApertureViewfinderState | state | Read |
enum | ApertureViewfinderState |
enum | ApertureMediaCaptureError |
#define | APERTURE_TYPE_VIEWFINDER |
#define | APERTURE_MEDIA_CAPTURE_ERROR |
ApertureViewfinder |
GEnum ├── ApertureMediaCaptureError ╰── ApertureViewfinderState GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── ApertureViewfinder
The ApertureViewfinder is the main widget in Aperture. It is responsible for displaying a camera feed in your UI, and for using that camera feed to do useful things, like taking pictures, recording video, and detecting barcodes.
ApertureViewfinder does not contain camera controls, however--just the camera feed. You'll need to build a controls UI yourself.
ApertureViewfinder *
aperture_viewfinder_new (void
);
Creates a new ApertureViewfinder.
Since: 0.1
void aperture_viewfinder_set_camera (ApertureViewfinder *self
,ApertureCamera *camera
,GError **error
);
Sets the camera that the ApertureViewfinder will use. See “camera”.
Since: 0.1
ApertureCamera *
aperture_viewfinder_get_camera (ApertureViewfinder *self
);
Gets the camera that the ApertureViewfinder is currently using. See “camera”.
Since: 0.1
ApertureViewfinderState
aperture_viewfinder_get_state (ApertureViewfinder *self
);
Gets the state of the ApertureViewfinder. See “state”.
Since: 0.1
void aperture_viewfinder_set_detect_barcodes (ApertureViewfinder *self
,gboolean detect_barcodes
);
Sets whether the ApertureViewfinder should look for barcodes in its camera feed. See “detect-barcodes”.
Before calling this function, use aperture_is_barcode_detection_enabled()
to make sure the barcode detection feature is enabled.
Since: 0.1
gboolean
aperture_viewfinder_get_detect_barcodes
(ApertureViewfinder *self
);
Gets whether the ApertureViewfinder is looking for barcodes in its camera feed.
Since: 0.1
void aperture_viewfinder_take_picture_async (ApertureViewfinder *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Takes a picture.
This may take a while. The resolution might be changed temporarily, autofocusing might take place, etc. Basically everything you'd expect to happen when you click the photo button in a camera app.
When the picture has been taken, callback
will be called. Use
aperture_viewfinder_take_picture_finish()
to get the picture as a
GdkPixbuf.
self |
||
cancellable |
a GCancellable. |
[nullable] |
callback |
a GAsyncReadyCallback to execute upon completion |
|
user_data |
closure data for |
Since: 0.1
GdkPixbuf * aperture_viewfinder_take_picture_finish (ApertureViewfinder *self
,GAsyncResult *result
,GError **error
);
Finishes an operation started by
aperture_viewfinder_take_picture_async()
.
Since: 0.1
void aperture_viewfinder_start_recording_to_file (ApertureViewfinder *self
,const char *file
,GError **error
);
Starts recording a video. The video will be saved to file
.
Call aperture_viewfinder_stop_recording_async()
to stop recording.
Since: 0.1
void aperture_viewfinder_stop_recording_async (ApertureViewfinder *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Stop recording video. callback
will be called when this is complete.
self |
||
cancellable |
a GCancellable. |
[nullable] |
callback |
a GAsyncReadyCallback to execute upon completion |
|
user_data |
closure data for |
Since: 0.1
gboolean aperture_viewfinder_stop_recording_finish (ApertureViewfinder *self
,GAsyncResult *result
,GError **error
);
Finishes an operation started by aperture_viewfinder_stop_recording_async()
.
Since: 0.1
Indicates what the viewfinder is currently doing. Many tasks, like taking a picture, recording video, or switching cameras, requires the viewfinder to be in a particular state.
The ApertureViewfinder is still loading. |
||
The ApertureViewfinder is ready to be used. |
||
The ApertureViewfinder could not find any cameras to use. |
||
An error has occurred and the viewfinder is not usable. |
Since: 0.1
Indicates the error that caused an operation to fail.
Note that functions might set errors from other domains as well. For example, if an error occurs in the GStreamer pipeline during the operation, that error will be passed directly to your async handler.
Another operation is in progress. Wait for it to finish before starting another operation. |
||
There is no recording to stop (applies to |
||
The active camera was disconnected during the operation. |
||
The operation was interrupted by an unknown error. |
||
The viewfinder is not in the |
Since: 0.1
#define APERTURE_MEDIA_CAPTURE_ERROR (aperture_media_capture_error_quark())
Error domain for errors that occur while using an ApertureViewfinder.
“camera”
property“camera” ApertureCamera *
The camera that is currently being used.
Use ApertureDeviceManager to obtain ApertureCamera objects.
To successfully switch cameras, the ApertureViewfinder must be in the
APERTURE_VIEWFINDER_STATE_READY
state. This is because switching camera
sources would interrupt any picture or video that is being taken.
Owner: ApertureViewfinder
Flags: Read / Write
Since: 0.1
“detect-barcodes”
property “detect-barcodes” gboolean
Whether the ApertureViewfinder should detect barcodes.
When a barcode is detected, the ::barcode-detected signal will be emitted.
This only works if barcode detection is enabled. See
aperture_is_barcode_detection_enabled()
. If barcode detection is not
available, the value of this property will always be FALSE
, even if you
try to set it to TRUE
.
Owner: ApertureViewfinder
Flags: Read / Write
Default value: FALSE
Since: 0.1
“state”
property“state” ApertureViewfinderState
What the viewfinder is currently doing.
The state indicates what the viewfinder is currently doing, or sometimes
that an error occurred. Many operations, like taking a picture or starting
a recording, require that the ApertureViewfinder be in the
APERTURE_VIEWFINDER_STATE_READY
state.
Owner: ApertureViewfinder
Flags: Read
Default value: APERTURE_VIEWFINDER_STATE_LOADING
Since: 0.1
“barcode-detected”
signalvoid user_function (ApertureViewfinder *self, ApertureBarcode barcode_type, char *data, gpointer user_data)
Emitted when a barcode is detected in the camera feed.
This will only be emitted if “detect-barcodes” is TRUE
.
Barcodes are only detected when they appear on the feed, not on every frame when they are visible.
self |
||
barcode_type |
the type of barcode |
|
data |
the data encoded in the barcode |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 0.1