Tizen Native API
8.0
|
The Clip API provides functions to manage clips.
Required Header
#include <media_editor.h>
Overview
The Mediaeditor Clip API allows you to:
- add/remove media clips to internal timeline
- split media clips with user given time position
- group/ungroup media clips
- get/set clip start, duration, resolution, volume
Functions | |
int | mediaeditor_add_clip (mediaeditor_h editor, const char *path, unsigned int layer_id, int start, unsigned int duration, unsigned int in_point, unsigned int *clip_id) |
Adds a clip to timeline. | |
int | mediaeditor_remove_clip (mediaeditor_h editor, unsigned int clip_id) |
Removes a clip from timeline. | |
int | mediaeditor_split_clip (mediaeditor_h editor, unsigned int src_clip_id, unsigned int position, unsigned int *new_clip_id) |
Splits a clip. | |
int | mediaeditor_group_clip (mediaeditor_h editor, unsigned int *clip_ids, unsigned int size, unsigned int *group_id) |
Groups clips. | |
int | mediaeditor_ungroup_clip (mediaeditor_h editor, unsigned int group_id, unsigned int **clip_ids, unsigned int *size) |
Ungroups a clip. | |
int | mediaeditor_move_clip_layer (mediaeditor_h editor, unsigned int clip_id, unsigned int layer_priority) |
Moves a clip to different layer. | |
int | mediaeditor_get_clip_start (mediaeditor_h editor, unsigned int clip_id, unsigned int *start) |
Gets the start position of clip. | |
int | mediaeditor_set_clip_start (mediaeditor_h editor, unsigned int clip_id, unsigned int start) |
Sets the start position of clip. | |
int | mediaeditor_get_clip_duration (mediaeditor_h editor, unsigned int clip_id, unsigned int *duration) |
Gets the duration of clip. | |
int | mediaeditor_set_clip_duration (mediaeditor_h editor, unsigned int clip_id, unsigned int duration) |
Sets the duration of clip. | |
int | mediaeditor_get_clip_in_point (mediaeditor_h editor, unsigned int clip_id, unsigned int *in_point) |
Gets the offset of clip. | |
int | mediaeditor_set_clip_in_point (mediaeditor_h editor, unsigned int clip_id, unsigned int in_point) |
Sets the offset of clip. | |
int | mediaeditor_get_clip_resolution (mediaeditor_h editor, unsigned int clip_id, unsigned int *width, unsigned int *height) |
Gets the resolution of clip. | |
int | mediaeditor_set_clip_resolution (mediaeditor_h editor, unsigned int clip_id, unsigned int width, unsigned int height) |
Sets the resolution of clip. | |
int | mediaeditor_get_clip_position (mediaeditor_h editor, unsigned int clip_id, unsigned int *pos_x, unsigned int *pos_y) |
Gets the position of clip. | |
int | mediaeditor_set_clip_position (mediaeditor_h editor, unsigned int clip_id, unsigned int pos_x, unsigned int pos_y) |
Sets the position of clip. | |
int | mediaeditor_get_clip_volume (mediaeditor_h editor, unsigned int clip_id, double *volume) |
Gets the volume of clip. | |
int | mediaeditor_set_clip_volume (mediaeditor_h editor, unsigned int clip_id, double volume) |
Sets the volume of clip. |
Function Documentation
int mediaeditor_add_clip | ( | mediaeditor_h | editor, |
const char * | path, | ||
unsigned int | layer_id, | ||
int | start, | ||
unsigned int | duration, | ||
unsigned int | in_point, | ||
unsigned int * | clip_id | ||
) |
Adds a clip to timeline.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediastorage
- Privilege:
- http://tizen.org/privilege/externalstorage
- Remarks:
- If you want to access only internal storage by using this function, you should add privilege http://tizen.org/privilege/mediastorage.
Or if you want to access only external storage by using this function, you should add privilege http://tizen.org/privilege/externalstorage.
If you want to access both storage, you must add both privileges.
- Parameters:
-
[in] editor The media editor handle [in] path The content location to add [in] layer_id The layer ID to add clip [in] start The start time of path clip which is placed in timeline (in milliseconds)
If this is less than 0, clip will be added to the end of layer. i.e. it will be set to layer's duration[in] duration The duration that the clip is in effect for in the timeline (in milliseconds)
It should be lesser than or equal to clip's duration. If not, error will be occurred in runtime.
The clip should have enough internal content greater than duration.[in] in_point The initial offset of path clip to use internally when outputting content (in milliseconds) [out] clip_id The ID of added clip. It'll be used when you want to delete this clip.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_PERMISSION_DENIED Permission denied MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- The layer must be added by calling mediaeditor_add_layer().
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_get_clip_duration | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int * | duration | ||
) |
Gets the duration of clip.
- Since :
- 7.0
- Remarks:
- duration will return value set by mediaeditor_add_clip() or mediaeditor_set_clip_duration().
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [out] duration The current time duration of clip (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter
int mediaeditor_get_clip_in_point | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int * | in_point | ||
) |
Gets the offset of clip.
- Since :
- 7.0
- Remarks:
- in_point will return value set by mediaeditor_add_clip() or mediaeditor_set_clip_in_point().
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID that will be changed [out] in_point The offset of clip to use internally when outputting content (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation
int mediaeditor_get_clip_position | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int * | pos_x, | ||
unsigned int * | pos_y | ||
) |
Gets the position of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have video, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
The default position is the top-left corner(0, 0).
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [out] pos_x The horizontal position [out] pos_y The vertical position
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation
int mediaeditor_get_clip_resolution | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int * | width, | ||
unsigned int * | height | ||
) |
Gets the resolution of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have video, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
width and height will return its original size if it's not changed by mediaeditor_set_clip_resolution().
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [out] width The width [out] height The height
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation
int mediaeditor_get_clip_start | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int * | start | ||
) |
Gets the start position of clip.
- Since :
- 7.0
- Remarks:
- start will return value set by mediaeditor_add_clip() or mediaeditor_set_clip_start().
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [out] start The current start position of clip (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter
int mediaeditor_get_clip_volume | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
double * | volume | ||
) |
Gets the volume of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have audio, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [out] volume The current audio volume (0.0 ~ 10.0) The default value is 1.0 (100%)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation
int mediaeditor_group_clip | ( | mediaeditor_h | editor, |
unsigned int * | clip_ids, | ||
unsigned int | size, | ||
unsigned int * | group_id | ||
) |
Groups clips.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_ids The clip IDs to be grouped. Array. [in] size The number of clips [out] group_id The grouped clip ID.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_move_clip_layer | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | layer_priority | ||
) |
Moves a clip to different layer.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID that will be moved [in] layer_priority The destination layer priority
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
- See also:
- mediaeditor_add_clip()
int mediaeditor_remove_clip | ( | mediaeditor_h | editor, |
unsigned int | clip_id | ||
) |
Removes a clip from timeline.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID that will be removed.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
- See also:
- mediaeditor_add_clip()
int mediaeditor_set_clip_duration | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | duration | ||
) |
Sets the duration of clip.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID that will be changed [in] duration The new time duration (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_set_clip_in_point | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | in_point | ||
) |
Sets the offset of clip.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [in] in_point The offset of clip to use internally when outputting content (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_set_clip_position | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | pos_x, | ||
unsigned int | pos_y | ||
) |
Sets the position of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have video, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [in] pos_x The horizontal position [in] pos_y The vertical position
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_set_clip_resolution | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | width, | ||
unsigned int | height | ||
) |
Sets the resolution of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have video, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [in] width The width [in] height The height
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_set_clip_start | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
unsigned int | start | ||
) |
Sets the start position of clip.
- Since :
- 7.0
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID that will be changed [in] start The new start position (in milliseconds)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_set_clip_volume | ( | mediaeditor_h | editor, |
unsigned int | clip_id, | ||
double | volume | ||
) |
Sets the volume of clip.
- Since :
- 7.0
- Remarks:
- If the clip doesn't have audio, MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.
- Parameters:
-
[in] editor The media editor handle [in] clip_id The clip ID [in] volume The new audio volume (0.0 ~ 10.0)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
int mediaeditor_split_clip | ( | mediaeditor_h | editor, |
unsigned int | src_clip_id, | ||
unsigned int | position, | ||
unsigned int * | new_clip_id | ||
) |
Splits a clip.
- Since :
- 7.0
- Remarks:
- After splitting the clip into two clips, the source clip's duration will be changed.
- Parameters:
-
[in] editor The media editor handle [in] src_clip_id The current clip ID that will be split. [in] position The time position at which the source clip will be split. (in milliseconds) [out] new_clip_id The newly created clip ID.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
- See also:
- mediaeditor_add_clip()
int mediaeditor_ungroup_clip | ( | mediaeditor_h | editor, |
unsigned int | group_id, | ||
unsigned int ** | clip_ids, | ||
unsigned int * | size | ||
) |
Ungroups a clip.
- Since :
- 7.0
- Remarks:
- Layer priorities of ungrouped clips are the same as before grouping.
If there's no matched group_id, MEDIAEDITOR_ERROR_INVALID_PARAMETER will be returned.
clip_ids should be released using free().
- Parameters:
-
[in] editor The media editor handle [in] group_id The grouped clip ID [out] clip_ids The ungrouped clip IDs. Array [out] size The size of ungrouped clips
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIAEDITOR_ERROR_NONE Successful MEDIAEDITOR_ERROR_INVALID_PARAMETER Invalid parameter MEDIAEDITOR_ERROR_INVALID_OPERATION Invalid operation MEDIAEDITOR_ERROR_INVALID_STATE Invalid state
- Precondition:
- editor state must be set to MEDIAEDITOR_STATE_IDLE.
- See also:
- mediaeditor_group_clip()