On 5/4/2020 3:26 PM, Anamitra Ghorui wrote: > Hello, > > I have a question regerding the internal decoding/encoding API. There seems > to be two functions that may be alternatively called, on the basis of whether > they are defined or not, both defined in the AVCodec struct: > 1. decode() > 2. receive_frame() > > From the comments above the definition of receive_frame(): > "Decode API with decoupled packet/frame dataflow. This function is called to > get > one output frame. It should call ff_decode_get_packet() to obtain input data." > > From what I can see, if receive_frame() is not defined, a separate function is > called, decode_simple_receive_frame(), which in turn calls > decode_receive_frame_internal(). > * receive_frame() therefore allows more "fine grained" control on how the > frame generation and return values are handled, from what I can see. > * But for most purposes defining decode() is enough. > * receive_frame() takes priority over decode(). > > Is this correct?
Yes. For a simple decoder, using AVCodec.decode() is enough. It is also currently required if you want to implement frame threading. Calls to AVCodec.decode() will always include a new packet to process, even if you don't currently need one because you for example have more frames to output with the data you already processed, whereas calls to AVCodec.receive_frame() let you requests packets when you need them using ff_decode_get_packet(). _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".