Application main thread. */
| 107 | Application main thread. |
| 108 | */ |
| 109 | __NO_RETURN void app_main_thread (void *argument) { |
| 110 | int32_t rval; |
| 111 | uint32_t count; |
| 112 | uint32_t flags; |
| 113 | void *in_block; |
| 114 | void *out_block; |
| 115 | |
| 116 | /* Initialize input and output streams */ |
| 117 | init_streams(); |
| 118 | |
| 119 | /* Start input and output streams */ |
| 120 | rval = vStream_VideoIn->Start(VSTREAM_MODE_CONTINUOUS); |
| 121 | ASSERT(rval == VSTREAM_OK); |
| 122 | |
| 123 | rval = vStream_VideoOut->Start(VSTREAM_MODE_CONTINUOUS); |
| 124 | ASSERT(rval == VSTREAM_OK); |
| 125 | |
| 126 | printf("Video streaming started...\n"); |
| 127 | |
| 128 | /* Input to Output copy loop */ |
| 129 | for (count = 0; (VIDEO_TOTAL_BLOCKS == 0) || (count < VIDEO_TOTAL_BLOCKS); count++) { |
| 130 | |
| 131 | /* Wait for new video input frame */ |
| 132 | flags = osThreadFlagsWait(FRAME_RECEIVED | END_OF_STREAM, osFlagsWaitAny, osWaitForever); |
| 133 | |
| 134 | if (flags & END_OF_STREAM) { |
| 135 | /* End of Stream received, exit streaming loop */ |
| 136 | break; |
| 137 | } |
| 138 | |
| 139 | /* Get a pointer to a block of memory holding the input frame */ |
| 140 | in_block = vStream_VideoIn->GetBlock(); |
| 141 | ASSERT(in_block != NULL); |
| 142 | |
| 143 | /* Wait for available output frame */ |
| 144 | osThreadFlagsWait(FRAME_SENT, osFlagsWaitAny, osWaitForever); |
| 145 | |
| 146 | /* Get a pointer to a block of memory for the output frame */ |
| 147 | out_block = vStream_VideoOut->GetBlock(); |
| 148 | ASSERT(out_block != NULL); |
| 149 | |
| 150 | /* Copy input frame to output frame with cropping */ |
| 151 | frame_copy(in_block, out_block); |
| 152 | |
| 153 | /* Release a block of memory holding the input frame */ |
| 154 | rval = vStream_VideoIn->ReleaseBlock(); |
| 155 | ASSERT(rval == VSTREAM_OK); |
| 156 | |
| 157 | /* Release a block of memory holding the output frame */ |
| 158 | rval = vStream_VideoOut->ReleaseBlock(); |
| 159 | ASSERT(rval == VSTREAM_OK); |
| 160 | } |
| 161 | |
| 162 | /* End of stream, stop streaming */ |
| 163 | rval = vStream_VideoIn->Stop(); |
| 164 | ASSERT(rval == VSTREAM_OK); |
| 165 | |
| 166 | rval = vStream_VideoOut->Stop(); |
nothing calls this directly
no test coverage detected