2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifdef _USE_TV_PROFILE
18 #include <media_content.h>
19 #include <media_content_internal.h>
20 #include <media_info_private.h>
21 #include <media_util_private.h>
22 #include <media_pvr.h>
25 int media_pvr_get_media_count_from_db(filter_h filter, int *media_count)
27 int ret = MEDIA_CONTENT_ERROR_NONE;
30 ret = _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_PVR, media_count);
32 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
33 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
39 int media_pvr_foreach_media_from_db(filter_h filter, media_pvr_cb callback, void *user_data)
41 int ret = MEDIA_CONTENT_ERROR_NONE;
43 if (callback != NULL) {
44 ret = _media_db_get_pvr(filter, callback, user_data);
46 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
47 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
53 int media_pvr_destroy(media_pvr_h pvr)
55 int ret = MEDIA_CONTENT_ERROR_NONE;
56 media_pvr_s *_pvr = (media_pvr_s*)pvr;
58 SAFE_FREE(_pvr->media_id);
59 SAFE_FREE(_pvr->storage_id);
60 SAFE_FREE(_pvr->channel_name);
61 SAFE_FREE(_pvr->channel_num);
62 SAFE_FREE(_pvr->program_title);
63 SAFE_FREE(_pvr->program_crid);
64 SAFE_FREE(_pvr->guidance);
65 SAFE_FREE(_pvr->synopsis);
66 SAFE_FREE(_pvr->genre);
67 SAFE_FREE(_pvr->language);
68 SAFE_FREE(_pvr->path);
69 SAFE_FREE(_pvr->modified_month);
70 SAFE_FREE(_pvr->private_data);
73 ret = MEDIA_CONTENT_ERROR_NONE;
75 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
76 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
82 int media_pvr_clone(media_pvr_h *dst, media_pvr_h src)
84 int ret = MEDIA_CONTENT_ERROR_NONE;
85 media_pvr_s *_src = (media_pvr_s*)src;
88 media_pvr_s *_dst = (media_pvr_s*)calloc(1, sizeof(media_pvr_s));
90 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
91 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
94 if (STRING_VALID(_src->media_id)) {
95 _dst->media_id = strdup(_src->media_id);
96 if (_dst->media_id == NULL) {
97 media_pvr_destroy((media_pvr_h)_dst);
98 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
99 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
103 if (STRING_VALID(_src->channel_name)) {
104 _dst->channel_name = strdup(_src->channel_name);
105 if (_dst->channel_name == NULL) {
106 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
107 media_pvr_destroy((media_pvr_h)_dst);
108 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
112 if (STRING_VALID(_src->channel_num)) {
113 _dst->channel_num = strdup(_src->channel_num);
114 if (_dst->channel_num == NULL) {
115 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
116 media_pvr_destroy((media_pvr_h)_dst);
117 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
121 if (STRING_VALID(_src->program_title)) {
122 _dst->program_title = strdup(_src->program_title);
123 if (_dst->program_title == NULL) {
124 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
125 media_pvr_destroy((media_pvr_h)_dst);
126 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
130 if (STRING_VALID(_src->program_crid)) {
131 _dst->program_crid = strdup(_src->program_crid);
132 if (_dst->program_crid == NULL) {
133 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
134 media_pvr_destroy((media_pvr_h)_dst);
135 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
139 if (STRING_VALID(_src->guidance)) {
140 _dst->guidance = strdup(_src->guidance);
141 if (_dst->guidance == NULL) {
142 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
143 media_pvr_destroy((media_pvr_h)_dst);
144 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
148 if (STRING_VALID(_src->synopsis)) {
149 _dst->synopsis = strdup(_src->synopsis);
150 if (_dst->synopsis == NULL) {
151 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
152 media_pvr_destroy((media_pvr_h)_dst);
153 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
157 if (STRING_VALID(_src->genre)) {
158 _dst->genre = strdup(_src->genre);
159 if (_dst->genre == NULL) {
160 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
161 media_pvr_destroy((media_pvr_h)_dst);
162 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
166 if (STRING_VALID(_src->language)) {
167 _dst->language = strdup(_src->language);
168 if (_dst->language == NULL) {
169 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
170 media_pvr_destroy((media_pvr_h)_dst);
171 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
175 if (STRING_VALID(_src->path)) {
176 _dst->path = strdup(_src->path);
177 if (_dst->path == NULL) {
178 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
179 media_pvr_destroy((media_pvr_h)_dst);
180 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
184 if (STRING_VALID(_src->storage_id)) {
185 _dst->storage_id = strdup(_src->storage_id);
186 if (_dst->storage_id == NULL) {
187 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
188 media_pvr_destroy((media_pvr_h)_dst);
189 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
193 if (STRING_VALID(_src->modified_month)) {
194 _dst->modified_month = strdup(_src->modified_month);
195 if (_dst->modified_month == NULL) {
196 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
197 media_pvr_destroy((media_pvr_h)_dst);
198 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
202 if (STRING_VALID(_src->private_data)) {
203 _dst->private_data = strdup(_src->private_data);
204 if (_dst->private_data == NULL) {
205 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
206 media_pvr_destroy((media_pvr_h)_dst);
207 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
210 _dst->duration = _src->duration;
211 _dst->timezone = _src->timezone;
212 _dst->ptc = _src->ptc;
213 _dst->major = _src->major;
214 _dst->minor = _src->minor;
215 _dst->channel_type = _src->channel_type;
216 _dst->program_num = _src->program_num;
217 _dst->timer_record = _src->timer_record;
218 _dst->series_record = _src->series_record;
220 _dst->subtitle = _src->subtitle;
221 _dst->ttx = _src->ttx;
223 _dst->hard_of_hearing_radio = _src->hard_of_hearing_radio;
224 _dst->data_service = _src->data_service;
225 _dst->content_lock = _src->content_lock;
226 _dst->embargo_time = _src->embargo_time;
227 _dst->expiry_time = _src->expiry_time;
228 _dst->size = _src->size;
229 _dst->parental_rating = _src->parental_rating;
230 _dst->start_time = _src->start_time;
231 _dst->program_start_time = _src->program_start_time;
232 _dst->program_end_time = _src->program_end_time;
233 _dst->program_date = _src->program_date;
234 _dst->content_watch = _src->content_watch;
235 _dst->has_audio_only = _src->has_audio_only;
236 _dst->is_local_record = _src->is_local_record;
237 _dst->resolution = _src->resolution;
238 _dst->aspectratio = _src->aspectratio;
239 _dst->sports_type = _src->sports_type;
240 _dst->guidance_length = _src->guidance_length;
241 _dst->tvmode = _src->tvmode;
242 _dst->play_count = _src->play_count;
244 *dst = (media_pvr_h)_dst;
246 ret = MEDIA_CONTENT_ERROR_NONE;
248 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
249 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
255 int media_pvr_get_pvr_from_db(const char *media_id, media_pvr_h *pvr)
257 int ret = MEDIA_CONTENT_ERROR_NONE;
258 char *select_query = NULL;
259 sqlite3_stmt *stmt = NULL;
261 if (!STRING_VALID(media_id) || (pvr == NULL)) {
262 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
263 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
266 select_query = sqlite3_mprintf(SELECT_PVR_FROM_PVR, media_id);
268 ret = _content_query_prepare(&stmt, select_query, NULL, NULL);
269 sqlite3_free(select_query);
270 media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
272 media_pvr_s *_pvr = NULL;
274 while (sqlite3_step(stmt) == SQLITE_ROW) {
276 media_pvr_destroy((media_pvr_h)_pvr);
278 _pvr = (media_pvr_s*)calloc(1, sizeof(media_pvr_s));
281 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
282 SQLITE3_FINALIZE(stmt);
283 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
286 _media_pvr_item_get_detail(stmt, (media_pvr_h)_pvr);
288 *pvr = (media_info_h)_pvr;
291 SQLITE3_FINALIZE(stmt);
296 int media_pvr_get_media_id(media_pvr_h pvr, char **media_id)
298 int ret = MEDIA_CONTENT_ERROR_NONE;
299 media_pvr_s *_pvr = (media_pvr_s*)pvr;
301 if (_pvr && media_id) {
302 if (STRING_VALID(_pvr->media_id)) {
303 *media_id = strdup(_pvr->media_id);
304 if (*media_id == NULL) {
305 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
306 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
312 ret = MEDIA_CONTENT_ERROR_NONE;
314 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
315 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
321 int media_pvr_get_channel_name(media_pvr_h pvr, char **channel_name)
323 int ret = MEDIA_CONTENT_ERROR_NONE;
324 media_pvr_s *_pvr = (media_pvr_s*)pvr;
326 if (_pvr && channel_name) {
327 if (STRING_VALID(_pvr->channel_name)) {
328 *channel_name = strdup(_pvr->channel_name);
329 if (*channel_name == NULL) {
330 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
331 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
334 *channel_name = NULL;
337 ret = MEDIA_CONTENT_ERROR_NONE;
339 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
340 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
346 int media_pvr_get_channel_num(media_pvr_h pvr, char **channel_num)
348 int ret = MEDIA_CONTENT_ERROR_NONE;
349 media_pvr_s *_pvr = (media_pvr_s*)pvr;
351 if (_pvr && channel_num) {
352 if (STRING_VALID(_pvr->channel_num)) {
353 *channel_num = strdup(_pvr->channel_num);
354 if (*channel_num == NULL) {
355 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
356 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
362 ret = MEDIA_CONTENT_ERROR_NONE;
364 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
365 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
371 int media_pvr_get_program_title(media_pvr_h pvr, char **program_title)
373 int ret = MEDIA_CONTENT_ERROR_NONE;
374 media_pvr_s *_pvr = (media_pvr_s*)pvr;
376 if (_pvr && program_title) {
377 if (STRING_VALID(_pvr->program_title)) {
378 *program_title = strdup(_pvr->program_title);
379 if (*program_title == NULL) {
380 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
381 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
384 *program_title = NULL;
387 ret = MEDIA_CONTENT_ERROR_NONE;
389 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
390 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
396 int media_pvr_get_program_crid(media_pvr_h pvr, char **program_crid)
398 int ret = MEDIA_CONTENT_ERROR_NONE;
399 media_pvr_s *_pvr = (media_pvr_s*)pvr;
401 if (_pvr && program_crid) {
402 if (STRING_VALID(_pvr->program_crid)) {
403 *program_crid = strdup(_pvr->program_crid);
404 if (*program_crid == NULL) {
405 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
406 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
409 *program_crid = NULL;
412 ret = MEDIA_CONTENT_ERROR_NONE;
414 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
415 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
421 int media_pvr_get_guidance(media_pvr_h pvr, char **guidance)
423 int ret = MEDIA_CONTENT_ERROR_NONE;
424 media_pvr_s *_pvr = (media_pvr_s*)pvr;
426 if (_pvr && guidance) {
427 if (STRING_VALID(_pvr->guidance)) {
428 *guidance = strdup(_pvr->guidance);
429 if (*guidance == NULL) {
430 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
431 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
437 ret = MEDIA_CONTENT_ERROR_NONE;
439 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
440 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
446 int media_pvr_get_synopsis(media_pvr_h pvr, char **synopsis)
448 int ret = MEDIA_CONTENT_ERROR_NONE;
449 media_pvr_s *_pvr = (media_pvr_s*)pvr;
451 if (_pvr && synopsis) {
452 if (STRING_VALID(_pvr->synopsis)) {
453 *synopsis = strdup(_pvr->synopsis);
454 if (*synopsis == NULL) {
455 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
456 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
462 ret = MEDIA_CONTENT_ERROR_NONE;
464 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
465 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
471 int media_pvr_get_genre(media_pvr_h pvr, char **genre)
473 int ret = MEDIA_CONTENT_ERROR_NONE;
474 media_pvr_s *_pvr = (media_pvr_s*)pvr;
477 if (STRING_VALID(_pvr->genre)) {
478 *genre = strdup(_pvr->genre);
479 if (*genre == NULL) {
480 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
481 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
487 ret = MEDIA_CONTENT_ERROR_NONE;
489 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
490 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
496 int media_pvr_get_language(media_pvr_h pvr, char **language)
498 int ret = MEDIA_CONTENT_ERROR_NONE;
499 media_pvr_s *_pvr = (media_pvr_s*)pvr;
501 if (_pvr && language) {
502 if (STRING_VALID(_pvr->language)) {
503 *language = strdup(_pvr->language);
504 if (*language == NULL) {
505 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
506 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
512 ret = MEDIA_CONTENT_ERROR_NONE;
514 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
515 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
521 int media_pvr_get_path(media_pvr_h pvr, char **path)
523 int ret = MEDIA_CONTENT_ERROR_NONE;
524 media_pvr_s *_pvr = (media_pvr_s*)pvr;
527 if (STRING_VALID(_pvr->path)) {
528 *path = strdup(_pvr->path);
530 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
531 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
537 ret = MEDIA_CONTENT_ERROR_NONE;
539 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
540 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
546 int media_pvr_get_storage_id(media_pvr_h pvr, char **storage_id)
548 int ret = MEDIA_CONTENT_ERROR_NONE;
549 media_pvr_s *_pvr = (media_pvr_s*)pvr;
551 if (_pvr && storage_id) {
552 if (STRING_VALID(_pvr->storage_id)) {
553 *storage_id = strdup(_pvr->storage_id);
554 if (*storage_id == NULL) {
555 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
556 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
562 ret = MEDIA_CONTENT_ERROR_NONE;
564 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
565 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
571 int media_pvr_get_size(media_pvr_h pvr, unsigned long long *size)
573 int ret = MEDIA_CONTENT_ERROR_NONE;
574 media_pvr_s *_pvr = (media_pvr_s*)pvr;
578 ret = MEDIA_CONTENT_ERROR_NONE;
580 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
581 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
587 int media_pvr_get_timezone(media_pvr_h pvr, int *timezone)
589 int ret = MEDIA_CONTENT_ERROR_NONE;
590 media_pvr_s *_pvr = (media_pvr_s*)pvr;
592 if (_pvr && timezone) {
593 *timezone = _pvr->timezone;
594 ret = MEDIA_CONTENT_ERROR_NONE;
596 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
597 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
603 int media_pvr_get_ptc(media_pvr_h pvr, int *ptc)
605 int ret = MEDIA_CONTENT_ERROR_NONE;
606 media_pvr_s *_pvr = (media_pvr_s*)pvr;
610 ret = MEDIA_CONTENT_ERROR_NONE;
612 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
613 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
619 int media_pvr_get_major(media_pvr_h pvr, int *major)
621 int ret = MEDIA_CONTENT_ERROR_NONE;
622 media_pvr_s *_pvr = (media_pvr_s*)pvr;
625 *major = _pvr->major;
626 ret = MEDIA_CONTENT_ERROR_NONE;
628 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
629 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
635 int media_pvr_get_minor(media_pvr_h pvr, int *minor)
637 int ret = MEDIA_CONTENT_ERROR_NONE;
638 media_pvr_s *_pvr = (media_pvr_s*)pvr;
641 *minor = _pvr->minor;
642 ret = MEDIA_CONTENT_ERROR_NONE;
644 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
645 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
651 int media_pvr_get_channel_type(media_pvr_h pvr, int *channel_type)
653 int ret = MEDIA_CONTENT_ERROR_NONE;
654 media_pvr_s *_pvr = (media_pvr_s*)pvr;
656 if (_pvr && channel_type) {
657 *channel_type = _pvr->channel_type;
658 ret = MEDIA_CONTENT_ERROR_NONE;
660 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
661 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
667 int media_pvr_get_program_num(media_pvr_h pvr, int *program_num)
669 int ret = MEDIA_CONTENT_ERROR_NONE;
670 media_pvr_s *_pvr = (media_pvr_s*)pvr;
672 if (_pvr && program_num) {
673 *program_num = _pvr->program_num;
674 ret = MEDIA_CONTENT_ERROR_NONE;
676 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
677 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
683 int media_pvr_get_duration(media_pvr_h pvr, int *duration)
685 int ret = MEDIA_CONTENT_ERROR_NONE;
686 media_pvr_s *_pvr = (media_pvr_s*)pvr;
688 if (_pvr && duration) {
689 *duration = _pvr->duration;
690 ret = MEDIA_CONTENT_ERROR_NONE;
692 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
693 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
699 int media_pvr_get_embargo_time(media_pvr_h pvr, int *embargo_time)
701 int ret = MEDIA_CONTENT_ERROR_NONE;
702 media_pvr_s *_pvr = (media_pvr_s*)pvr;
704 if (_pvr && embargo_time) {
705 *embargo_time = _pvr->embargo_time;
706 ret = MEDIA_CONTENT_ERROR_NONE;
708 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
709 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
715 int media_pvr_get_expiry_time(media_pvr_h pvr, int *expiry_time)
717 int ret = MEDIA_CONTENT_ERROR_NONE;
718 media_pvr_s *_pvr = (media_pvr_s*)pvr;
720 if (_pvr && expiry_time) {
721 *expiry_time = _pvr->expiry_time;
722 ret = MEDIA_CONTENT_ERROR_NONE;
724 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
725 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
731 int media_pvr_get_parental_rating(media_pvr_h pvr, int *parental_rating)
733 int ret = MEDIA_CONTENT_ERROR_NONE;
734 media_pvr_s *_pvr = (media_pvr_s*)pvr;
736 if (_pvr && parental_rating) {
737 *parental_rating = _pvr->parental_rating;
738 ret = MEDIA_CONTENT_ERROR_NONE;
740 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
741 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
747 int media_pvr_get_start_time(media_pvr_h pvr, int *start_time)
749 int ret = MEDIA_CONTENT_ERROR_NONE;
750 media_pvr_s *_pvr = (media_pvr_s*)pvr;
752 if (_pvr && start_time) {
753 *start_time = _pvr->start_time;
754 ret = MEDIA_CONTENT_ERROR_NONE;
756 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
757 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
763 int media_pvr_get_program_start_time(media_pvr_h pvr, int *program_start_time)
765 int ret = MEDIA_CONTENT_ERROR_NONE;
766 media_pvr_s *_pvr = (media_pvr_s*)pvr;
768 if (_pvr && program_start_time) {
769 *program_start_time = _pvr->program_start_time;
770 ret = MEDIA_CONTENT_ERROR_NONE;
772 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
773 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
779 int media_pvr_get_program_end_time(media_pvr_h pvr, int *end_time)
781 int ret = MEDIA_CONTENT_ERROR_NONE;
782 media_pvr_s *_pvr = (media_pvr_s*)pvr;
784 if (_pvr && end_time) {
785 *end_time = _pvr->program_end_time;
786 ret = MEDIA_CONTENT_ERROR_NONE;
788 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
789 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
795 int media_pvr_get_program_date(media_pvr_h pvr, int *program_date)
797 int ret = MEDIA_CONTENT_ERROR_NONE;
798 media_pvr_s *_pvr = (media_pvr_s*)pvr;
800 if (_pvr && program_date) {
801 *program_date = _pvr->program_date;
802 ret = MEDIA_CONTENT_ERROR_NONE;
804 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
805 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
811 int media_pvr_get_timer_record(media_pvr_h pvr, bool* timer_record)
813 int ret = MEDIA_CONTENT_ERROR_NONE;
814 media_pvr_s *_pvr = (media_pvr_s*)pvr;
816 if (_pvr && timer_record) {
817 *timer_record = _pvr->timer_record;
818 ret = MEDIA_CONTENT_ERROR_NONE;
820 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
821 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
827 int media_pvr_get_series_record(media_pvr_h pvr, bool* series_record)
829 int ret = MEDIA_CONTENT_ERROR_NONE;
830 media_pvr_s *_pvr = (media_pvr_s*)pvr;
832 if (_pvr && series_record) {
833 *series_record = _pvr->series_record;
834 ret = MEDIA_CONTENT_ERROR_NONE;
836 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
837 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
843 int media_pvr_get_hd(media_pvr_h pvr, int* hd)
845 int ret = MEDIA_CONTENT_ERROR_NONE;
846 media_pvr_s *_pvr = (media_pvr_s*)pvr;
850 ret = MEDIA_CONTENT_ERROR_NONE;
852 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
853 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
859 int media_pvr_get_subtitle(media_pvr_h pvr, bool* subtitle)
861 int ret = MEDIA_CONTENT_ERROR_NONE;
862 media_pvr_s *_pvr = (media_pvr_s*)pvr;
864 if (_pvr && subtitle) {
865 *subtitle = _pvr->subtitle;
866 ret = MEDIA_CONTENT_ERROR_NONE;
868 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
869 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
875 int media_pvr_get_ttx(media_pvr_h pvr, bool* ttx)
877 int ret = MEDIA_CONTENT_ERROR_NONE;
878 media_pvr_s *_pvr = (media_pvr_s*)pvr;
882 ret = MEDIA_CONTENT_ERROR_NONE;
884 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
885 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
891 int media_pvr_get_ad(media_pvr_h pvr, bool* ad)
893 int ret = MEDIA_CONTENT_ERROR_NONE;
894 media_pvr_s *_pvr = (media_pvr_s*)pvr;
898 ret = MEDIA_CONTENT_ERROR_NONE;
900 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
901 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
907 int media_pvr_get_hard_of_hearing_radio(media_pvr_h pvr, bool* hard_of_hearing_radio)
909 int ret = MEDIA_CONTENT_ERROR_NONE;
910 media_pvr_s *_pvr = (media_pvr_s*)pvr;
912 if (_pvr && hard_of_hearing_radio) {
913 *hard_of_hearing_radio = _pvr->hard_of_hearing_radio;
914 ret = MEDIA_CONTENT_ERROR_NONE;
916 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
917 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
923 int media_pvr_get_data_service(media_pvr_h pvr, bool* data_service)
925 int ret = MEDIA_CONTENT_ERROR_NONE;
926 media_pvr_s *_pvr = (media_pvr_s*)pvr;
928 if (_pvr && data_service) {
929 *data_service = _pvr->data_service;
930 ret = MEDIA_CONTENT_ERROR_NONE;
932 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
933 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
939 int media_pvr_get_content_lock(media_pvr_h pvr, bool* content_lock)
941 int ret = MEDIA_CONTENT_ERROR_NONE;
942 media_pvr_s *_pvr = (media_pvr_s*)pvr;
944 if (_pvr && content_lock) {
945 *content_lock = _pvr->content_lock;
946 ret = MEDIA_CONTENT_ERROR_NONE;
948 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
949 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
955 int media_pvr_get_content_watch(media_pvr_h pvr, bool* content_watch)
957 int ret = MEDIA_CONTENT_ERROR_NONE;
958 media_pvr_s *_pvr = (media_pvr_s*)pvr;
960 if (_pvr && content_watch) {
961 *content_watch = _pvr->content_watch;
962 ret = MEDIA_CONTENT_ERROR_NONE;
964 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
965 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
971 int media_pvr_get_has_audio_only(media_pvr_h pvr, bool* has_audio_only)
973 int ret = MEDIA_CONTENT_ERROR_NONE;
974 media_pvr_s *_pvr = (media_pvr_s*)pvr;
976 if (_pvr && has_audio_only) {
977 *has_audio_only = _pvr->has_audio_only;
978 ret = MEDIA_CONTENT_ERROR_NONE;
980 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
981 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
987 int media_pvr_get_is_local_record(media_pvr_h pvr, bool* is_local_record)
989 int ret = MEDIA_CONTENT_ERROR_NONE;
990 media_pvr_s *_pvr = (media_pvr_s*)pvr;
992 if (_pvr && is_local_record) {
993 *is_local_record = _pvr->is_local_record;
994 ret = MEDIA_CONTENT_ERROR_NONE;
996 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
997 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1003 int media_pvr_get_resolution(media_pvr_h pvr, media_pvr_resolution_e* resolution)
1005 int ret = MEDIA_CONTENT_ERROR_NONE;
1006 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1008 if (_pvr && resolution) {
1009 *resolution = _pvr->resolution;
1010 ret = MEDIA_CONTENT_ERROR_NONE;
1012 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1013 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1019 int media_pvr_get_aspectratio(media_pvr_h pvr, media_pvr_aspectratio_e* aspectratio)
1021 int ret = MEDIA_CONTENT_ERROR_NONE;
1022 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1024 if (_pvr && aspectratio) {
1025 *aspectratio = _pvr->aspectratio;
1026 ret = MEDIA_CONTENT_ERROR_NONE;
1028 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1029 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1035 int media_pvr_get_modified_month(media_pvr_h pvr, char **modified_month)
1037 int ret = MEDIA_CONTENT_ERROR_NONE;
1038 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1040 if (_pvr && modified_month) {
1041 if (STRING_VALID(_pvr->modified_month)) {
1042 *modified_month = strdup(_pvr->modified_month);
1043 if (*modified_month == NULL) {
1044 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
1045 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
1048 *modified_month = NULL;
1051 ret = MEDIA_CONTENT_ERROR_NONE;
1053 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1054 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1060 int media_pvr_get_sports_type(media_pvr_h pvr, int* sports_type)
1062 int ret = MEDIA_CONTENT_ERROR_NONE;
1063 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1065 if (_pvr && sports_type) {
1066 *sports_type = _pvr->sports_type;
1067 ret = MEDIA_CONTENT_ERROR_NONE;
1069 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1070 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1076 int media_pvr_get_guidance_length(media_pvr_h pvr, int* guidance_length)
1078 int ret = MEDIA_CONTENT_ERROR_NONE;
1079 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1081 if (_pvr && guidance_length) {
1082 *guidance_length = _pvr->guidance_length;
1083 ret = MEDIA_CONTENT_ERROR_NONE;
1085 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1086 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1092 int media_pvr_get_tvmode(media_pvr_h pvr, int* tvmode)
1094 int ret = MEDIA_CONTENT_ERROR_NONE;
1095 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1097 if (_pvr && tvmode) {
1098 *tvmode = _pvr->tvmode;
1099 ret = MEDIA_CONTENT_ERROR_NONE;
1101 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1102 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1108 int media_pvr_get_play_count(media_pvr_h pvr, int* play_count)
1110 int ret = MEDIA_CONTENT_ERROR_NONE;
1111 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1113 if (_pvr && play_count) {
1114 *play_count = _pvr->play_count;
1115 ret = MEDIA_CONTENT_ERROR_NONE;
1117 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1118 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1124 int media_pvr_get_private_data(media_pvr_h pvr, char **private_data)
1126 int ret = MEDIA_CONTENT_ERROR_NONE;
1127 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1129 if (_pvr && private_data) {
1130 if (STRING_VALID(_pvr->private_data)) {
1131 *private_data = strdup(_pvr->private_data);
1132 if (*private_data == NULL) {
1133 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
1134 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
1137 *private_data = NULL;
1140 ret = MEDIA_CONTENT_ERROR_NONE;
1142 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1143 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1149 int media_pvr_get_highlight(media_pvr_h pvr, bool *highlight)
1151 int ret = MEDIA_CONTENT_ERROR_NONE;
1152 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1154 if (_pvr && highlight) {
1155 *highlight = _pvr->highlight;
1156 ret = MEDIA_CONTENT_ERROR_NONE;
1158 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1159 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1165 int media_pvr_set_play_count(media_pvr_h pvr, int play_count)
1167 int ret = MEDIA_CONTENT_ERROR_NONE;
1168 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1171 _pvr->play_count = play_count;
1173 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1174 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1180 int media_pvr_set_program_title(media_pvr_h pvr, const char *program_title)
1182 int ret = MEDIA_CONTENT_ERROR_NONE;
1183 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1185 if (_pvr != NULL && STRING_VALID(program_title)) {
1186 SAFE_FREE(_pvr->program_title);
1187 _pvr->program_title = strdup(program_title);
1188 if (_pvr->program_title == NULL) {
1189 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
1190 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
1193 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1194 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1200 int media_pvr_set_content_lock(media_pvr_h pvr, bool content_lock)
1202 int ret = MEDIA_CONTENT_ERROR_NONE;
1203 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1206 _pvr->content_lock = content_lock;
1208 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1209 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1215 int media_pvr_set_content_watch(media_pvr_h pvr, bool content_watch)
1217 int ret = MEDIA_CONTENT_ERROR_NONE;
1218 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1221 _pvr->content_watch = content_watch;
1223 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1224 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1230 int media_pvr_set_highlight(media_pvr_h pvr, bool highlight)
1232 int ret = MEDIA_CONTENT_ERROR_NONE;
1233 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1236 _pvr->highlight = highlight;
1238 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1239 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1245 int media_pvr_update_to_db(media_pvr_h pvr)
1247 int ret = MEDIA_CONTENT_ERROR_NONE;
1248 media_pvr_s *_pvr = (media_pvr_s*)pvr;
1249 char *update_query = NULL;
1251 if (_pvr != NULL && STRING_VALID(_pvr->media_id) && STRING_VALID(_pvr->path)) {
1252 update_query = sqlite3_mprintf(UPDATE_PVR_META_FROM_PVR, _pvr->program_title, _pvr->content_lock, _pvr->content_watch, _pvr->play_count, _pvr->highlight, _pvr->media_id);
1254 ret = _content_query_sql(update_query);
1255 sqlite3_free(update_query);
1257 if (ret == MEDIA_CONTENT_ERROR_NONE)
1258 media_svc_update_pvr_info(_content_get_db_handle(), _pvr->path, _pvr->program_title, _pvr->content_lock);
1260 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1261 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1267 int media_pvr_group_foreach_media_from_db(const char *group_name, media_group_e group, filter_h filter, media_pvr_cb callback, void *user_data)
1269 int ret = MEDIA_CONTENT_ERROR_NONE;
1271 if ((callback == NULL) || (group < MEDIA_PVR_GROUP_DURATION) || (group >= MEDIA_GROUP_MAX)) {
1272 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1273 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1275 ret = _media_db_get_pvr_group_item(group_name, filter, group, callback, user_data);
1281 int media_pvr_set_is_local_record(const char *pvr_path, bool is_local_record)
1283 int ret = MEDIA_CONTENT_ERROR_NONE;
1284 char *update_query = NULL;
1285 char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
1287 if (pvr_path == NULL) {
1288 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1289 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
1292 /*get the storage uuid*/
1293 ret = media_svc_get_storage_id(_content_get_db_handle(), pvr_path, storage_id);
1294 if (ret == MS_MEDIA_ERR_NONE) {
1295 media_content_error("storage uuid [%s]", storage_id);
1296 update_query = sqlite3_mprintf(UPDATE_PVR_LOCAL_RECORD_PVR, is_local_record, pvr_path, storage_id);
1298 ret = _content_query_sql(update_query);
1299 sqlite3_free(update_query);
1301 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
1302 media_content_error("pvr path[%s] error[%d]", pvr_path, ret);
1303 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;