Hello. I am working on a piece of software to play movies in opengl. I  
need to be as nice to the CPU as possible.

I managed to display a movie by converting each frame from  
PIX_FMT_YUV420P to PIX_FMT_RGB24 using sw_scale. It shows the video  
correct but it is slow.

Is there anyway I can bind the data in an AVFrame to an opengl texture  
without having to convert it with swscale.

My problem is not the colourspace stuff I have to do with shaders  
programs or color matrices later, but rather as soon as I try to bind  
the data in my AVFrame with GL_RGB format I get a segfault.

If I do:
glTexImage2D(GL_TEXTURE_2D, 0, 3,
     movie->codec_ctx->width, movie->codec_ctx->height, 0,
     GL_LUMINANCE, GL_UNSIGNED_BYTE, //GL_RGB, GL_UNSIGNED_BYTE <- segfaults
     movie->frame->data[0]);

I get a black and white video with horizontal stripes. I can vaguely  
make out parts of the video but it's greatly disorted.

I pasted all my code here:
http://pastebin.com/m162f9bab

Anyone have any experience in this?



_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to