Hello,
I have a function, get_vp(), which works like this:
if end of video file:
return NULL;
AVFrame *ret = avcodec_alloc_frame();
fill ret with a new frame;
return ret;
When I use it in this way, everything is ok:
AVFrame *vp = get_vp();
while(vp != NULL) { show vp; free vp; vp = get_vp(); }
But when I rewrote my program like this... the output is a mess:
frames I got were not in the correct order.
AVFrame *vp_a = get_vp(); AVFrame *vp_b = get_vp();
while(vp_a != NULL) { show vp_a; free vp_a; vp_a = vp_b; vp_b = get_vp(); }
(For some formats, this works ok.)
And this causes the same problem:
#define T_NUMBER 10
SAVideoPacket *vp[T_NUMBER];
for(i = 0; i < T_NUMBER; i++)
vp[i] = SA_get_vp(sa_ctx);
for(i = 0; i < T_NUMBER; i++)
SaveFrame(vp[i]->frame_ptr, width, height);
for(i = 0; i < T_NUMBER; i++)
SA_free_vp(vp[i]);
(I have two test files on my disk: the one passed the previous test
did not pass this one.)
So, my question is: is it wrong, to use AVFrame allocated by
avcodec_alloc_frame(), to store several decoded frames at the same
time?
wecing.
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api