| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2005-2010, 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_fileio_fifo.c $ |
|---|
| 11 | * $brcm_Revision: 4 $ |
|---|
| 12 | * $brcm_Date: 6/18/10 3:09p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/src/nexus/bsettop_fileio_fifo.c $ |
|---|
| 19 | * |
|---|
| 20 | * 4 6/18/10 3:09p erickson |
|---|
| 21 | * SW7550-424: fix PVR_SUPPORT=n |
|---|
| 22 | * |
|---|
| 23 | * 3 6/10/10 4:56p erickson |
|---|
| 24 | * SWDEPRECATED-2726: implement bsettop_fileio_fifo |
|---|
| 25 | * |
|---|
| 26 | * 2 11/12/07 2:34p erickson |
|---|
| 27 | * PR36068: update |
|---|
| 28 | * |
|---|
| 29 | ***************************************************************************/ |
|---|
| 30 | #include "bsettop_impl.h" |
|---|
| 31 | #include "bsettop_fileio_fifo.h" |
|---|
| 32 | |
|---|
| 33 | BDBG_MODULE(fileio_fifo); |
|---|
| 34 | |
|---|
| 35 | bfile_out_fifo_t bfile_fifo_out_create(const char *mpeg_file_name, const char *index_file_name) |
|---|
| 36 | { |
|---|
| 37 | #if NEXUS_HAS_RECORD |
|---|
| 38 | /* bfile_out_fifo_t is pointing to the same instance as brecord_file_t */ |
|---|
| 39 | return (bfile_out_fifo_t)brecord_p_file_open(mpeg_file_name, index_file_name, true); |
|---|
| 40 | #else |
|---|
| 41 | BSTD_UNUSED(mpeg_file_name); |
|---|
| 42 | BSTD_UNUSED(index_file_name); |
|---|
| 43 | BERR_TRACE(berr_not_supported); |
|---|
| 44 | return NULL; |
|---|
| 45 | #endif |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | brecord_file_t bfile_fifo_out_file(bfile_out_fifo_t file) |
|---|
| 49 | { |
|---|
| 50 | #if NEXUS_HAS_RECORD |
|---|
| 51 | return (brecord_file_t)file; |
|---|
| 52 | #else |
|---|
| 53 | BSTD_UNUSED(file); |
|---|
| 54 | BERR_TRACE(berr_not_supported); |
|---|
| 55 | return NULL; |
|---|
| 56 | #endif |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | bresult bfile_fifo_out_position(bfile_out_fifo_t file, bpvr_position *first, bpvr_position *last) |
|---|
| 60 | { |
|---|
| 61 | #if NEXUS_HAS_RECORD |
|---|
| 62 | NEXUS_Error rc; |
|---|
| 63 | brecord_file_t record_file = (brecord_file_t)file; |
|---|
| 64 | |
|---|
| 65 | if (!record_file->nFileFifo) { |
|---|
| 66 | return BERR_TRACE(berr_not_supported); |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | BDBG_CASSERT(sizeof(bpvr_position) == sizeof(NEXUS_FilePosition)); |
|---|
| 70 | rc = NEXUS_FifoRecord_GetPosition(record_file->nFileFifo, (NEXUS_FilePosition *)first, (NEXUS_FilePosition *)last); |
|---|
| 71 | if (rc) return BERR_TRACE(rc); |
|---|
| 72 | |
|---|
| 73 | return 0; |
|---|
| 74 | #else |
|---|
| 75 | BSTD_UNUSED(file); |
|---|
| 76 | BSTD_UNUSED(first); |
|---|
| 77 | BSTD_UNUSED(last); |
|---|
| 78 | return BERR_TRACE(berr_not_supported); |
|---|
| 79 | #endif |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | bplayback_file_t bfile_fifo_in_open(const char *mpeg_file_name, const char *index_file_name, bfile_out_fifo_t writer) |
|---|
| 83 | { |
|---|
| 84 | #if NEXUS_HAS_RECORD |
|---|
| 85 | if (!writer) { |
|---|
| 86 | BERR_TRACE(berr_not_supported); |
|---|
| 87 | return NULL; |
|---|
| 88 | } |
|---|
| 89 | return bplayback_p_file_open(mpeg_file_name, index_file_name, writer); |
|---|
| 90 | #else |
|---|
| 91 | BSTD_UNUSED(mpeg_file_name); |
|---|
| 92 | BSTD_UNUSED(index_file_name); |
|---|
| 93 | BSTD_UNUSED(writer); |
|---|
| 94 | BERR_TRACE(berr_not_supported); |
|---|
| 95 | return NULL; |
|---|
| 96 | #endif |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | void bfile_fifo_out_get(bfile_out_fifo_t file, bfile_out_settings *settings) |
|---|
| 100 | { |
|---|
| 101 | #if NEXUS_HAS_RECORD |
|---|
| 102 | brecord_file_t record_file = (brecord_file_t)file; |
|---|
| 103 | |
|---|
| 104 | if (!record_file->nFileFifo) { |
|---|
| 105 | BERR_TRACE(berr_not_supported); |
|---|
| 106 | return; |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | BDBG_CASSERT(sizeof(bfile_out_settings) == sizeof(NEXUS_FifoRecordSettings)); |
|---|
| 110 | NEXUS_FifoRecord_GetSettings(record_file->nFileFifo, (NEXUS_FifoRecordSettings *)settings); |
|---|
| 111 | #else |
|---|
| 112 | BSTD_UNUSED(file); |
|---|
| 113 | BSTD_UNUSED(settings); |
|---|
| 114 | BERR_TRACE(berr_not_supported); |
|---|
| 115 | #endif |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | bresult bfile_fifo_out_set( bfile_out_fifo_t file, const bfile_out_settings *settings) |
|---|
| 119 | { |
|---|
| 120 | #if NEXUS_HAS_RECORD |
|---|
| 121 | NEXUS_Error rc; |
|---|
| 122 | brecord_file_t record_file = (brecord_file_t)file; |
|---|
| 123 | |
|---|
| 124 | if (!record_file->nFileFifo) { |
|---|
| 125 | return BERR_TRACE(berr_not_supported); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | BDBG_CASSERT(sizeof(bfile_out_settings) == sizeof(NEXUS_FifoRecordSettings)); |
|---|
| 129 | rc = NEXUS_FifoRecord_SetSettings(record_file->nFileFifo, (const NEXUS_FifoRecordSettings *)settings); |
|---|
| 130 | if (rc) return BERR_TRACE(rc); |
|---|
| 131 | |
|---|
| 132 | return 0; |
|---|
| 133 | #else |
|---|
| 134 | BSTD_UNUSED(file); |
|---|
| 135 | BSTD_UNUSED(settings); |
|---|
| 136 | return BERR_TRACE(berr_not_supported); |
|---|
| 137 | #endif |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | /** |
|---|
| 141 | The following are low-level functions, not required for bfile_fifo_out. |
|---|
| 142 | **/ |
|---|
| 143 | |
|---|
| 144 | struct bfile_io_write_fifo *bpvrfifo_write_open(const char *fname, int flags, off_t start) |
|---|
| 145 | { |
|---|
| 146 | BSTD_UNUSED(fname); |
|---|
| 147 | BSTD_UNUSED(flags); |
|---|
| 148 | BSTD_UNUSED(start); |
|---|
| 149 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 150 | return NULL; |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | bfile_io_write_t bpvrfifo_write_file(struct bfile_io_write_fifo *file) |
|---|
| 154 | { |
|---|
| 155 | BSTD_UNUSED(file); |
|---|
| 156 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 157 | return NULL; |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | void bpvrfifo_write_close(struct bfile_io_write_fifo *file) |
|---|
| 161 | { |
|---|
| 162 | BSTD_UNUSED(file); |
|---|
| 163 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | struct bfile_io_read_fifo *bpvrfifo_read_open(const char *fname, int flags, struct bfile_io_write_fifo *writer) |
|---|
| 167 | { |
|---|
| 168 | BSTD_UNUSED(fname); |
|---|
| 169 | BSTD_UNUSED(flags); |
|---|
| 170 | BSTD_UNUSED(writer); |
|---|
| 171 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 172 | return NULL; |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | bfile_io_read_t bpvrfifo_read_file(struct bfile_io_read_fifo *file) |
|---|
| 176 | { |
|---|
| 177 | BSTD_UNUSED(file); |
|---|
| 178 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 179 | return NULL; |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | void bpvrfifo_read_close(struct bfile_io_read_fifo *file) |
|---|
| 183 | { |
|---|
| 184 | BSTD_UNUSED(file); |
|---|
| 185 | BSETTOP_ERROR(berr_not_supported); |
|---|
| 186 | } |
|---|
| 187 | |
|---|