History

lavc: add format field to AVFrame

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.

Stefano Sabatini committed 15 years ago

Commit 18ded931 parent 22333a65 files · +17 −1Browse files

Unified · Split

5 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +9 −0
  3. libavcodec/utils.c +3 −0
  4. libavcodec/version.h +1 −1
  5. libavfilter/vsrc_buffer.c +1 −0
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2011-05-07 - xxxxxxx - lavc 53.5.0 - AVFrame
17+ Add format field to AVFrame.
18+
1619 2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame
1720 Add width and height fields to AVFrame.
1821
libavcodec/avcodec.h+9−0
@@ -1025,6 +1025,15 @@ typedef struct AVPanScan{ · 1024 unmodified lines
10251025 * - decoding: Read by user.\
10261026 */\
10271027 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;\
10281037
10291038
10301039 #define FF_QSCALE_TYPE_MPEG1 0
libavcodec/utils.c+3−0
@@ -456,6 +456,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 455 unmodified lines
456456 pic->pkt_pos = -1;
457457 pic->key_frame= 1;
458458 pic->sample_aspect_ratio = (AVRational){0, 1};
459+ pic->format = -1; /* unknown */
459460 }
460461
461462 AVFrame *avcodec_alloc_frame(void){
@@ -743,6 +744,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 281 unmodified lines
743744 picture->width = avctx->width;
744745 if (!picture->height)
745746 picture->height = avctx->height;
747+ if (picture->format == PIX_FMT_NONE)
748+ picture->format = avctx->pix_fmt;
746749 }
747750
748751 emms_c(); //needed to avoid an emms_c() call before every return;
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
24−#define LIBAVCODEC_VERSION_MINOR 4
24+#define LIBAVCODEC_VERSION_MINOR 5
2525 #define LIBAVCODEC_VERSION_MICRO 0
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavfilter/vsrc_buffer.c+1−0
@@ -104,6 +104,7 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, · 103 unmodified lines
104104 memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));
105105 c->frame.width = frame->width;
106106 c->frame.height = frame->height;
107+ c->frame.format = frame->format;
107108 c->frame.interlaced_frame= frame->interlaced_frame;
108109 c->frame.top_field_first = frame->top_field_first;
109110 c->frame.key_frame = frame->key_frame;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t