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.
Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | API changes, most recent first: |
| 15 | 15 | |
| 16 | +2011-05-07 - xxxxxxx - lavc 53.5.0 - AVFrame | |
| 17 | + Add format field to AVFrame. | |
| 18 | + | |
| 16 | 19 | 2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame |
| 17 | 20 | Add width and height fields to AVFrame. |
| 18 | 21 | |
| @@ -1025,6 +1025,15 @@ typedef struct AVPanScan{ · 1024 unmodified lines | ||
| 1025 | 1025 | * - decoding: Read by user.\ |
| 1026 | 1026 | */\ |
| 1027 | 1027 | int width, height;\ |
| 1028 | +\ | |
| 1029 | + /**\ | |
| 1030 | + * format of the frame, -1 if unknown or unset\ | |
| 1031 | + * It should be cast to the corresponding enum (enum PixelFormat\ | |
| 1032 | + * for video, enum AVSampleFormat for audio)\ | |
| 1033 | + * - encoding: unused\ | |
| 1034 | + * - decoding: Read by user.\ | |
| 1035 | + */\ | |
| 1036 | + int format;\ | |
| 1028 | 1037 | |
| 1029 | 1038 | |
| 1030 | 1039 | #define FF_QSCALE_TYPE_MPEG1 0 |
| @@ -456,6 +456,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 455 unmodified lines | ||
| 456 | 456 | pic->pkt_pos = -1; |
| 457 | 457 | pic->key_frame= 1; |
| 458 | 458 | pic->sample_aspect_ratio = (AVRational){0, 1}; |
| 459 | + pic->format = -1; /* unknown */ | |
| 459 | 460 | } |
| 460 | 461 | |
| 461 | 462 | AVFrame *avcodec_alloc_frame(void){ |
| @@ -743,6 +744,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 281 unmodified lines | ||
| 743 | 744 | picture->width = avctx->width; |
| 744 | 745 | if (!picture->height) |
| 745 | 746 | picture->height = avctx->height; |
| 747 | + if (picture->format == PIX_FMT_NONE) | |
| 748 | + picture->format = avctx->pix_fmt; | |
| 746 | 749 | } |
| 747 | 750 | |
| 748 | 751 | emms_c(); //needed to avoid an emms_c() call before every return; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #define AVCODEC_VERSION_H |
| 22 | 22 | |
| 23 | 23 | #define LIBAVCODEC_VERSION_MAJOR 53 |
| 24 | −#define LIBAVCODEC_VERSION_MINOR 4 | |
| 24 | +#define LIBAVCODEC_VERSION_MINOR 5 | |
| 25 | 25 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 26 | 26 | |
| 27 | 27 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -104,6 +104,7 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, · 103 unmodified lines | ||
| 104 | 104 | memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); |
| 105 | 105 | c->frame.width = frame->width; |
| 106 | 106 | c->frame.height = frame->height; |
| 107 | + c->frame.format = frame->format; | |
| 107 | 108 | c->frame.interlaced_frame= frame->interlaced_frame; |
| 108 | 109 | c->frame.top_field_first = frame->top_field_first; |
| 109 | 110 | c->frame.key_frame = frame->key_frame; |