Hi,
I'm trying to develop a project using the ffmpeg library, and while just
about all is fine and well, I read and understood and applied most tutorials
found, especially the one at http://www.dranger.com/ffmpeg/tutorial01.html,
I have the following problem I can't find a way to bypass.
because I need to speed up as much as I can the parsing of the video file, I
have one thread that deals with av_read_frame and avcodec_decode_video, and
when a frame is obtained, it is fed into a queue thatis watched by another
thread which does the actual displaying, or any algorithm I want to test on
the frames received.
basically, the first thread's code is:
AVPacket *packet = (AVPacket*)av_mallocz(sizeof(AVPacket));
av_new_packet(packet, streamFormatCtx->packet_size);
while(av_read_frame(streamFormatCtx, packet) >= 0)
{
if(packet->stream_index == videoStreamNo)
{
AVFrame *currentFrame = avcodec_alloc_frame();
avcodec_decode_video(videoCodecCtx, currentFrame, &isFrameFinished,
packet->data, packet->size);
if(isFrameFinished != 0)
{
VideoFrameQueue_enqueue(currentFrame);
frameNo += 1;
}
}
av_free_packet(packet);
av_new_packet(packet, streamFormatCtx->packet_size);
}
The problem at hand is that even if I try to give avcodec_decode_video fresh
pointers every time (currentFrame and packet), after avcodec_decode_video
executes, *I always get the same pointers inside currentFrame->data*, which
esentially means I can't save any array of frames as they will all have the
same content.
Can anybody tell me if there is any "clean" way to tell the library to give
me new pointers for currentFrame->data ?
Took me about a day and a half to figure what was happening, and although
(now that I know), I cant just copy the given data arrays into fresh
pointers for the queue, I need to make this as fast as possible...
With Respect,
Bogdan Coanda
--
Bogdan COANDA
AIESEC Iasi
AIESEC in Romania
Mobile: +40-724 013 068
E-mail: [email protected]
Website: www.aieseciasi.ro
_____________________________________________________________________________
AIESEC - The international platform for young people to discover and develop
their potential
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user