On 12/22/2011 06:59 AM, Måns Rullgård wrote: > Anton Khirnov <[email protected]> writes: > >> From: Stefano Sabatini <[email protected]> >> >> The format is a per-frame property, having it in AVFrame simplify the >> operation of extraction of that information, since avoids the need to >> access the codec/stream context. >> --- >> libavcodec/avcodec.h | 9 +++++++++ >> libavcodec/utils.c | 5 +++++ >> 2 files changed, 14 insertions(+), 0 deletions(-) >> >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 9cee89d..fdcd844 100644 >> --- a/libavcodec/avcodec.h >> +++ b/libavcodec/avcodec.h >> @@ -1272,6 +1272,15 @@ typedef struct AVFrame { >> * - decoding: Read by user. >> */ >> int width, height; >> + >> + /** >> + * format of the frame, -1 if unknown or unset >> + * It should be cast to the corresponding enum (enum PixelFormat >> + * for video, enum AVSampleFormat for audio) >> + * - encoding: unused >> + * - decoding: Read by user. >> + */ >> + int format; >> } AVFrame; > > The comment could be better worded. Remove the nonsense about casting > for starters. An enum is an integer, there's no casting involved. > > When does the pixel/sample format change from one frame to the next?
The only situation I can think of would be image sequences, where each image could potentially have different pixel formats. Not that we necessarily need to support that, but it's a possibility that we might consider handling. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
