Tizen Native API  7.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]editorThe media editor handle
[in]pathThe content location to add
[in]layer_idThe layer ID to add clip
[in]startThe starting position 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]durationThe 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_pointThe initial offset of path clip to use internally when outputting content (in milliseconds)
[out]clip_idThe 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_NONESuccessful
MEDIAEDITOR_ERROR_PERMISSION_DENIEDPermission denied
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
The layer must be added by calling mediaeditor_add_layer().
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_layer()
mediaeditor_remove_clip()
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]editorThe media editor handle
[in]clip_idThe clip ID
[out]durationThe current time duration of clip (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_start()
mediaeditor_set_clip_start()
mediaeditor_set_clip_duration()
mediaeditor_get_clip_in_point()
mediaeditor_set_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID that will be changed
[out]in_pointThe offset of clip to use internally when outputting content (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_start()
mediaeditor_set_clip_start()
mediaeditor_get_clip_duration()
mediaeditor_set_clip_duration()
mediaeditor_set_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID
[out]pos_xThe horizontal position
[out]pos_yThe vertical position
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
See also:
mediaeditor_add_clip()
mediaeditor_set_clip_position()
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]editorThe media editor handle
[in]clip_idThe clip ID
[out]widthThe width
[out]heightThe height
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
See also:
mediaeditor_add_clip()
mediaeditor_set_clip_resolution()
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]editorThe media editor handle
[in]clip_idThe clip ID
[out]startThe current start position of clip (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
See also:
mediaeditor_add_clip()
mediaeditor_set_clip_start()
mediaeditor_get_clip_duration()
mediaeditor_set_clip_duration()
mediaeditor_get_clip_in_point()
mediaeditor_set_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID
[out]volumeThe 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_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
See also:
mediaeditor_add_clip()
mediaeditor_set_clip_volume()
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]editorThe media editor handle
[in]clip_idsThe clip IDs to be grouped. Array.
[in]sizeThe number of clips
[out]group_idThe grouped clip ID.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_ungroup_clip()
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]editorThe media editor handle
[in]clip_idThe clip ID that will be moved
[in]layer_priorityThe destination layer priority
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid 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]editorThe media editor handle
[in]clip_idThe clip ID that will be removed.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid 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]editorThe media editor handle
[in]clip_idThe clip ID that will be changed
[in]durationThe new time duration (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_start()
mediaeditor_set_clip_start()
mediaeditor_get_clip_duration()
mediaeditor_get_clip_in_point()
mediaeditor_set_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID
[in]in_pointThe offset of clip to use internally when outputting content (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_start()
mediaeditor_set_clip_start()
mediaeditor_get_clip_duration()
mediaeditor_set_clip_duration()
mediaeditor_get_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID
[in]pos_xThe horizontal position
[in]pos_yThe vertical position
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_position()
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]editorThe media editor handle
[in]clip_idThe clip ID
[in]widthThe width
[in]heightThe height
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_resolution()
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]editorThe media editor handle
[in]clip_idThe clip ID that will be changed
[in]startThe new start position (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_start()
mediaeditor_get_clip_duration()
mediaeditor_set_clip_duration()
mediaeditor_get_clip_in_point()
mediaeditor_set_clip_in_point()
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]editorThe media editor handle
[in]clip_idThe clip ID
[in]volumeThe new audio volume (0.0 ~ 10.0)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_add_clip()
mediaeditor_get_clip_volume()
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]editorThe media editor handle
[in]src_clip_idThe current clip ID that will be split.
[in]positionThe time position at which the source clip will be split. (in milliseconds)
[out]new_clip_idThe newly created clip ID.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid 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]editorThe media editor handle
[in]group_idThe grouped clip ID
[out]clip_idsThe ungrouped clip IDs. Array
[out]sizeThe size of ungrouped clips
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIAEDITOR_ERROR_NONESuccessful
MEDIAEDITOR_ERROR_INVALID_PARAMETERInvalid parameter
MEDIAEDITOR_ERROR_INVALID_OPERATIONInvalid operation
MEDIAEDITOR_ERROR_INVALID_STATEInvalid state
Precondition:
editor state must be set to MEDIAEDITOR_STATE_IDLE.
See also:
mediaeditor_group_clip()