avcodec/progressframe: Explain how unnamed union can simplify accesses

This relies on the common initial seqence guarantee
(and on C11 support for unnamed members).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-04-19 14:59:29 +02:00
parent 822e2843ca
commit 1d17d84b7d
1 changed files with 12 additions and 0 deletions

View File

@ -58,6 +58,18 @@
struct AVCodecContext;
/**
* The ProgressFrame structure.
* Hint: It is guaranteed that the AVFrame pointer is at the start
* of ProgressFrame. This allows to use an unnamed
* union {
* struct {
* AVFrame *f;
* };
* ProgressFrame pf;
* };
* to simplify accessing the embedded AVFrame.
*/
typedef struct ProgressFrame {
struct AVFrame *f;
struct ProgressInternal *progress;