Tizen Native API  3.0
Media Controller Server

The Media Controller Server API provides functions for sending the server information to the client.

Required Header

#include <media_controller_server.h>

Overview

The Media Controller Server API allows you to send the playback info(mc_server_set_playback_state(), mc_server_set_playback_position), or the metadata(mc_server_set_metadata()). and to receive the custom command(mc_server_set_custom_command_received_cb()), to update the status information on the latest server(mc_server_update_playback_info, mc_server_update_metadata), or to create/destroy the handle(mc_server_create()/mc_server_destroy()).

Functions

int mc_server_create (mc_server_h *server)
 Creates a media controller server.
int mc_server_set_playback_state (mc_server_h server, mc_playback_states_e state)
 Sets the playback state to update the latest state info.
int mc_server_set_playback_position (mc_server_h server, unsigned long long position)
 Sets the playback position to update the latest playback info.
int mc_server_update_playback_info (mc_server_h server)
 Update the modified playback info.
int mc_server_set_metadata (mc_server_h server, mc_meta_e attribute, const char *value)
 Sets the metadata to update the latest metadata info.
int mc_server_update_metadata (mc_server_h server)
 Update the modified metadata info.
int mc_server_update_shuffle_mode (mc_server_h server, mc_shuffle_mode_e mode)
 Update the modified shuffle mode.
int mc_server_update_repeat_mode (mc_server_h server, mc_repeat_mode_e mode)
 Updates the modified repeat mode.
int mc_server_set_playback_state_command_received_cb (mc_server_h server, mc_server_playback_state_command_received_cb callback, void *user_data)
 Sets the callback for receiving playback state command from client.
int mc_server_unset_playback_state_command_received_cb (mc_server_h server)
 Unsets the callback for receiving playback state command from client.
int mc_server_set_custom_command_received_cb (mc_server_h server, mc_server_custom_command_received_cb callback, void *user_data)
 Sets the callback for receiving custom command from client.
int mc_server_unset_custom_command_received_cb (mc_server_h server)
 Unsets the callback for receiving custom command from client.
int mc_server_send_command_reply (mc_server_h server, const char *client_name, int result_code, bundle *data)
 Sends a reply for the requested command to the client.
int mc_server_destroy (mc_server_h server)
 Destroys media controller server.

Typedefs

typedef void(* mc_server_playback_state_command_received_cb )(const char *client_name, mc_playback_states_e state, void *user_data)
 Called when the Server received playback state command from the client.
typedef void(* mc_server_custom_command_received_cb )(const char *client_name, const char *command, bundle *data, void *user_data)
 Called when the Server received custom command from the client.

Typedef Documentation

typedef void(* mc_server_custom_command_received_cb)(const char *client_name, const char *command, bundle *data, void *user_data)

Called when the Server received custom command from the client.

Since :
3.0

This callback is called when server received custom recommand from client. If there is reply for command, call mc_server_send_command_reply() function.

Remarks:
The callback is called in the dbus event loop.
Parameters:
[in]client_nameThe app_id of the media controller client
[in]commandThe received command
[in]dataThe extra data
[in]user_dataThe user data passed from the mc_server_set_custom_command_received_cb() fuction
Precondition:
mc_server_set_custom_command_received_cb()
See also:
mc_server_set_custom_command_received_cb()
typedef void(* mc_server_playback_state_command_received_cb)(const char *client_name, mc_playback_states_e state, void *user_data)

Called when the Server received playback state command from the client.

Since :
3.0

This callback is called when server received playback state recommand from client.

Remarks:
The callback is called in the dbus event loop.
Parameters:
[in]client_nameThe app_id of the media controller client
[in]stateThe received playback state
[in]user_dataThe user data passed from the mc_server_set_playback_state_command_received_cb() fuction
Precondition:
mc_server_set_playback_state_command_received_cb()
See also:
mc_server_set_playback_state_command_received_cb()

Function Documentation

int mc_server_create ( mc_server_h server)

Creates a media controller server.

Since :
3.0
Remarks:
You must release server using mc_server_destroy().
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[out]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYNot enough memory is available
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
See also:
mc_server_destroy()
int mc_server_destroy ( mc_server_h  server)

Destroys media controller server.

Since :
3.0
Parameters:
[in]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
int mc_server_send_command_reply ( mc_server_h  server,
const char *  client_name,
int  result_code,
bundle data 
)

Sends a reply for the requested command to the client.

Since :
3.0
Remarks:
When server recieve command, this API can be called by mc_server_custom_command_received_cb().
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]client_nameThe app_id of the media controller client
[in]result_codeThe result code of custom command
[in]dataThe extra data
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
mc_server_command_received_cb()
See also:
mc_server_create()
mc_server_destroy()

Sets the callback for receiving custom command from client.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]callbackThe callback to be invoked when media controller server receives custom command from client.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()
int mc_server_set_metadata ( mc_server_h  server,
mc_meta_e  attribute,
const char *  value 
)

Sets the metadata to update the latest metadata info.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]attributeThe key attribute name to set
[in]valueThe value of the attribute
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
Postcondition:
Apply the updated metadata information by calling mc_server_update_metadata().
See also:
mc_server_create()
mc_server_destroy()
mc_server_update_metadata()
int mc_server_set_playback_position ( mc_server_h  server,
unsigned long long  position 
)

Sets the playback position to update the latest playback info.

Since :
3.0
Parameters:
[in]serverThe handle to media controller server
[in]positionThe position to set in milliseconds
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
Precondition:
Create a media controller server handle by calling mc_server_create().
Postcondition:
Apply the updated playback information by calling mc_server_update_playback_info().
See also:
mc_server_create()
mc_server_destroy()
mc_server_update_playback_info()

Sets the playback state to update the latest state info.

Since :
3.0
Parameters:
[in]serverThe handle to media controller server
[in]stateThe state to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
Precondition:
Create a media controller server handle by calling mc_server_create().
Postcondition:
Apply the updated playback information by calling mc_server_update_playback_info().
See also:
mc_server_create()
mc_server_destroy()
mc_server_update_playback_info()

Sets the callback for receiving playback state command from client.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]callbackThe callback to be invoked when media controller server receives playback command from client.
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Unsets the callback for receiving custom command from client.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Unsets the callback for receiving playback state command from client.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Update the modified metadata info.

If this API is called, the updated metadata will be sent to all controllers.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Update the modified playback info.

If this API is called, the updated playback information will be sent to the controller.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Updates the modified repeat mode.

If this API is called, the updated mode information will be sent to all controllers.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]modeThe repeat mode to update the latest status
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()

Update the modified shuffle mode.

If this API is called, the updated mode information will be sent to all controllers.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/mediacontroller.server
Parameters:
[in]serverThe handle to media controller server
[in]modeThe shuffle mode to update the latest status
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORYFile does not exist
MEDIA_CONTROLLER_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Create a media controller server handle by calling mc_server_create().
See also:
mc_server_create()
mc_server_destroy()