Spurious wakeups may sound strange, but on some multiprocessor systems, making condition wakeup completely predictable might substantially slow all condition variable operations.
intReadFunc(void* ptr, uint8_t* buf, int buf_size) { // Left to implement } int64_tSeekFunc(void* ptr, int64_t pos, int whence) { // Left to implement } AVIOContext* pIOCtx = avio_alloc_context(pBuffer, iBufSize, // internal Buffer and its size 0, // bWriteable (1=true,0=false) pContext, // user data ; will be passed to our callback functions ReadFunc, 0, // Write callback function (not used in this example) SeekFunc);
if (avformat_open_input(&pCtx, "", 0, 0)) != 0) // Error Handling
接著就跟一般無異了
Final
使用完後需要釋放資源
1 2 3
avformat_close_input(pCtx); // AVFormatContext is released by avformat_close_input av_free(pIOCtx); // AVIOContext is released by av_free delete[] pBuffer;