Initialize streams. This function initializes the input and output streams, registers the event callbacks and sets up the stream buffers. */
| 75 | event callbacks and sets up the stream buffers. |
| 76 | */ |
| 77 | static void init_streams (void) { |
| 78 | int32_t rval; |
| 79 | void *out_block; |
| 80 | |
| 81 | /* Setup input stream */ |
| 82 | rval = vStream_VideoIn->Initialize(VideoIn_Event_Callback); |
| 83 | ASSERT(rval == VSTREAM_OK); |
| 84 | |
| 85 | rval = vStream_VideoIn->SetBuf(video_in_buf, sizeof(video_in_buf), VIDEO_IN_BUF_BLOCK_SIZE); |
| 86 | ASSERT(rval == VSTREAM_OK); |
| 87 | |
| 88 | /* Setup output stream */ |
| 89 | rval = vStream_VideoOut->Initialize(VideoOut_Event_Callback); |
| 90 | ASSERT(rval == VSTREAM_OK); |
| 91 | |
| 92 | rval = vStream_VideoOut->SetBuf(video_out_buf, sizeof(video_out_buf), VIDEO_OUT_BUF_BLOCK_SIZE); |
| 93 | ASSERT(rval == VSTREAM_OK); |
| 94 | |
| 95 | /* Output stream will fail to start without data to output. */ |
| 96 | /* Prepare first block of data and release it to the driver. */ |
| 97 | out_block = vStream_VideoOut->GetBlock(); |
| 98 | ASSERT(out_block != NULL); |
| 99 | |
| 100 | memset(out_block, 0x00, VIDEO_OUT_BUF_BLOCK_SIZE); |
| 101 | |
| 102 | rval = vStream_VideoOut->ReleaseBlock(); |
| 103 | ASSERT(rval == VSTREAM_OK); |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | Application main thread. |