|
|
|
@ -750,9 +750,6 @@ bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char** data, int* step, int* |
|
|
|
|
if( !video_st || !picture->data[0] ) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_RGB24, |
|
|
|
|
video_st->codec->width, video_st->codec->height); |
|
|
|
|
|
|
|
|
|
if( img_convert_ctx == NULL || |
|
|
|
|
frame.width != video_st->codec->width || |
|
|
|
|
frame.height != video_st->codec->height ) |
|
|
|
@ -775,8 +772,17 @@ bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char** data, int* step, int* |
|
|
|
|
|
|
|
|
|
if (img_convert_ctx == NULL) |
|
|
|
|
return false;//CV_Error(0, "Cannot initialize the conversion context!");
|
|
|
|
|
|
|
|
|
|
rgb_picture.data[0] = (uint8_t*)realloc(rgb_picture.data[0], |
|
|
|
|
avpicture_get_size( AV_PIX_FMT_BGR24, |
|
|
|
|
video_st->codec->width, video_st->codec->height )); |
|
|
|
|
frame.data = rgb_picture.data[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_RGB24, |
|
|
|
|
video_st->codec->width, video_st->codec->height); |
|
|
|
|
frame.step = rgb_picture.linesize[0]; |
|
|
|
|
|
|
|
|
|
sws_scale( |
|
|
|
|
img_convert_ctx, |
|
|
|
|
picture->data, |
|
|
|
|