medha
20th April 2009, 07:00
HI All,
I am using JM Player H264 softcodec and i want to display the decoded frames.
For displaying, i am using SDL library...
As JM Player gives the output in YUV format, i am using the APIs of SDL as follows..
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf("Unable to initialize SDL: %s\n", SDL_GetError());
}
screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE );
if (screen == NULL)
{
printf("Unable to set video mode: %s\n", SDL_GetError());
}
if(screen != NULL)
{
pOverlay = SDL_CreateYUVOverlay(img->width, img->height, SDL_YV12_OVERLAY, screen);
rect.w = 640;
rect.h = 480;
SDL_LockYUVOverlay(pOverlay);
memcpy(pOverlay->pixels[0], recfr.yptr, (img->height* img->width));
memcpy(pOverlay->pixels[1], recfr.uptr, (img->height*img->width/4));
memcpy(pOverlay->pixels[2], recfr.vptr, (img->height*img->width/4));
}
if( (SDL_DisplayYUVOverlay(pOverlay, &rect) ) != 0)
{
printf("Unable to initialize SDL: %s\n", SDL_GetError());
}
SDL_UnlockYUVOverlay(pOverlay);
SDL_FreeYUVOverlay(pOverlay);
But the display is full of green lines and mirror image is also coming..
Please let me know, how can i solve this..
Thanks and Regards,
Medha
I am using JM Player H264 softcodec and i want to display the decoded frames.
For displaying, i am using SDL library...
As JM Player gives the output in YUV format, i am using the APIs of SDL as follows..
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf("Unable to initialize SDL: %s\n", SDL_GetError());
}
screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE );
if (screen == NULL)
{
printf("Unable to set video mode: %s\n", SDL_GetError());
}
if(screen != NULL)
{
pOverlay = SDL_CreateYUVOverlay(img->width, img->height, SDL_YV12_OVERLAY, screen);
rect.w = 640;
rect.h = 480;
SDL_LockYUVOverlay(pOverlay);
memcpy(pOverlay->pixels[0], recfr.yptr, (img->height* img->width));
memcpy(pOverlay->pixels[1], recfr.uptr, (img->height*img->width/4));
memcpy(pOverlay->pixels[2], recfr.vptr, (img->height*img->width/4));
}
if( (SDL_DisplayYUVOverlay(pOverlay, &rect) ) != 0)
{
printf("Unable to initialize SDL: %s\n", SDL_GetError());
}
SDL_UnlockYUVOverlay(pOverlay);
SDL_FreeYUVOverlay(pOverlay);
But the display is full of green lines and mirror image is also coming..
Please let me know, how can i solve this..
Thanks and Regards,
Medha