Hi,
Am 08.11.2012 11:47, schrieb Joseph Artsimovich:
> Hi,
>
> So, my last patch was replacing:
> avcodec_alloc_context3(NULL);
> with:
> avcodec_alloc_context3(encoder ? encoder : decoder);
>
> I assumed either encoder or decoder would be set but not both. Now it
> turns out both are usually set, and are different ones. What's worse,
> passing a wrong one can cause memory corruption. The test case is
> decoding XDCAM and passing the encoder instead of the decoder.
>
> Now the problem is I couldn't find a way to figure out whether we are
> encoding or decoding.
> Burkhard, can you take a look?
Right now I don't see how to detect, if we are encoding or decoding.
I'd suggest the following:
- Add a "do_encode" flag to quicktime_video_map_t
- Set this flag in quicktime_init_video_map(), there is an "int encode" argument
- Use the flag in quicktime_init_video_codec_ffmpeg().
Note that the vtrack argument for quicktime_init_video_codec_ffmpeg() can also be
NULL when we are just testing if the codec supports writing compressed packets.
Burkhard
|