On Apr 10, 2010, at 18:28, Thomas Worth <[email protected]> wrote:
It seems like the AVFrame struct that avcodec_decode_video2 delivers
(which contains the decoded video frame) is referencing something
that
is changed during the next decode cycle. This is the case whether I
create an array of AVFrame*s or just use one. It seems to me that
creating a unique AVFrame struct for each thread would only point to
that exact part of the file, unless the next time
avcodec_decode_video2 is called overwrites all previous AVFrame
structures.
OK, I think the mists are clearing. Yes, with some codecs, the
previous
frame will be used. There's some sort of marker that defines that,
I think.
What you can do (except, I think in the ffmpeg-mt fork) is to take
more
control of the AVFrames yourself by marking them as under your
control, not
under ffmpeg's. I bet if you looked at your sturctures, the data
members are
being filled in the same - the AVFrame is just a holder, after all.
You're looking to set the frame's 'type' after it's delivered to
you (maybe
even before). That will tell ffmpeg to leave that frame alone, and
it passes
responsibility for deleting it to you.
Something like: frame.type = FF_BUFFER_TYPE_USER; as I recall.
I tried this with normal ffmpeg (not ffmpeg-mt) using the following
line:
vidframe->type = FF_BUFFER_TYPE_USER;
That compiled OK, and ran OK, but I am still getting interference from
other frames. I tried doing this in several different places --
before, after etc. It didn't make a difference.
As a side note, I tried this with ffmpeg-mt, but it crashed my app. I
assume this isn't supported with ffmpeg-mt.
I noticed some posts you made on this last year on other forums. Did
you ever get your code working with this option?
Yes, in the main branch, although unlike you, I just kept the frames
around to read. I also created my own storage. That might be why mt
crashed for you - it expected you to create storage. There's also lots
to work out about when ffmpeg is done with each frame.
Take a look at myth tv source, and google for that enum - you'll find
people using it.
In the mean time, check out the data pointers in your AV Frames. They
must be all the same or overlapping? You can also hook into the
get_buffer callback and see when frames are being allocated.
Bruce
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user