Forum > OpenGL

Draw frame from FFMpeg

(1/1)

RedCat:
Kind time of the day, the question of drawing using OpenGL means a frame received from the ffmpeg decoder (continuation of this topic:https://forum.lazarus.freepascal.org/index.php/topic,49196.msg356348.html#msg356348) I listened to the tips that were given to me and tried to manually copy the bytes, it seemed to work better than with direct rendering of data from the decoder, but still it is not drawn as it should and I used pixel-by-pixel copying, which is very slow
here is the code:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure SwapTB(dataIN,dataOUT : Pointer;SizeX,SizeY : Integer);var  x,y:GLint;  temp1,temp2,temp3: GLbyte;beginfor y := 0 to (SizeY*SizeX)-2 do   begin      With TWrap(DataIN^)[SizeY*SizeX-y*4] do     begin       TWrap(DataOUT^)[y].R:=R+y*SizeX*4;       TWrap(DataOUT^)[y].G:=G+y*SizeX*4;       TWrap(DataOUT^)[y].B:=B+y*SizeX*4;     end;   end; end;  //........sws_scale(img_convert_context,@frame^.data,@frame^.linesize,0,codec_context^.height,@pFrameYUV420P^.data,@pFrameYUV420P^.linesize); SwapTB(pFrameYUV420P^.data[0],pData,codec_context^.width,codec_context^.height); //.......gluBuild2DMipmaps(GL_TEXTURE_2D, 3, Width, Height, GL_RGB, GL_UNSIGNED_BYTE, pData);//.......   please tell me the normal way to draw frames from ffmpeg (avcodec) to opengl texture
the rendering result is also attached
rendermustbe - original frame
renderresult -  direct rendering of data from a decoder
renderresultnew -  rendering by copying pixels

Navigation

[0] Message Index

Go to full version