]> git.sesse.net Git - ffmpeg/blob - libavutil/frame.c
Merge commit 'e2ce16392205d8efe9143329ed3fb5fcb15498fa'
[ffmpeg] / libavutil / frame.c
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19
20 #include "channel_layout.h"
21 #include "avassert.h"
22 #include "buffer.h"
23 #include "common.h"
24 #include "dict.h"
25 #include "frame.h"
26 #include "imgutils.h"
27 #include "mem.h"
28 #include "samplefmt.h"
29
30 MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
31 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
32 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
33 MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
34 MAKE_ACCESSORS(AVFrame, frame, int,     channels)
35 MAKE_ACCESSORS(AVFrame, frame, int,     sample_rate)
36 MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
37 MAKE_ACCESSORS(AVFrame, frame, int,     decode_error_flags)
38 MAKE_ACCESSORS(AVFrame, frame, int,     pkt_size)
39 MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
40 MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
41
42 #define CHECK_CHANNELS_CONSISTENCY(frame) \
43     av_assert2(!(frame)->channel_layout || \
44                (frame)->channels == \
45                av_get_channel_layout_nb_channels((frame)->channel_layout))
46
47 AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;};
48
49 int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
50 {
51     av_buffer_unref(&f->qp_table_buf);
52
53     f->qp_table_buf = buf;
54
55     f->qscale_table = buf->data;
56     f->qstride      = stride;
57     f->qscale_type  = qp_type;
58
59     return 0;
60 }
61
62 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
63 {
64     *stride = f->qstride;
65     *type   = f->qscale_type;
66
67     if (!f->qp_table_buf)
68         return NULL;
69
70     return f->qp_table_buf->data;
71 }
72
73 const char *av_get_colorspace_name(enum AVColorSpace val)
74 {
75     static const char * const name[] = {
76         [AVCOL_SPC_RGB]       = "GBR",
77         [AVCOL_SPC_BT709]     = "bt709",
78         [AVCOL_SPC_FCC]       = "fcc",
79         [AVCOL_SPC_BT470BG]   = "bt470bg",
80         [AVCOL_SPC_SMPTE170M] = "smpte170m",
81         [AVCOL_SPC_SMPTE240M] = "smpte240m",
82         [AVCOL_SPC_YCOCG]     = "YCgCo",
83     };
84     if ((unsigned)val >= FF_ARRAY_ELEMS(name))
85         return NULL;
86     return name[val];
87 }
88
89 static void get_frame_defaults(AVFrame *frame)
90 {
91     if (frame->extended_data != frame->data)
92         av_freep(&frame->extended_data);
93
94     memset(frame, 0, sizeof(*frame));
95
96     frame->pts                   =
97     frame->pkt_dts               =
98     frame->pkt_pts               = AV_NOPTS_VALUE;
99     av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
100     av_frame_set_pkt_duration         (frame, 0);
101     av_frame_set_pkt_pos              (frame, -1);
102     av_frame_set_pkt_size             (frame, -1);
103     frame->key_frame           = 1;
104     frame->sample_aspect_ratio = (AVRational){ 0, 1 };
105     frame->format              = -1; /* unknown */
106     frame->extended_data       = frame->data;
107     frame->color_primaries     = AVCOL_PRI_UNSPECIFIED;
108     frame->color_trc           = AVCOL_TRC_UNSPECIFIED;
109     frame->colorspace          = AVCOL_SPC_UNSPECIFIED;
110     frame->color_range         = AVCOL_RANGE_UNSPECIFIED;
111     frame->chroma_location     = AVCHROMA_LOC_UNSPECIFIED;
112 }
113
114 static void free_side_data(AVFrameSideData **ptr_sd)
115 {
116     AVFrameSideData *sd = *ptr_sd;
117
118     av_freep(&sd->data);
119     av_dict_free(&sd->metadata);
120     av_freep(ptr_sd);
121 }
122
123 static void wipe_side_data(AVFrame *frame)
124 {
125     int i;
126
127     for (i = 0; i < frame->nb_side_data; i++) {
128         free_side_data(&frame->side_data[i]);
129     }
130     frame->nb_side_data = 0;
131
132     av_freep(&frame->side_data);
133 }
134
135 AVFrame *av_frame_alloc(void)
136 {
137     AVFrame *frame = av_mallocz(sizeof(*frame));
138
139     if (!frame)
140         return NULL;
141
142     frame->extended_data = NULL;
143     get_frame_defaults(frame);
144
145     return frame;
146 }
147
148 void av_frame_free(AVFrame **frame)
149 {
150     if (!frame || !*frame)
151         return;
152
153     av_frame_unref(*frame);
154     av_freep(frame);
155 }
156
157 static int get_video_buffer(AVFrame *frame, int align)
158 {
159     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
160     int ret, i;
161
162     if (!desc)
163         return AVERROR(EINVAL);
164
165     if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0)
166         return ret;
167
168     if (!frame->linesize[0]) {
169         for(i=1; i<=align; i+=i) {
170             ret = av_image_fill_linesizes(frame->linesize, frame->format,
171                                           FFALIGN(frame->width, i));
172             if (ret < 0)
173                 return ret;
174             if (!(frame->linesize[0] & (align-1)))
175                 break;
176         }
177
178         for (i = 0; i < 4 && frame->linesize[i]; i++)
179             frame->linesize[i] = FFALIGN(frame->linesize[i], align);
180     }
181
182     for (i = 0; i < 4 && frame->linesize[i]; i++) {
183         int h = FFALIGN(frame->height, 32);
184         if (i == 1 || i == 2)
185             h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
186
187         frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1);
188         if (!frame->buf[i])
189             goto fail;
190
191         frame->data[i] = frame->buf[i]->data;
192     }
193     if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
194         av_buffer_unref(&frame->buf[1]);
195         frame->buf[1] = av_buffer_alloc(1024);
196         if (!frame->buf[1])
197             goto fail;
198         frame->data[1] = frame->buf[1]->data;
199     }
200
201     frame->extended_data = frame->data;
202
203     return 0;
204 fail:
205     av_frame_unref(frame);
206     return AVERROR(ENOMEM);
207 }
208
209 static int get_audio_buffer(AVFrame *frame, int align)
210 {
211     int channels;
212     int planar   = av_sample_fmt_is_planar(frame->format);
213     int planes;
214     int ret, i;
215
216     if (!frame->channels)
217         frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout);
218
219     channels = frame->channels;
220     planes = planar ? channels : 1;
221
222     CHECK_CHANNELS_CONSISTENCY(frame);
223     if (!frame->linesize[0]) {
224         ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
225                                          frame->nb_samples, frame->format,
226                                          align);
227         if (ret < 0)
228             return ret;
229     }
230
231     if (planes > AV_NUM_DATA_POINTERS) {
232         frame->extended_data = av_mallocz_array(planes,
233                                           sizeof(*frame->extended_data));
234         frame->extended_buf  = av_mallocz_array((planes - AV_NUM_DATA_POINTERS),
235                                           sizeof(*frame->extended_buf));
236         if (!frame->extended_data || !frame->extended_buf) {
237             av_freep(&frame->extended_data);
238             av_freep(&frame->extended_buf);
239             return AVERROR(ENOMEM);
240         }
241         frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;
242     } else
243         frame->extended_data = frame->data;
244
245     for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
246         frame->buf[i] = av_buffer_alloc(frame->linesize[0]);
247         if (!frame->buf[i]) {
248             av_frame_unref(frame);
249             return AVERROR(ENOMEM);
250         }
251         frame->extended_data[i] = frame->data[i] = frame->buf[i]->data;
252     }
253     for (i = 0; i < planes - AV_NUM_DATA_POINTERS; i++) {
254         frame->extended_buf[i] = av_buffer_alloc(frame->linesize[0]);
255         if (!frame->extended_buf[i]) {
256             av_frame_unref(frame);
257             return AVERROR(ENOMEM);
258         }
259         frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data;
260     }
261     return 0;
262
263 }
264
265 int av_frame_get_buffer(AVFrame *frame, int align)
266 {
267     if (frame->format < 0)
268         return AVERROR(EINVAL);
269
270     if (frame->width > 0 && frame->height > 0)
271         return get_video_buffer(frame, align);
272     else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0))
273         return get_audio_buffer(frame, align);
274
275     return AVERROR(EINVAL);
276 }
277
278 int av_frame_ref(AVFrame *dst, const AVFrame *src)
279 {
280     int i, ret = 0;
281
282     dst->format         = src->format;
283     dst->width          = src->width;
284     dst->height         = src->height;
285     dst->channels       = src->channels;
286     dst->channel_layout = src->channel_layout;
287     dst->nb_samples     = src->nb_samples;
288
289     ret = av_frame_copy_props(dst, src);
290     if (ret < 0)
291         return ret;
292
293     /* duplicate the frame data if it's not refcounted */
294     if (!src->buf[0]) {
295         ret = av_frame_get_buffer(dst, 32);
296         if (ret < 0)
297             return ret;
298
299         ret = av_frame_copy(dst, src);
300         if (ret < 0)
301             av_frame_unref(dst);
302
303         return ret;
304     }
305
306     /* ref the buffers */
307     for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
308         if (!src->buf[i])
309             continue;
310         dst->buf[i] = av_buffer_ref(src->buf[i]);
311         if (!dst->buf[i]) {
312             ret = AVERROR(ENOMEM);
313             goto fail;
314         }
315     }
316
317     if (src->extended_buf) {
318         dst->extended_buf = av_mallocz_array(sizeof(*dst->extended_buf),
319                                        src->nb_extended_buf);
320         if (!dst->extended_buf) {
321             ret = AVERROR(ENOMEM);
322             goto fail;
323         }
324         dst->nb_extended_buf = src->nb_extended_buf;
325
326         for (i = 0; i < src->nb_extended_buf; i++) {
327             dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);
328             if (!dst->extended_buf[i]) {
329                 ret = AVERROR(ENOMEM);
330                 goto fail;
331             }
332         }
333     }
334
335     /* duplicate extended data */
336     if (src->extended_data != src->data) {
337         int ch = src->channels;
338
339         if (!ch) {
340             ret = AVERROR(EINVAL);
341             goto fail;
342         }
343         CHECK_CHANNELS_CONSISTENCY(src);
344
345         dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch);
346         if (!dst->extended_data) {
347             ret = AVERROR(ENOMEM);
348             goto fail;
349         }
350         memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch);
351     } else
352         dst->extended_data = dst->data;
353
354     memcpy(dst->data,     src->data,     sizeof(src->data));
355     memcpy(dst->linesize, src->linesize, sizeof(src->linesize));
356
357     return 0;
358
359 fail:
360     av_frame_unref(dst);
361     return ret;
362 }
363
364 AVFrame *av_frame_clone(const AVFrame *src)
365 {
366     AVFrame *ret = av_frame_alloc();
367
368     if (!ret)
369         return NULL;
370
371     if (av_frame_ref(ret, src) < 0)
372         av_frame_free(&ret);
373
374     return ret;
375 }
376
377 void av_frame_unref(AVFrame *frame)
378 {
379     int i;
380
381     wipe_side_data(frame);
382
383     for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
384         av_buffer_unref(&frame->buf[i]);
385     for (i = 0; i < frame->nb_extended_buf; i++)
386         av_buffer_unref(&frame->extended_buf[i]);
387     av_freep(&frame->extended_buf);
388     av_dict_free(&frame->metadata);
389     av_buffer_unref(&frame->qp_table_buf);
390
391     get_frame_defaults(frame);
392 }
393
394 void av_frame_move_ref(AVFrame *dst, AVFrame *src)
395 {
396     *dst = *src;
397     if (src->extended_data == src->data)
398         dst->extended_data = dst->data;
399     memset(src, 0, sizeof(*src));
400     get_frame_defaults(src);
401 }
402
403 int av_frame_is_writable(AVFrame *frame)
404 {
405     int i, ret = 1;
406
407     /* assume non-refcounted frames are not writable */
408     if (!frame->buf[0])
409         return 0;
410
411     for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
412         if (frame->buf[i])
413             ret &= !!av_buffer_is_writable(frame->buf[i]);
414     for (i = 0; i < frame->nb_extended_buf; i++)
415         ret &= !!av_buffer_is_writable(frame->extended_buf[i]);
416
417     return ret;
418 }
419
420 int av_frame_make_writable(AVFrame *frame)
421 {
422     AVFrame tmp;
423     int ret;
424
425     if (!frame->buf[0])
426         return AVERROR(EINVAL);
427
428     if (av_frame_is_writable(frame))
429         return 0;
430
431     memset(&tmp, 0, sizeof(tmp));
432     tmp.format         = frame->format;
433     tmp.width          = frame->width;
434     tmp.height         = frame->height;
435     tmp.channels       = frame->channels;
436     tmp.channel_layout = frame->channel_layout;
437     tmp.nb_samples     = frame->nb_samples;
438     ret = av_frame_get_buffer(&tmp, 32);
439     if (ret < 0)
440         return ret;
441
442     ret = av_frame_copy(&tmp, frame);
443     if (ret < 0) {
444         av_frame_unref(&tmp);
445         return ret;
446     }
447
448     ret = av_frame_copy_props(&tmp, frame);
449     if (ret < 0) {
450         av_frame_unref(&tmp);
451         return ret;
452     }
453
454     av_frame_unref(frame);
455
456     *frame = tmp;
457     if (tmp.data == tmp.extended_data)
458         frame->extended_data = frame->data;
459
460     return 0;
461 }
462
463 int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
464 {
465     int i;
466
467     dst->key_frame              = src->key_frame;
468     dst->pict_type              = src->pict_type;
469     dst->sample_aspect_ratio    = src->sample_aspect_ratio;
470     dst->pts                    = src->pts;
471     dst->repeat_pict            = src->repeat_pict;
472     dst->interlaced_frame       = src->interlaced_frame;
473     dst->top_field_first        = src->top_field_first;
474     dst->palette_has_changed    = src->palette_has_changed;
475     dst->sample_rate            = src->sample_rate;
476     dst->opaque                 = src->opaque;
477 #if FF_API_AVFRAME_LAVC
478     dst->type                   = src->type;
479 #endif
480     dst->pkt_pts                = src->pkt_pts;
481     dst->pkt_dts                = src->pkt_dts;
482     dst->pkt_pos                = src->pkt_pos;
483     dst->pkt_size               = src->pkt_size;
484     dst->pkt_duration           = src->pkt_duration;
485     dst->reordered_opaque       = src->reordered_opaque;
486     dst->quality                = src->quality;
487     dst->best_effort_timestamp  = src->best_effort_timestamp;
488     dst->coded_picture_number   = src->coded_picture_number;
489     dst->display_picture_number = src->display_picture_number;
490     dst->flags                  = src->flags;
491     dst->decode_error_flags     = src->decode_error_flags;
492     dst->color_primaries        = src->color_primaries;
493     dst->color_trc              = src->color_trc;
494     dst->colorspace             = src->colorspace;
495     dst->color_range            = src->color_range;
496     dst->chroma_location        = src->chroma_location;
497
498     av_dict_copy(&dst->metadata, src->metadata, 0);
499
500     memcpy(dst->error, src->error, sizeof(dst->error));
501
502     for (i = 0; i < src->nb_side_data; i++) {
503         const AVFrameSideData *sd_src = src->side_data[i];
504         AVFrameSideData *sd_dst;
505         if (   sd_src->type == AV_FRAME_DATA_PANSCAN
506             && (src->width != dst->width || src->height != dst->height))
507             continue;
508         sd_dst = av_frame_new_side_data(dst, sd_src->type,
509                                                          sd_src->size);
510         if (!sd_dst) {
511             wipe_side_data(dst);
512             return AVERROR(ENOMEM);
513         }
514         memcpy(sd_dst->data, sd_src->data, sd_src->size);
515         av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
516     }
517
518     dst->qscale_table = NULL;
519     dst->qstride      = 0;
520     dst->qscale_type  = 0;
521     if (src->qp_table_buf) {
522         dst->qp_table_buf = av_buffer_ref(src->qp_table_buf);
523         if (dst->qp_table_buf) {
524             dst->qscale_table = dst->qp_table_buf->data;
525             dst->qstride      = src->qstride;
526             dst->qscale_type  = src->qscale_type;
527         }
528     }
529
530     return 0;
531 }
532
533 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane)
534 {
535     uint8_t *data;
536     int planes, i;
537
538     if (frame->nb_samples) {
539         int channels = frame->channels;
540         if (!channels)
541             return NULL;
542         CHECK_CHANNELS_CONSISTENCY(frame);
543         planes = av_sample_fmt_is_planar(frame->format) ? channels : 1;
544     } else
545         planes = 4;
546
547     if (plane < 0 || plane >= planes || !frame->extended_data[plane])
548         return NULL;
549     data = frame->extended_data[plane];
550
551     for (i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) {
552         AVBufferRef *buf = frame->buf[i];
553         if (data >= buf->data && data < buf->data + buf->size)
554             return buf;
555     }
556     for (i = 0; i < frame->nb_extended_buf; i++) {
557         AVBufferRef *buf = frame->extended_buf[i];
558         if (data >= buf->data && data < buf->data + buf->size)
559             return buf;
560     }
561     return NULL;
562 }
563
564 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
565                                         enum AVFrameSideDataType type,
566                                         int size)
567 {
568     AVFrameSideData *ret, **tmp;
569
570     if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
571         return NULL;
572
573     tmp = av_realloc(frame->side_data,
574                      (frame->nb_side_data + 1) * sizeof(*frame->side_data));
575     if (!tmp)
576         return NULL;
577     frame->side_data = tmp;
578
579     ret = av_mallocz(sizeof(*ret));
580     if (!ret)
581         return NULL;
582
583     ret->data = av_malloc(size);
584     if (!ret->data) {
585         av_freep(&ret);
586         return NULL;
587     }
588
589     ret->size = size;
590     ret->type = type;
591
592     frame->side_data[frame->nb_side_data++] = ret;
593
594     return ret;
595 }
596
597 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
598                                         enum AVFrameSideDataType type)
599 {
600     int i;
601
602     for (i = 0; i < frame->nb_side_data; i++) {
603         if (frame->side_data[i]->type == type)
604             return frame->side_data[i];
605     }
606     return NULL;
607 }
608
609 static int frame_copy_video(AVFrame *dst, const AVFrame *src)
610 {
611     const uint8_t *src_data[4];
612     int i, planes;
613
614     if (dst->width  < src->width ||
615         dst->height < src->height)
616         return AVERROR(EINVAL);
617
618     planes = av_pix_fmt_count_planes(dst->format);
619     for (i = 0; i < planes; i++)
620         if (!dst->data[i] || !src->data[i])
621             return AVERROR(EINVAL);
622
623     memcpy(src_data, src->data, sizeof(src_data));
624     av_image_copy(dst->data, dst->linesize,
625                   src_data, src->linesize,
626                   dst->format, src->width, src->height);
627
628     return 0;
629 }
630
631 static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
632 {
633     int planar   = av_sample_fmt_is_planar(dst->format);
634     int channels = dst->channels;
635     int planes   = planar ? channels : 1;
636     int i;
637
638     if (dst->nb_samples     != src->nb_samples ||
639         dst->channels       != src->channels ||
640         dst->channel_layout != src->channel_layout)
641         return AVERROR(EINVAL);
642
643     CHECK_CHANNELS_CONSISTENCY(src);
644
645     for (i = 0; i < planes; i++)
646         if (!dst->extended_data[i] || !src->extended_data[i])
647             return AVERROR(EINVAL);
648
649     av_samples_copy(dst->extended_data, src->extended_data, 0, 0,
650                     dst->nb_samples, channels, dst->format);
651
652     return 0;
653 }
654
655 int av_frame_copy(AVFrame *dst, const AVFrame *src)
656 {
657     if (dst->format != src->format || dst->format < 0)
658         return AVERROR(EINVAL);
659
660     if (dst->width > 0 && dst->height > 0)
661         return frame_copy_video(dst, src);
662     else if (dst->nb_samples > 0 && dst->channel_layout)
663         return frame_copy_audio(dst, src);
664
665     return AVERROR(EINVAL);
666 }
667
668 void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
669 {
670     int i;
671
672     for (i = 0; i < frame->nb_side_data; i++) {
673         AVFrameSideData *sd = frame->side_data[i];
674         if (sd->type == type) {
675             free_side_data(&frame->side_data[i]);
676             frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
677             frame->nb_side_data--;
678         }
679     }
680 }
681
682 const char *av_frame_side_data_name(enum AVFrameSideDataType type)
683 {
684     switch(type) {
685     case AV_FRAME_DATA_PANSCAN:         return "AVPanScan";
686     case AV_FRAME_DATA_A53_CC:          return "ATSC A53 Part 4 Closed Captions";
687     case AV_FRAME_DATA_STEREO3D:        return "Stereoscopic 3d metadata";
688     case AV_FRAME_DATA_MATRIXENCODING:  return "AVMatrixEncoding";
689     case AV_FRAME_DATA_DOWNMIX_INFO:    return "Metadata relevant to a downmix procedure";
690     case AV_FRAME_DATA_REPLAYGAIN:      return "AVReplayGain";
691     case AV_FRAME_DATA_DISPLAYMATRIX:   return "3x3 displaymatrix";
692     case AV_FRAME_DATA_MOTION_VECTORS:  return "Motion vectors";
693     }
694     return NULL;
695 }