Tizen Native API
4.0
|
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()), 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().
Before doing those things you should create handle(mc_server_create()). And if you don't use handle anymore, you have to destroy it(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) |
Updates 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) |
Updates the modified metadata info. | |
int | mc_server_update_shuffle_mode (mc_server_h server, mc_shuffle_mode_e mode) |
Updates 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) TIZEN_DEPRECATED_API |
Sets the callback for receiving playback state command from client. | |
int | mc_server_unset_playback_state_command_received_cb (mc_server_h server) TIZEN_DEPRECATED_API |
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) TIZEN_DEPRECATED_API |
Sets the callback for receiving custom command from client. | |
int | mc_server_unset_custom_command_received_cb (mc_server_h server) TIZEN_DEPRECATED_API |
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) TIZEN_DEPRECATED_API |
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 receives the playback state from the client. | |
typedef void(* | mc_server_custom_command_received_cb )(const char *client_name, const char *command, bundle *data, void *user_data) TIZEN_DEPRECATED_API |
Called when the Server receives 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) TIZEN_DEPRECATED_API |
Called when the Server receives custom command from the client.
- Deprecated:
- Deprecated since 4.0.
This callback is called when server receives custom command from client. If there is reply for command, call mc_server_send_command_reply() function.
- Since :
- 3.0
- Remarks:
- The callback is called in the dbus event loop. data should be released using bundle_free().
The client_name and @ request_id should not be released by the application.
The client_name and @ command can be used only in the callback. To use outside, make a copy.
- Parameters:
-
[in] client_name The app_id of the media controller client. [in] command The received command. [in] data The extra data [in] user_data The user data passed from the mc_server_set_custom_command_received_cb() function
- Precondition:
- 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 receives the playback state from the client.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Remarks:
- The callback is called in the dbus event loop. The client_name should not be released by the application.
The client_name can be used only in the callback. To use outside, make a copy.
- Parameters:
-
[in] client_name The app_id of the media controller client. [in] state The received playback state [in] user_data The user data passed from the mc_server_set_playback_state_command_received_cb() function
- Precondition:
- 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
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Remarks:
- The server should be released using mc_server_destroy(). You can create only one server handle for each process.
- Parameters:
-
[out] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- See also:
- mc_server_destroy()
int mc_server_destroy | ( | mc_server_h | server | ) |
Destroys media controller server.
- Since :
- 3.0
- Parameters:
-
[in] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
METADATA_EXTRACTOR_ERROR_NONE Successful METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid 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.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Remarks:
- When server receive command, this function can be called by mc_server_custom_command_received_cb().
- Parameters:
-
[in] server The handle to media controller server [in] client_name The app_id of the media controller client [in] result_code The result code of custom command [in] data The extra data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- mc_server_set_custom_command_received_cb()
- See also:
- mc_server_create()
- mc_server_destroy()
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.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] callback The callback to be invoked when media controller server receives custom command from client. [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission 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] server The handle to media controller server [in] attribute The key attribute name to set [in] value The value of the attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission 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().
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
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] position The position to set in milliseconds
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- 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().
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.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] state The state to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- 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().
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.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] callback The callback to be invoked when media controller server receives playback command from client. [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()
int mc_server_unset_custom_command_received_cb | ( | mc_server_h | server | ) |
Unsets the callback for receiving custom command from client.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission 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.
- Deprecated:
- Deprecated since 4.0.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()
int mc_server_update_metadata | ( | mc_server_h | server | ) |
Updates the modified metadata info.
If this function is called, the updated metadata will be sent to all clients.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()
int mc_server_update_playback_info | ( | mc_server_h | server | ) |
Updates the modified playback info.
If this function 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] server The handle to media controller server
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()
int mc_server_update_repeat_mode | ( | mc_server_h | server, |
mc_repeat_mode_e | mode | ||
) |
Updates the modified repeat mode.
If this function is called, the updated mode information will be sent to all clients.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] mode The repeat mode to update the latest status
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()
int mc_server_update_shuffle_mode | ( | mc_server_h | server, |
mc_shuffle_mode_e | mode | ||
) |
Updates the modified shuffle mode.
If this function is called, the updated mode information will be sent to all clients.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/mediacontroller.server
- Parameters:
-
[in] server The handle to media controller server [in] mode The shuffle mode to update the latest status
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTROLLER_ERROR_NONE Successful MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a media controller server handle by calling mc_server_create().
- See also:
- mc_server_create()
- mc_server_destroy()