Code: Select all
static unsigned int format_callback(
void **data,
char *chroma,
unsigned *width,
unsigned *height,
unsigned *pitches,
unsigned *lines)
{
HRESULT hr = S_OK;
CMediaPlayer::Context* context = (CMediaPlayer::Context*)(*data);
video_format_t format;
ZeroMemory(&format, sizeof(video_format_t));
vlc_mutex_init(&context->mutex);
video_format_Setup(&format, vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma), *width, *height, *width, *height, 0, 0);
format.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
picture_t* picture = picture_NewFromFormat(&format);
context->picture = picture;
for (int planeNumber = 0; planeNumber < picture->i_planes; planeNumber++)
{
pitches[planeNumber] = picture->p[planeNumber].i_pitch;
lines[planeNumber] = picture->p[planeNumber].i_lines;
}
context->planesSwapped = false;
if (picture->format.i_chroma == VLC_CODEC_I420 ||
picture->format.i_chroma == VLC_CODEC_J420 ||
picture->format.i_chroma == VLC_CODEC_YV12) {
/* The dx/d3d buffer is always allocated as YV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
context->planesSwapped = true;
}
}
context->window1 = WindowContext::Create(context->parent1, format.i_visible_width, format.i_visible_height);
context->window2 = WindowContext::Create(context->parent2, format.i_visible_width, format.i_visible_height);
return context->picture->i_planes;
}
Here is what the image looks like when I am rendering.
My renderer has been rendering videos fine. It is just this video. I think it is related to the fact that the dimensions are reported different in VLC, than in Windows Media Player. Can someone help guide my on this issue?