Tizen Native API  5.0
Media Controller Search

The Media Controller Search API provides functions for search for the media controller server.

Required Header

#include <media_controller_metadata.h>

Overview

The Media Controller Search API allows you to create handle for searching (mc_search_create()).
You can set and get search conditions (mc_search_set_condition() and mc_search_foreach_condition()).
And copy the search by using mc_search_clone(). And if you don't use handle anymore, you have to destroy it(mc_search_destroy()).

Functions

int mc_search_create (mc_search_h *search)
 Creates a media controller search handle.
int mc_search_set_condition (mc_search_h search, mc_content_type_e content_type, mc_search_category_e category, const char *search_keyword, bundle *data)
 Sets the information to search.
int mc_search_destroy (mc_search_h search)
 Destroys search.
int mc_search_foreach_condition (mc_search_h search, mc_search_condition_cb callback, void *user_data)
 Retrieves all search conditions.
int mc_search_clone (mc_search_h src, mc_search_h *dst)
 Clones a media controller search handle.

Typedefs

typedef bool(* mc_search_condition_cb )(mc_content_type_e content_type, mc_search_category_e category, const char *search_keyword, bundle *data, void *user_data)
 Called for every search condition information in the obtained list of search.

Typedef Documentation

typedef bool(* mc_search_condition_cb)(mc_content_type_e content_type, mc_search_category_e category, const char *search_keyword, bundle *data, void *user_data)

Called for every search condition information in the obtained list of search.

Iterates over a search list.

Since :
5.0
Remarks:
The callback is called in the main loop. The search_keyword and data should not be released by the application.
The search_keyword and data can be used only in the callback. To use outside, make a copy.
Parameters:
[in]content_typeThe content type to search
[in]categoryThe category to search
[in]search_keywordThe key word to search
[in]dataThe extra data
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop, otherwise false to break out of the loop
Precondition:
mc_search_foreach_condition() will invoke this function.
See also:
mc_search_foreach_condition()

Function Documentation

int mc_search_clone ( mc_search_h  src,
mc_search_h dst 
)

Clones a media controller search handle.

This function copies the media controller search handle from a source to destination. The mc_search_h is created internally and available through media controller search functions.

Since :
5.0
Remarks:
The dst should be released using mc_search_destroy().
Parameters:
[in]srcThe source handle to the media controller search
[out]dstThe destination handle to the media controller search
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_MEMORYOut of memory
See also:
mc_search_destroy()
int mc_search_create ( mc_search_h search)

Creates a media controller search handle.

Since :
5.0
Remarks:
The search should be released using mc_search_destroy().
Parameters:
[out]searchThe handle to search
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_MEMORYOut of memory
See also:
mc_search_set_condition()
mc_search_foreach_condition()
int mc_search_destroy ( mc_search_h  search)

Destroys search.

Since :
5.0
Parameters:
[in]searchThe handle to search
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTROLLER_ERROR_NONESuccessful
MEDIA_CONTROLLER_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTROLLER_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
Create a media controller search handle by calling mc_search_create().
See also:
mc_search_create()
int mc_search_foreach_condition ( mc_search_h  search,
mc_search_condition_cb  callback,
void *  user_data 
)

Retrieves all search conditions.

This function gets all search conditions set. The callback function will be invoked for every retrieved search condition. If there were no search conditions set with mc_search_set_condition(), this function will return MEDIA_CONTROLLER_ERROR_NONE, and the callback will not be invoked.

Since :
5.0
Parameters:
[in]searchThe handle to search
[in]callbackThe callback function to be invoked.
[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
Precondition:
Create a media controller search handle by calling mc_search_create().
Set the search conditions by calling mc_search_set_condition().
See also:
mc_search_create()
mc_search_set_condition()
int mc_search_set_condition ( mc_search_h  search,
mc_content_type_e  content_type,
mc_search_category_e  category,
const char *  search_keyword,
bundle data 
)

Sets the information to search.

Sets the information to search. You can set various search condition by calling this function for the same search handle.
But it's not allowed to set more than 20 conditions. If you try to set more than 20 conditions, this function will return MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER.

Since :
5.0
Parameters:
[in]searchThe handle to search
[in]content_typeThe content type to search
[in]categoryThe category to search
[in]search_keywordThe key word to search
[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_OUT_OF_MEMORYOut of memory
Precondition:
mc_search_create()
See also:
mc_search_foreach_condition()