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 | API changes, most recent first: | 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 | 2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame | 19 | 2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame |
| 17 | Add width and height fields to AVFrame. | 20 | Add width and height fields to AVFrame. |
| 18 | 21 | ||
| @@ -1025,6 +1025,15 @@ typedef struct AVPanScan{ · 1024 unmodified lines | |||
| 1025 | * - decoding: Read by user.\ | 1025 | * - decoding: Read by user.\ |
| 1026 | */\ | 1026 | */\ |
| 1027 | int width, height;\ | 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 | #define FF_QSCALE_TYPE_MPEG1 0 | 1039 | #define FF_QSCALE_TYPE_MPEG1 0 |
| @@ -456,6 +456,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 455 unmodified lines | |||
| 456 | pic->pkt_pos = -1; | 456 | pic->pkt_pos = -1; |
| 457 | pic->key_frame= 1; | 457 | pic->key_frame= 1; |
| 458 | pic->sample_aspect_ratio = (AVRational){0, 1}; | 458 | pic->sample_aspect_ratio = (AVRational){0, 1}; |
| 459 | pic->format = -1; /* unknown */ | ||
| 459 | } | 460 | } |
| 460 | 461 | ||
| 461 | AVFrame *avcodec_alloc_frame(void){ | 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 | picture->width = avctx->width; | 744 | picture->width = avctx->width; |
| 744 | if (!picture->height) | 745 | if (!picture->height) |
| 745 | picture->height = avctx->height; | 746 | picture->height = avctx->height; |
| 747 | if (picture->format == PIX_FMT_NONE) | ||
| 748 | picture->format = avctx->pix_fmt; | ||
| 746 | } | 749 | } |
| 747 | 750 | ||
| 748 | emms_c(); //needed to avoid an emms_c() call before every return; | 751 | emms_c(); //needed to avoid an emms_c() call before every return; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #define AVCODEC_VERSION_H | 21 | #define AVCODEC_VERSION_H |
| 22 | 22 | ||
| 23 | #define LIBAVCODEC_VERSION_MAJOR 53 | 23 | #define LIBAVCODEC_VERSION_MAJOR 53 |
| 24 | #define LIBAVCODEC_VERSION_MINOR 4 | 24 | #define LIBAVCODEC_VERSION_MINOR 5 |
| 25 | #define LIBAVCODEC_VERSION_MICRO 0 | 25 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 26 | 26 | ||
| 27 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 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 | memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); | 104 | memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); |
| 105 | c->frame.width = frame->width; | 105 | c->frame.width = frame->width; |
| 106 | c->frame.height = frame->height; | 106 | c->frame.height = frame->height; |
| 107 | c->frame.format = frame->format; | ||
| 107 | c->frame.interlaced_frame= frame->interlaced_frame; | 108 | c->frame.interlaced_frame= frame->interlaced_frame; |
| 108 | c->frame.top_field_first = frame->top_field_first; | 109 | c->frame.top_field_first = frame->top_field_first; |
| 109 | c->frame.key_frame = frame->key_frame; | 110 | c->frame.key_frame = frame->key_frame; |