source: svn/newcon3bcm2_21bu/BSEAV/api/src/nexus/bsettop_pvr_util.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 12.9 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2008, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bsettop_pvr_util.c $
11 * $brcm_Revision: 3 $
12 * $brcm_Date: 9/23/08 10:20a $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/api/src/nexus/bsettop_pvr_util.c $
19 *
20 * 3   9/23/08 10:20a jrubio
21 * PR46925: fix typo
22 *
23 * 2   9/15/08 5:36p jrubio
24 * PR46925:  fix PVR_SUPPORT=n compile issue
25 *
26 * 1   6/11/08 7:20p ssood
27 * PR42739: added virtual interface back to the playback module to allow
28 * ip implementation in addition to the regular playback implementation
29 *
30 * File is copied over from legacy Settop API implementation (BSEAV/api/src/pvr/bsettop_pvr_util.c).
31 *
32 ***************************************************************************/
33#include "bsettop_impl.h"
34
35BDBG_MODULE(pvr_util);
36
37void 
38bplayback_params_init(bplayback_params *params, bplayback_t playback) 
39{
40#if NEXUS_HAS_PLAYBACK
41        BDBG_ASSERT(playback);
42        BDBG_ASSERT(playback->iface.params_init);
43        playback->iface.params_init(params, playback);
44#else
45    BSTD_UNUSED(params);
46    BSTD_UNUSED(playback);
47#endif
48                                                 
49        return;
50}
51
52#if NEXUS_HAS_PLAYBACK
53static void 
54bplayback_params_init_dummy(bplayback_params *params, bplayback_t playback) 
55{
56        BSTD_UNUSED(playback);
57        BKNI_Memset(params, 0, sizeof(*params));
58        return ;
59}
60#endif
61
62bstream_t
63bplayback_start(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source, const bplayback_params *params)
64{
65#if NEXUS_HAS_PLAYBACK
66        BDBG_ASSERT(playback);
67        BDBG_ASSERT(playback->iface.start);
68        return playback->iface.start(playback, playpump, mpeg, source, params);
69#else
70    BSTD_UNUSED(playpump);
71    BSTD_UNUSED(playback);
72    BSTD_UNUSED(mpeg);
73    BSTD_UNUSED(source);
74    BSTD_UNUSED(params);
75    return NULL;
76#endif
77}
78
79#if NEXUS_HAS_PLAYBACK
80static bstream_t
81bplayback_start_dummy(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source, const bplayback_params *params)
82{
83        BSTD_UNUSED(playback);
84        BSTD_UNUSED(playpump);
85        BSTD_UNUSED(mpeg);
86        BSTD_UNUSED(source);
87        BSTD_UNUSED(params);
88
89        BSETTOP_ERROR(berr_not_supported);
90        return NULL;
91}
92#endif
93
94bstream_t
95bplayback_start_timeshifting(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source,  const bplayback_params *params, brecord_t record )
96{
97#if NEXUS_HAS_PLAYBACK
98        return playback->iface.start_timeshifting(playback, playpump, mpeg, source, params, record);
99#else
100    BSTD_UNUSED(playpump);
101    BSTD_UNUSED(playback);
102    BSTD_UNUSED(source);
103    BSTD_UNUSED(params);
104    BSTD_UNUSED(record);
105    BSTD_UNUSED(mpeg);
106    return NULL;
107#endif
108}
109
110#if NEXUS_HAS_PLAYBACK
111static bstream_t
112bplayback_start_timeshifting_dummy(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source,  const bplayback_params *params, brecord_t record )
113{
114        BSTD_UNUSED(playback);
115        BSTD_UNUSED(playpump);
116        BSTD_UNUSED(mpeg);
117        BSTD_UNUSED(source);
118        BSTD_UNUSED(params);
119        BSTD_UNUSED(record);
120
121        BSETTOP_ERROR(berr_not_supported);
122        return NULL;
123}
124#endif
125
126bresult
127bplayback_stop_timeshifting(bplayback_t playback)
128{
129#if NEXUS_HAS_PLAYBACK
130        BDBG_ASSERT(playback);
131        BDBG_ASSERT(playback->iface.stop_timeshifting);
132        return playback->iface.stop_timeshifting(playback);
133#else
134    BSTD_UNUSED(playback);
135    return berr_not_available;
136#endif
137}
138
139#if NEXUS_HAS_PLAYBACK
140static bresult
141bplayback_stop_timeshifting_dummy(bplayback_t playback)
142{
143        BSTD_UNUSED(playback);
144        return BSETTOP_ERROR(berr_not_supported);
145}
146#endif
147
148bresult
149bplayback_stop(bplayback_t playback)
150{
151#if NEXUS_HAS_PLAYBACK
152        BDBG_ASSERT(playback);
153        BDBG_ASSERT(playback->iface.stop);
154        return playback->iface.stop(playback);
155#else
156    BSTD_UNUSED(playback);
157    return berr_not_available;
158#endif
159}
160
161#if NEXUS_HAS_PLAYBACK
162static bresult
163bplayback_stop_dummy(bplayback_t playback)
164{
165        BSTD_UNUSED(playback);
166        return BSETTOP_ERROR(berr_not_supported);
167}
168#endif
169
170bresult
171bplayback_get_status(bplayback_t p, bplayback_status *status)
172{
173#if NEXUS_HAS_PLAYBACK
174        BDBG_ASSERT(p);
175        BDBG_ASSERT(p->iface.get_status);
176        return p->iface.get_status(p, status);
177#else
178    BSTD_UNUSED(p);
179    BSTD_UNUSED(status);
180    return berr_not_available;
181#endif
182}
183
184#if NEXUS_HAS_PLAYBACK
185static bresult
186bplayback_get_status_dummy(bplayback_t p, bplayback_status *status)
187{
188        BSTD_UNUSED(p);
189        BSTD_UNUSED(status);
190        return BSETTOP_ERROR(berr_not_supported);
191}
192#endif
193
194bresult
195bplayback_pause(bplayback_t p)
196{
197#if NEXUS_HAS_PLAYBACK
198        BDBG_ASSERT(p);
199        BDBG_ASSERT(p->iface.pause);
200        return p->iface.pause(p);
201#else
202    BSTD_UNUSED(p);
203    return berr_not_available;
204#endif
205}
206
207#if NEXUS_HAS_PLAYBACK
208static bresult
209bplayback_pause_dummy(bplayback_t p)
210{
211        BSTD_UNUSED(p);
212        return BSETTOP_ERROR(berr_not_supported);
213}
214#endif
215
216bresult
217bplayback_catchup_record(bplayback_t p)
218{
219#if NEXUS_HAS_PLAYBACK
220        BDBG_ASSERT(p);
221        BDBG_ASSERT(p->iface.catchup_record);
222        return p->iface.catchup_record(p);
223#else
224    BSTD_UNUSED(p);
225    return berr_not_available;
226#endif
227}
228
229#if NEXUS_HAS_PLAYBACK
230static bresult
231bplayback_catchup_record_dummy(bplayback_t p)
232{
233        BSTD_UNUSED(p);
234        return BSETTOP_ERROR(berr_not_supported);
235}
236#endif
237
238bresult
239bplayback_play(bplayback_t p)
240{
241#if NEXUS_HAS_PLAYBACK
242        BDBG_ASSERT(p);
243        BDBG_ASSERT(p->iface.play);
244        return p->iface.play(p);
245#else
246    BSTD_UNUSED(p);
247    return berr_not_available;
248#endif
249}
250
251#if NEXUS_HAS_PLAYBACK
252static bresult
253bplayback_play_dummy(bplayback_t p)
254{
255        BSTD_UNUSED(p);
256        return BSETTOP_ERROR(berr_not_supported);
257}
258#endif
259
260bresult
261bplayback_frameadvance(bplayback_t p, bplayback_player_mode playermode, bool forward)
262{
263#if NEXUS_HAS_PLAYBACK
264        BDBG_ASSERT(p);
265        BDBG_ASSERT(p->iface.frameadvance);
266        return p->iface.frameadvance(p, playermode, forward);
267#else
268    BSTD_UNUSED(p);
269    BSTD_UNUSED(playermode);
270    BSTD_UNUSED(forward);
271    return berr_not_available;
272#endif
273}
274
275bresult
276bplayback_frameadvance_dummy(bplayback_t p, bplayback_player_mode playermode,   bool forward)
277{
278        BSTD_UNUSED(p);
279        BSTD_UNUSED(playermode);
280        BSTD_UNUSED(forward);
281        return BSETTOP_ERROR(berr_not_supported);
282}
283
284bresult
285bplayback_trickmode(bplayback_t p, const bplayback_trickmode_params *trickmode)
286{
287#if NEXUS_HAS_PLAYBACK
288        BDBG_ASSERT(p);
289        BDBG_ASSERT(p->iface.trickmode);
290        return p->iface.trickmode(p, trickmode);
291#else
292    BSTD_UNUSED(p);
293    BSTD_UNUSED(trickmode);
294    return berr_not_available;
295#endif
296}
297
298#if NEXUS_HAS_PLAYBACK
299static bresult
300bplayback_trickmode_dummy(bplayback_t p, const bplayback_trickmode_params *trickmode)
301{
302        BSTD_UNUSED(p);
303        BSTD_UNUSED(trickmode);
304        return BSETTOP_ERROR(berr_not_supported);
305}
306#endif
307
308bresult
309bplayback_get_trickmode_by_rate(bplayback_t p, int rate, bplayback_trickmode_params *trickmode)
310{
311#if NEXUS_HAS_PLAYBACK
312        BDBG_ASSERT(p);
313        BDBG_ASSERT(p->iface.get_trickmode_by_rate);
314        return p->iface.get_trickmode_by_rate(p, rate, trickmode);
315#else
316    BSTD_UNUSED(p);
317    BSTD_UNUSED(rate);
318    BSTD_UNUSED(trickmode);
319    return berr_not_available;
320#endif
321}
322
323#if NEXUS_HAS_PLAYBACK
324static bresult
325bplayback_get_trickmode_by_rate_dummy(bplayback_t p, int rate, bplayback_trickmode_params *trickmode)
326{
327        BSTD_UNUSED(p);
328        BSTD_UNUSED(trickmode);
329        BSTD_UNUSED(rate);
330        return BSETTOP_ERROR(berr_not_supported);
331}
332#endif
333
334long 
335bplayback_goto_index(bplayback_t p, long index_offset, int whence)
336{
337#if NEXUS_HAS_PLAYBACK
338    BDBG_ASSERT(p);
339        BDBG_ASSERT(p->iface.goto_index);
340        return p->iface.goto_index(p, index_offset, whence);
341#else
342    BSTD_UNUSED(p);
343    BSTD_UNUSED(index_offset);
344    BSTD_UNUSED(whence);
345    return 0;
346#endif
347}
348
349#if NEXUS_HAS_PLAYBACK
350static long 
351bplayback_goto_index_dummy(bplayback_t p, long index_offset, int whence)
352{
353        BSTD_UNUSED(p);
354        BSTD_UNUSED(index_offset);
355        BSTD_UNUSED(whence);
356        BSETTOP_ERROR(berr_not_supported);
357        return -1;
358}
359#endif
360
361long 
362bplayback_goto_timestamp(bplayback_t p, long timestamp, int whence)
363{
364#if NEXUS_HAS_PLAYBACK
365        BDBG_ASSERT(p);
366        BDBG_ASSERT(p->iface.goto_timestamp);
367        return p->iface.goto_timestamp(p, timestamp, whence);
368#else
369    BSTD_UNUSED(p);
370    BSTD_UNUSED(timestamp);
371    BSTD_UNUSED(whence);
372    return berr_not_available;
373#endif
374}
375
376#if NEXUS_HAS_PLAYBACK
377static long 
378bplayback_goto_timestamp_dummy(bplayback_t p, long timestamp, int whence)
379{
380        BSTD_UNUSED(p);
381        BSTD_UNUSED(timestamp);
382        BSTD_UNUSED(whence);
383        BSETTOP_ERROR(berr_not_supported);
384        return -1;
385}
386#endif
387
388off_t 
389bplayback_goto_mpeg_file_offset(bplayback_t p, off_t mpeg_file_offset, int whence)
390{
391#if NEXUS_HAS_PLAYBACK
392        BDBG_ASSERT(p);
393        BDBG_ASSERT(p->iface.goto_mpeg_file_offset);
394        return p->iface.goto_mpeg_file_offset(p, mpeg_file_offset, whence);
395#else
396    BSTD_UNUSED(p);
397    BSTD_UNUSED(mpeg_file_offset);
398    BSTD_UNUSED(whence);
399    return 0;
400#endif
401}
402
403#if NEXUS_HAS_PLAYBACK
404static off_t 
405bplayback_goto_mpeg_file_offset_dummy(bplayback_t p, off_t mpeg_file_offset, int whence)
406{
407        BSTD_UNUSED(p);
408        BSTD_UNUSED(mpeg_file_offset);
409        BSTD_UNUSED(whence);
410        BSETTOP_ERROR(berr_not_supported);
411        return -1;
412}
413#endif
414
415void
416bplayback_close(bplayback_t playback)
417{
418#if NEXUS_HAS_PLAYBACK
419        BDBG_ASSERT(playback);
420        BDBG_ASSERT(playback->iface.close);
421        playback->iface.close(playback);
422        return;
423#else
424    BSTD_UNUSED(playback);
425    return;
426#endif
427}
428
429void
430bplayback_close_dummy(bplayback_t playback)
431{
432        BSTD_UNUSED(playback);
433        return;
434}
435
436#if NEXUS_HAS_PLAYBACK
437static const bplayback_iface dummy_iface = {
438        bplayback_params_init_dummy,
439        bplayback_start_dummy,
440        bplayback_start_timeshifting_dummy,
441        bplayback_stop_timeshifting_dummy,
442        bplayback_stop_dummy,
443        bplayback_get_status_dummy,
444        bplayback_pause_dummy,
445        bplayback_catchup_record_dummy,
446        bplayback_play_dummy,
447        bplayback_frameadvance_dummy,
448        bplayback_trickmode_dummy,
449        bplayback_get_trickmode_by_rate_dummy,
450        bplayback_goto_index_dummy,
451        bplayback_goto_timestamp_dummy,
452        bplayback_goto_mpeg_file_offset_dummy,
453        bplayback_close_dummy
454};
455
456void 
457bplayback_iface_init(bplayback_iface *iface)
458{
459        *iface = dummy_iface;
460    return;
461
462}
463#endif
464
465#if 0
466void
467brecord_params_init(brecord_params *params, brecord_t record)
468{
469        BDBG_ASSERT(record);
470        BDBG_ASSERT(record->params_init);
471        record->params_init(params, record);
472        return;
473}
474
475static void
476brecord_params_init_dummy(brecord_params *params, brecord_t record)
477{
478        BSTD_UNUSED(record);
479        BKNI_Memset(params, 0, sizeof(*params));
480        return ;
481}
482
483bresult
484brecord_start(brecord_t record, brecpump_t recpump, bstream_t stream, brecord_file_t source, const brecord_params *params)
485{
486        BDBG_ASSERT(record);
487        BDBG_ASSERT(record->start);
488        return record->start(record, recpump, stream, source, params);
489}
490
491static bresult
492brecord_start_dummy(brecord_t record, brecpump_t recpump, bstream_t stream, brecord_file_t source, const brecord_params *params)
493{
494        BSTD_UNUSED(record);
495        BSTD_UNUSED(recpump);
496        BSTD_UNUSED(stream);
497        BSTD_UNUSED(source);
498        BSTD_UNUSED(params);
499        return BSETTOP_ERROR(berr_not_supported);
500}
501
502bresult
503brecord_stop(brecord_t record)
504{
505        BDBG_ASSERT(record);
506        BDBG_ASSERT(record->stop);
507        return record->stop(record);
508}
509
510static bresult
511brecord_stop_dummy(brecord_t record)
512{
513        BSTD_UNUSED(record);
514        return BSETTOP_ERROR(berr_not_supported);
515}
516
517void
518brecord_get_status(brecord_t r, brecord_status *status)
519{
520        BDBG_ASSERT(r);
521        BDBG_ASSERT(r->get_status);
522        r->get_status(r, status);
523        return;
524}
525
526static void
527brecord_get_status_dummy(brecord_t r, brecord_status *status)
528{
529        BSTD_UNUSED(r);
530        BSTD_UNUSED(status);
531        return;
532}
533
534void
535brecord_close(brecord_t record)
536{
537        BDBG_ASSERT(record);
538        BDBG_ASSERT(record->close);
539        record->close(record);
540        return;
541}
542
543void
544brecord_close_dummy(brecord_t record)
545{
546        BSTD_UNUSED(record);
547        return;
548}
549
550static const brecord_iface record_dummy_iface = {
551        brecord_params_init_dummy,
552        brecord_close_dummy,
553        brecord_start_dummy,
554        brecord_stop_dummy,
555        brecord_get_status_dummy,
556
557};
558
559void
560brecord_iface_init(brecord_iface *iface)
561{
562        *iface = record_dummy_iface;
563        return;
564}
565
566static const char b_playback_file[] = "b_playback_file";
567
568static ssize_t
569b_no_read(bfile_io_read_t fd, void *buf, size_t length)
570{
571        BSTD_UNUSED(fd);
572        BSTD_UNUSED(buf);
573        BSTD_UNUSED(length);
574        return -1;
575}
576
577static off_t
578b_no_seek(bfile_io_read_t fd, off_t offset, int whence)
579{
580        BSTD_UNUSED(fd);
581        BSTD_UNUSED(offset);
582        BSTD_UNUSED(whence);
583        return -1;
584}
585
586static int
587b_no_bounds(bfile_io_read_t fd, off_t *first, off_t *last)
588{
589        BSTD_UNUSED(fd);
590        *first = *last = 0;
591        return -1;
592}
593
594static void
595b_no_close(bplayback_file_t file)
596{
597        BSTD_UNUSED(file);
598        return;
599}
600
601static const struct bfile_io_read b_no_io_read = {
602        b_no_read,
603        b_no_seek,
604        b_no_bounds,
605        {
606                bio_default_priority,
607                NULL
608        }
609};
610
611void
612bplayback_file_init(struct bplayback_file *file)
613{
614        BKNI_Memset(file, 0, sizeof(*file));
615        file->file.data = (void *)&b_no_io_read;
616        file->file.index = NULL;
617        file->file.close = b_no_close;
618        file->file_kind = b_playback_file;
619        return;
620}
621
622#endif
Note: See TracBrowser for help on using the repository browser.