| 1 | /****************************************************************************** |
|---|
| 2 | * (c)2008-2012 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: cmdline_args.h $ |
|---|
| 39 | * $brcm_Revision: 48 $ |
|---|
| 40 | * $brcm_Date: 1/19/12 11:51a $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/utils/cmdline_args.h $ |
|---|
| 47 | * |
|---|
| 48 | * 48 1/19/12 11:51a erickson |
|---|
| 49 | * SW7346-629: add -cmp_crc and -avd_crc options |
|---|
| 50 | * |
|---|
| 51 | * 47 1/11/12 6:13p vsilyaev |
|---|
| 52 | * SW7425-2112: Added option to limit playback rate |
|---|
| 53 | * |
|---|
| 54 | * 46 12/20/11 1:43p vsilyaev |
|---|
| 55 | * SW7425-2034: Used 32-bit type for program id (pid) types |
|---|
| 56 | * |
|---|
| 57 | * 45 8/18/11 5:23p vsilyaev |
|---|
| 58 | * SW7425-651: Removed deprecated control over the encoder delay |
|---|
| 59 | * |
|---|
| 60 | * 44 7/13/11 8:39p vsilyaev |
|---|
| 61 | * SWDTV-7897: Added code to wrap PCM file with the WAV header |
|---|
| 62 | * |
|---|
| 63 | * 43 7/7/11 5:53p jtna |
|---|
| 64 | * SW7425-869: added runtime option to override |
|---|
| 65 | * NEXUS_VideoDecoderSourceOrientation |
|---|
| 66 | * |
|---|
| 67 | * 42 4/22/11 5:49p vsilyaev |
|---|
| 68 | * SW7425-416: Added option to override display orientation |
|---|
| 69 | * |
|---|
| 70 | * 41 3/23/11 5:41p vsilyaev |
|---|
| 71 | * SW7422-406: Unified parsing of command line parameters |
|---|
| 72 | * |
|---|
| 73 | * 40 3/11/11 3:48p vsilyaev |
|---|
| 74 | * SW7425-159: add encode profile/level etc settings; add clean shutdown |
|---|
| 75 | * sequence for transcoder; add sample usage for transcoder; |
|---|
| 76 | * |
|---|
| 77 | * SW7425-159/1 3/9/11 8:05p hongtaoz |
|---|
| 78 | * SW7425-159: add encode profile/level etc settings; add clean shutdown |
|---|
| 79 | * sequence for transcoder; add sample usage for transcoder; |
|---|
| 80 | * |
|---|
| 81 | * 38 3/4/11 3:18p jgarrett |
|---|
| 82 | * SW7422-146: Adding multichannel audio support |
|---|
| 83 | * |
|---|
| 84 | * 37 2/22/11 3:41p vsilyaev |
|---|
| 85 | * SW7425-40: adapted to new API; |
|---|
| 86 | * |
|---|
| 87 | * SW7425_bringup/2 2/15/11 9:52p hongtaoz |
|---|
| 88 | * SW7425-40: adapted to new API; |
|---|
| 89 | * |
|---|
| 90 | * 36 12/22/10 1:15p vsilyaev |
|---|
| 91 | * SW7425-39, SW7425-40: merged hdmi_input source and transcoder util |
|---|
| 92 | * test; |
|---|
| 93 | * |
|---|
| 94 | * SW7425_bringup/1 12/22/10 12:42a hongtaoz |
|---|
| 95 | * SW7425-39, SW7425-40: add hdmi_input source and transcoder util test; |
|---|
| 96 | * |
|---|
| 97 | * 35 11/17/10 3:34p jgarrett |
|---|
| 98 | * SW7408-137: Adding HDMI output options |
|---|
| 99 | * |
|---|
| 100 | * 34 10/22/10 12:17p vsilyaev |
|---|
| 101 | * SW3548-3106: Added option to start playback in a paused state |
|---|
| 102 | * |
|---|
| 103 | * 33 9/8/10 12:05p vsilyaev |
|---|
| 104 | * SW7468-129: Added video decoder on ZSP |
|---|
| 105 | * |
|---|
| 106 | * SW7468-129/2 3/8/10 1:03p vsilyaev |
|---|
| 107 | * SW7468-129: Added decoder index to the record options |
|---|
| 108 | * |
|---|
| 109 | * SW7468-129/1 3/5/10 7:31p vsilyaev |
|---|
| 110 | * SW7468-129: Added hooks for soft video decoder |
|---|
| 111 | * |
|---|
| 112 | * 32 8/31/10 2:44p erickson |
|---|
| 113 | * SWGIGGSVIZIO-57: add -fixed_bitrate option to set |
|---|
| 114 | * NEXUS_PlaybackMode_eFixedBitrate |
|---|
| 115 | * |
|---|
| 116 | * 31 8/10/10 12:14p erickson |
|---|
| 117 | * SW7405-4735: merge |
|---|
| 118 | * |
|---|
| 119 | * SW7405-4735/1 8/9/10 3:21p jtna |
|---|
| 120 | * SW7405-4735: rename opts.pids to opts.otherPids. allow pid 0 in |
|---|
| 121 | * opts.otherPids. start only one playback during allpass record. |
|---|
| 122 | * |
|---|
| 123 | * 30 7/14/10 6:12p vsilyaev |
|---|
| 124 | * SW3556-1131: Added basic support for CDXA format |
|---|
| 125 | * |
|---|
| 126 | * 29 5/5/10 10:43a vsilyaev |
|---|
| 127 | * SW7405-1260: Added settings for size of the audio decoder buffer |
|---|
| 128 | * |
|---|
| 129 | * 28 2/23/10 4:50p vsilyaev |
|---|
| 130 | * SW3556-913: Added code that monitors state of the playback file and |
|---|
| 131 | * restarts playback (from last good position) in case of error |
|---|
| 132 | * |
|---|
| 133 | * 27 2/22/10 5:33p vsilyaev |
|---|
| 134 | * SW3556-913: Added option to plug Custom File I/O routines to inject |
|---|
| 135 | * errors |
|---|
| 136 | * |
|---|
| 137 | * 26 2/12/10 5:56p jtna |
|---|
| 138 | * SW3556-1051: added option to control playback timestamp reordering |
|---|
| 139 | * |
|---|
| 140 | * 25 1/20/10 5:08p erickson |
|---|
| 141 | * SW7550-159: update record util for threshold and buffer control |
|---|
| 142 | * |
|---|
| 143 | * 24 12/30/09 3:19p vsilyaev |
|---|
| 144 | * SW7408-17: Added options to select PCM and compressed audio outputs |
|---|
| 145 | * |
|---|
| 146 | * 23 12/30/09 2:13p erickson |
|---|
| 147 | * SW7550-128: add closed caption feature (-cc on) |
|---|
| 148 | * |
|---|
| 149 | * 22 12/8/09 2:31p gmohile |
|---|
| 150 | * SW7408-1 : Add defines for nexus had frontend |
|---|
| 151 | * |
|---|
| 152 | * 21 11/25/09 5:24p katrep |
|---|
| 153 | * SW7405-2740: Add support for WMA pro drc |
|---|
| 154 | * |
|---|
| 155 | * 20 8/18/09 4:36p vsilyaev |
|---|
| 156 | * PR 56809: Added option to control handling of video errors |
|---|
| 157 | * |
|---|
| 158 | * 19 6/19/09 5:20p vsilyaev |
|---|
| 159 | * PR 56169: Added option to set max decode rate |
|---|
| 160 | * |
|---|
| 161 | * 18 6/18/09 4:30p jtna |
|---|
| 162 | * PR54802: add frontend support to record |
|---|
| 163 | * |
|---|
| 164 | * 17 6/16/09 5:13p jtna |
|---|
| 165 | * PR54802: added record |
|---|
| 166 | * |
|---|
| 167 | * 16 6/8/09 7:06a erickson |
|---|
| 168 | * PR55617: add user-specific aspectRatio |
|---|
| 169 | * |
|---|
| 170 | * 15 5/22/09 5:21p vsilyaev |
|---|
| 171 | * PR 55376 PR 52344: Added option to enable processing of AVC(H.264) |
|---|
| 172 | * Level 5.1 video |
|---|
| 173 | * |
|---|
| 174 | * 14 3/18/09 10:26a erickson |
|---|
| 175 | * PR52350: add wxga/fha support with 50/60 hz option |
|---|
| 176 | * |
|---|
| 177 | * 13 3/6/09 9:33a erickson |
|---|
| 178 | * PR51743: added -ar and -graphics options, default DTV apps to panel |
|---|
| 179 | * output |
|---|
| 180 | * |
|---|
| 181 | * 12 2/27/09 5:05p vsilyaev |
|---|
| 182 | * PR 52634: Added code to handle MPEG-2 TS streams with timesampts (e.g. |
|---|
| 183 | * 192 byte packets) |
|---|
| 184 | * |
|---|
| 185 | * 11 2/20/09 2:06p vsilyaev |
|---|
| 186 | * PR 51467: Added option to set size of the video decoder buffer |
|---|
| 187 | * |
|---|
| 188 | * 10 1/26/09 11:26a vsilyaev |
|---|
| 189 | * PR 51579: Added stream_processing and auto_bitrate options |
|---|
| 190 | * |
|---|
| 191 | * 9 1/22/09 7:48p vsilyaev |
|---|
| 192 | * PR 50848: Don't use globals for the command line options |
|---|
| 193 | * |
|---|
| 194 | * 8 1/20/09 4:28p erickson |
|---|
| 195 | * PR48944: add -mad and -display_format options |
|---|
| 196 | * |
|---|
| 197 | * 7 1/8/09 10:34p erickson |
|---|
| 198 | * PR48944: add more options |
|---|
| 199 | * |
|---|
| 200 | * 6 1/8/09 9:36p erickson |
|---|
| 201 | * PR50757: added NEXUS_VideoFrameRate support, both as a start setting |
|---|
| 202 | * and status |
|---|
| 203 | * |
|---|
| 204 | * 5 1/6/09 12:45a erickson |
|---|
| 205 | * PR50763: added -bof, -eof options. added playback position to status. |
|---|
| 206 | * fix mkv, mp4. |
|---|
| 207 | * |
|---|
| 208 | * 4 11/20/08 12:50p erickson |
|---|
| 209 | * PR48944: update |
|---|
| 210 | * |
|---|
| 211 | * 3 11/19/08 1:30p erickson |
|---|
| 212 | * PR48944: update |
|---|
| 213 | * |
|---|
| 214 | * 2 11/17/08 2:19p erickson |
|---|
| 215 | * PR48944: update |
|---|
| 216 | * |
|---|
| 217 | * 1 11/17/08 12:34p erickson |
|---|
| 218 | * PR48944: add utils |
|---|
| 219 | * |
|---|
| 220 | *****************************************************************************/ |
|---|
| 221 | #ifndef CMDLINE_ARGS_H__ |
|---|
| 222 | #define CMDLINE_ARGS_H__ |
|---|
| 223 | |
|---|
| 224 | #include "nexus_types.h" |
|---|
| 225 | #include "nexus_display.h" |
|---|
| 226 | #include "nexus_video_window.h" |
|---|
| 227 | #include "nexus_pid_channel.h" |
|---|
| 228 | #include "nexus_stc_channel.h" |
|---|
| 229 | #include "nexus_playback.h" |
|---|
| 230 | #include "bmedia_pcm.h" |
|---|
| 231 | |
|---|
| 232 | #if NEXUS_HAS_VIDEO_ENCODER |
|---|
| 233 | #include "nexus_video_encoder.h" |
|---|
| 234 | #endif |
|---|
| 235 | |
|---|
| 236 | typedef struct { |
|---|
| 237 | const char *name; |
|---|
| 238 | int value; |
|---|
| 239 | } namevalue_t; |
|---|
| 240 | |
|---|
| 241 | struct common_opts_t { |
|---|
| 242 | NEXUS_TransportType transportType; |
|---|
| 243 | unsigned videoPid, pcrPid, audioPid, extVideoPid; |
|---|
| 244 | unsigned videoCdb; |
|---|
| 245 | unsigned audioCdb; |
|---|
| 246 | unsigned videoDecoder; |
|---|
| 247 | NEXUS_VideoCodec videoCodec; |
|---|
| 248 | NEXUS_VideoCodec extVideoCodec; |
|---|
| 249 | NEXUS_AudioCodec audioCodec; |
|---|
| 250 | NEXUS_VideoFormat displayFormat; |
|---|
| 251 | NEXUS_DisplayType displayType; |
|---|
| 252 | NEXUS_VideoWindowContentMode contentMode; |
|---|
| 253 | NEXUS_TransportTimestampType tsTimestampType; |
|---|
| 254 | NEXUS_VideoDecoderTimestampMode decoderTimestampMode; |
|---|
| 255 | NEXUS_VideoFrameRate videoFrameRate; |
|---|
| 256 | NEXUS_AspectRatio aspectRatio; |
|---|
| 257 | NEXUS_VideoOrientation displayOrientation; |
|---|
| 258 | NEXUS_VideoDecoderSourceOrientation sourceOrientation; |
|---|
| 259 | struct { |
|---|
| 260 | unsigned x, y; |
|---|
| 261 | } sampleAspectRatio; |
|---|
| 262 | |
|---|
| 263 | bool useCompositeOutput; |
|---|
| 264 | bool useComponentOutput; |
|---|
| 265 | bool useHdmiOutput; |
|---|
| 266 | bool usePanelOutput; |
|---|
| 267 | bool useScart1CompositeOutput; |
|---|
| 268 | bool mad; |
|---|
| 269 | bool compressedAudio; |
|---|
| 270 | bool multichannelAudio; |
|---|
| 271 | bool decodedAudio; |
|---|
| 272 | bool probe; |
|---|
| 273 | bool cdxaFile; |
|---|
| 274 | bool detectAvcExtension; |
|---|
| 275 | bool playpumpTimestampReordering; |
|---|
| 276 | bool pcm; |
|---|
| 277 | bpcm_file_config pcm_config; |
|---|
| 278 | /* asf wma drc */ |
|---|
| 279 | #if B_HAS_ASF |
|---|
| 280 | bool dynamicRangeControlValid; |
|---|
| 281 | struct { |
|---|
| 282 | unsigned peakReference; |
|---|
| 283 | unsigned peakTarget; |
|---|
| 284 | unsigned averageReference; |
|---|
| 285 | unsigned averageTarget; |
|---|
| 286 | } dynamicRangeControl; |
|---|
| 287 | #endif |
|---|
| 288 | }; |
|---|
| 289 | |
|---|
| 290 | struct util_opts_t { |
|---|
| 291 | struct common_opts_t common; |
|---|
| 292 | const char *filename; |
|---|
| 293 | const char *indexname; |
|---|
| 294 | bool stcTrick; |
|---|
| 295 | bool astm; |
|---|
| 296 | bool sync; |
|---|
| 297 | bool streamProcessing; |
|---|
| 298 | bool autoBitrate; |
|---|
| 299 | bool closedCaptionEnabled; |
|---|
| 300 | bool startPaused; |
|---|
| 301 | bool avc51; |
|---|
| 302 | unsigned fixedBitrate; /* non-zero */ |
|---|
| 303 | NEXUS_StcChannelAutoModeBehavior stcChannelMaster; |
|---|
| 304 | NEXUS_PlaybackLoopMode beginningOfStreamAction; |
|---|
| 305 | NEXUS_PlaybackLoopMode endOfStreamAction; |
|---|
| 306 | NEXUS_VideoDecoderErrorHandling videoErrorHandling; |
|---|
| 307 | bool graphics; |
|---|
| 308 | bool customFileIo; |
|---|
| 309 | bool playbackMonitor; |
|---|
| 310 | unsigned maxDecoderRate; |
|---|
| 311 | unsigned maxPlaybackDataRate; |
|---|
| 312 | bool avd_crc; |
|---|
| 313 | bool cmp_crc; |
|---|
| 314 | }; |
|---|
| 315 | |
|---|
| 316 | #define MAX_RECORD_PIDS 16 |
|---|
| 317 | struct util_opts_record_t { |
|---|
| 318 | struct common_opts_t common; |
|---|
| 319 | /* record options */ |
|---|
| 320 | unsigned short otherPids[MAX_RECORD_PIDS]; |
|---|
| 321 | unsigned numOtherPids; |
|---|
| 322 | struct { |
|---|
| 323 | unsigned bufferSize; |
|---|
| 324 | unsigned dataReadyThreshold; |
|---|
| 325 | } data, index; |
|---|
| 326 | |
|---|
| 327 | /* display */ |
|---|
| 328 | bool allpass; |
|---|
| 329 | bool acceptNullPackets; |
|---|
| 330 | bool decode; |
|---|
| 331 | |
|---|
| 332 | /* output */ |
|---|
| 333 | const char *recfname; |
|---|
| 334 | const char *recidxname; |
|---|
| 335 | |
|---|
| 336 | /* source */ |
|---|
| 337 | bool streamer; |
|---|
| 338 | const char *playfname; |
|---|
| 339 | #if NEXUS_HAS_FRONTEND |
|---|
| 340 | NEXUS_FrontendVsbMode vsbMode; |
|---|
| 341 | NEXUS_FrontendQamMode qamMode; |
|---|
| 342 | NEXUS_FrontendSatelliteMode satMode; |
|---|
| 343 | unsigned freq; /* in MHz */ |
|---|
| 344 | #endif |
|---|
| 345 | #if NEXUS_HAS_HDMI_INPUT |
|---|
| 346 | bool hdmiInput; |
|---|
| 347 | #endif |
|---|
| 348 | #if NEXUS_HAS_VIDEO_ENCODER |
|---|
| 349 | bool encoder; |
|---|
| 350 | NEXUS_VideoFormat encodeFormat; |
|---|
| 351 | unsigned maxVideoBitRate; |
|---|
| 352 | NEXUS_VideoFrameRate encodeFrameRate; |
|---|
| 353 | bool variableFrameRate; |
|---|
| 354 | unsigned gopFrameP; |
|---|
| 355 | unsigned gopFrameB; |
|---|
| 356 | NEXUS_VideoCodec videoTranscodec; |
|---|
| 357 | NEXUS_VideoCodecProfile videoProfile; |
|---|
| 358 | NEXUS_VideoCodecLevel videoLevel; |
|---|
| 359 | NEXUS_AudioCodec audioTranscodec; |
|---|
| 360 | bool audioEncode; |
|---|
| 361 | unsigned audioBitRate; |
|---|
| 362 | unsigned muxLatencyTolerance; |
|---|
| 363 | #endif |
|---|
| 364 | |
|---|
| 365 | }; |
|---|
| 366 | |
|---|
| 367 | extern const float g_frameRateValues[NEXUS_VideoFrameRate_eMax]; |
|---|
| 368 | extern const namevalue_t g_videoFrameRateStrs[]; |
|---|
| 369 | |
|---|
| 370 | /* |
|---|
| 371 | cmdline_parse should be called before NEXUS_Platform_Init |
|---|
| 372 | returns non-zero if app should exit |
|---|
| 373 | */ |
|---|
| 374 | int cmdline_parse(int argc, const char *argv[], struct util_opts_t *opts); |
|---|
| 375 | int cmdline_parse_record(int argc, const char *argv[], struct util_opts_record_t *opts); |
|---|
| 376 | |
|---|
| 377 | /* |
|---|
| 378 | cmdline_probe should be called after NEXUS_Platform_Init |
|---|
| 379 | */ |
|---|
| 380 | int cmdline_probe(struct common_opts_t *opts, const char *filename, const char **indexname); |
|---|
| 381 | |
|---|
| 382 | /* |
|---|
| 383 | print_usage can be called if cmdline_parse fails |
|---|
| 384 | */ |
|---|
| 385 | void print_usage(const char *app /* argv[0] */); |
|---|
| 386 | void print_usage_record(const char *app /* argv[0] */); |
|---|
| 387 | |
|---|
| 388 | #endif |
|---|