X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmedia_pvr.c;h=ec3b6ab0cebd6935740461b9a202a5d101f49e3a;hb=9c806c722e871290a84ca51a41300152298ca5af;hp=70739f80cc6b77b911c9756f52ac2b2b914360be;hpb=bdaa214f5e9641e64315d0582846ac5010ed419f;p=platform%2Fcore%2Fapi%2Fmedia-content.git diff --git a/src/media_pvr.c b/src/media_pvr.c index 70739f8..ec3b6ab 100755 --- a/src/media_pvr.c +++ b/src/media_pvr.c @@ -212,6 +212,7 @@ int media_pvr_clone(media_pvr_h *dst, media_pvr_h src) _dst->minor = _src->minor; _dst->channel_type = _src->channel_type; _dst->program_num = _src->program_num; + _dst->service_profile = _src->service_profile; _dst->timer_record = _src->timer_record; _dst->series_record = _src->series_record; _dst->hd = _src->hd; @@ -263,16 +264,13 @@ int media_pvr_get_pvr_from_db(const char *media_id, media_pvr_h *pvr) select_query = sqlite3_mprintf(SELECT_PVR_FROM_PVR, media_id); - ret = _content_query_prepare(&stmt, select_query, NULL, NULL); + ret = _content_get_result(select_query, &stmt); sqlite3_free(select_query); media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret); media_pvr_s *_pvr = NULL; - while (sqlite3_step(stmt) == SQLITE_ROW) { - if (_pvr) - media_pvr_destroy((media_pvr_h)_pvr); - + if (sqlite3_step(stmt) == SQLITE_ROW) { _pvr = (media_pvr_s*)calloc(1, sizeof(media_pvr_s)); if (_pvr == NULL) { @@ -284,6 +282,9 @@ int media_pvr_get_pvr_from_db(const char *media_id, media_pvr_h *pvr) _media_pvr_item_get_detail(stmt, (media_pvr_h)_pvr); *pvr = (media_info_h)_pvr; + } else { + media_content_error("Nonexistent media_id[%s]", media_id); + ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; } SQLITE3_FINALIZE(stmt); @@ -678,6 +679,22 @@ int media_pvr_get_program_num(media_pvr_h pvr, int *program_num) return ret; } +int media_pvr_get_service_profile(media_pvr_h pvr, unsigned int *service_profile) +{ + int ret = MEDIA_CONTENT_ERROR_NONE; + media_pvr_s *_pvr = (media_pvr_s*)pvr; + + if (_pvr && service_profile) { + *service_profile = _pvr->service_profile; + ret = MEDIA_CONTENT_ERROR_NONE; + } else { + media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER); + ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; + } + + return ret; +} + int media_pvr_get_duration(media_pvr_h pvr, int *duration) { int ret = MEDIA_CONTENT_ERROR_NONE;