| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-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: budp_jp3dparse.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 12 | * $brcm_Date: 10/28/10 3:59p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/udp/budp_jp3dparse.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/2 10/28/10 3:59p darnstein |
|---|
| 21 | * SW3548-2364: trivial implementation of _isr functions for parsing. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/1 10/6/10 6:43p darnstein |
|---|
| 24 | * SW7405-4817: Parser for the Dpa 3D signaling message used in Japan. |
|---|
| 25 | * |
|---|
| 26 | ***************************************************************************/ |
|---|
| 27 | |
|---|
| 28 | /*= Module Overview ********************************************************* |
|---|
| 29 | <verbatim> |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | Overview |
|---|
| 33 | BUDPJP3Dparse module provides parsing of "JP3D" messages from MPEG-2 |
|---|
| 34 | bitstreams. These messages are defined in ISO/IEC JTC1/SC29/WG11 |
|---|
| 35 | "JNB comments on extension of MPEG-2 video and its 3D signaling." |
|---|
| 36 | |
|---|
| 37 | In general, this software accepts a buffer of data that contains |
|---|
| 38 | the JP3D messages. One function call finds the start of the JP3D |
|---|
| 39 | data. Repeated calls to another function retrieve the individual |
|---|
| 40 | messages, one at a time. |
|---|
| 41 | </verbatim> |
|---|
| 42 | ***************************************************************************/ |
|---|
| 43 | |
|---|
| 44 | #ifndef BUDPJP3DPARSE_H__ |
|---|
| 45 | #define BUDPJP3DPARSE_H__ |
|---|
| 46 | |
|---|
| 47 | #include "bstd.h" |
|---|
| 48 | #include "bavc.h" |
|---|
| 49 | #include "berr.h" |
|---|
| 50 | #include "bavc.h" |
|---|
| 51 | #include "budp.h" |
|---|
| 52 | |
|---|
| 53 | #ifdef __cplusplus |
|---|
| 54 | extern "C" { |
|---|
| 55 | #endif |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | /***************************************************************************** |
|---|
| 59 | * Structures |
|---|
| 60 | *****************************************************************************/ |
|---|
| 61 | |
|---|
| 62 | /***************************************************************************** |
|---|
| 63 | * Public API |
|---|
| 64 | *****************************************************************************/ |
|---|
| 65 | |
|---|
| 66 | /***************************************************************************** |
|---|
| 67 | Summary: |
|---|
| 68 | Locates the start of JP3D messages in MPEG userdata. |
|---|
| 69 | |
|---|
| 70 | Description: |
|---|
| 71 | This function accepts a "packet" of MPEG userdata and searches it for |
|---|
| 72 | the start of "JP3D" messages, indicated by this exact series of bytes: |
|---|
| 73 | 00 00 01 B2 4A 50 33 44. The first four bytes comprise the standard MPEG |
|---|
| 74 | userdata startcode. The final four bytes are specified by the controlling |
|---|
| 75 | ISO/IEC standard and comprise the ASCII string "JP3D." |
|---|
| 76 | |
|---|
| 77 | The typical usage of this function is as follows: |
|---|
| 78 | |
|---|
| 79 | size_t offset = 0; |
|---|
| 80 | eStatus = |
|---|
| 81 | BUDP_JP3Dstart_isr (info, offset, &bytesParsed); |
|---|
| 82 | while (eStatus == BERR_SUCCESS) |
|---|
| 83 | { |
|---|
| 84 | offset += bytesParsed; |
|---|
| 85 | eStatus = |
|---|
| 86 | BUDP_JP3Dparse_isr (info, offset, &bytesParsed, &sigtype); |
|---|
| 87 | if (eStatus == BERR_SUCCESS) |
|---|
| 88 | { |
|---|
| 89 | // Process sigtype, the only variable data in the JP3D |
|---|
| 90 | // message. |
|---|
| 91 | } |
|---|
| 92 | else if (eStatus == BERR_BUDP_NO_DATA) |
|---|
| 93 | { |
|---|
| 94 | // End of data has been found. No code here, just let the |
|---|
| 95 | // "while loop" terminate normally. |
|---|
| 96 | } |
|---|
| 97 | else |
|---|
| 98 | { |
|---|
| 99 | // A real error. Put some error processing here. |
|---|
| 100 | // Further parsing may yield garbage. |
|---|
| 101 | return eStatus; |
|---|
| 102 | } |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | Returns: |
|---|
| 106 | BERR_SUCCESS - Start of JP3D message data was found. Ready to |
|---|
| 107 | parse. |
|---|
| 108 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 109 | possibly NULL. |
|---|
| 110 | BERR_BUDP_NO_DATA - No JP3D messages were found. |
|---|
| 111 | BERR_BUDP_PARSE_ERROR - JP3D message(s) were detected, but could not |
|---|
| 112 | be successfully parsed. |
|---|
| 113 | |
|---|
| 114 | See Also: |
|---|
| 115 | BUDP_JP3Dparse_isr |
|---|
| 116 | *****************************************************************************/ |
|---|
| 117 | BERR_Code BUDP_JP3Dstart_isr ( |
|---|
| 118 | const BAVC_USERDATA_info* |
|---|
| 119 | pUserdata_info, /* [in] The MPEG userdata to be parsed. */ |
|---|
| 120 | size_t offset, /* [in] Parsing will start at this offset in the |
|---|
| 121 | input buffer |
|---|
| 122 | userdata_info->pUserDataBuffer. */ |
|---|
| 123 | size_t* pBytesParsed /* [out] The number of bytes skipped from the |
|---|
| 124 | input buffer |
|---|
| 125 | userdata_info->pUserDataBuffer. */ |
|---|
| 126 | ); |
|---|
| 127 | #define BUDP_JP3Dstart BUDP_JP3Dstart_isr |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | /***************************************************************************** |
|---|
| 131 | Summary: |
|---|
| 132 | Parses individual JP3D messages from userdata. |
|---|
| 133 | |
|---|
| 134 | Description: |
|---|
| 135 | This function accepts a "packet" of JP3D data and extracts a |
|---|
| 136 | single message. For correct operation, the data must be |
|---|
| 137 | "positioned" by a previous call to either this function, or to |
|---|
| 138 | BUDP_JP3Dstart(). |
|---|
| 139 | |
|---|
| 140 | See the documentation for function BUDP_JP3Dstart_isr() for a |
|---|
| 141 | complete programming example. |
|---|
| 142 | |
|---|
| 143 | Returns: |
|---|
| 144 | BERR_SUCCESS - The handle was successfully created. |
|---|
| 145 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 146 | possibly NULL. |
|---|
| 147 | BERR_BUDP_NO_DATA - No SEI messages were found. As the above |
|---|
| 148 | programming example shows, this is not really |
|---|
| 149 | an error. |
|---|
| 150 | BERR_BUDP_PARSE_ERROR - SEI message(s) were detected, but could not |
|---|
| 151 | be successfully parsed. |
|---|
| 152 | |
|---|
| 153 | See Also: |
|---|
| 154 | BUDP_JP3Dstart_isr |
|---|
| 155 | *****************************************************************************/ |
|---|
| 156 | BERR_Code BUDP_JP3Dparse_isr ( |
|---|
| 157 | const BAVC_USERDATA_info* |
|---|
| 158 | pUserdata_info, /* [in] The MPEG userdata to be parsed. */ |
|---|
| 159 | size_t offset, /* [in] Parsing will start at this offset in the |
|---|
| 160 | input buffer |
|---|
| 161 | userdata_info->pUserDataBuffer. */ |
|---|
| 162 | size_t* pBytesParsed, /* [out] The number of bytes parsed from the |
|---|
| 163 | input buffer |
|---|
| 164 | userdata_info->pUserDataBuffer. */ |
|---|
| 165 | uint16_t* sigtype /* [out] A single instance of extracted datum |
|---|
| 166 | Stereo_Video_Format_Signaling_Type. */ |
|---|
| 167 | ); |
|---|
| 168 | #define BUDP_JP3Dparse BUDP_JP3Dparse_isr |
|---|
| 169 | |
|---|
| 170 | #ifdef __cplusplus |
|---|
| 171 | } |
|---|
| 172 | #endif |
|---|
| 173 | |
|---|
| 174 | #endif /* BUDPJP3DPARSE_H__ */ |
|---|