How can I get I420 frame correctly?
Posted: 06 Aug 2015 04:13
I use libvlc_video_set_callbacks to get the output I420 frames but find I get wrong picture. The code is listed below:
libvlc_video_lock_cb
And when I check the buff, I found that only first 128000 byte have non-zero data while my test video's size is 1280*720.
In my cognition, planes[0] will save the Y channel and it's size will be width*height, and planes[1] will save U channel and it's size will be (width/2)*(height/2) ans so as the planes[2] save V channel. Is it right?
libvlc_video_lock_cb
Code: Select all
vlcCallBackHandler* handler = (vlcCallBackHandler*) opaque;
int length = handler->width * handler->height;
planes[0] = handler->buff;
planes[1] = handler->buff + length;
planes[2] = handler->buff + length*5/4;
handler->mutex.lock();
In my cognition, planes[0] will save the Y channel and it's size will be width*height, and planes[1] will save U channel and it's size will be (width/2)*(height/2) ans so as the planes[2] save V channel. Is it right?