You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

690 lines
20KB

  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. #include "channel_layout.h"
  20. #include "avassert.h"
  21. #include "buffer.h"
  22. #include "common.h"
  23. #include "dict.h"
  24. #include "frame.h"
  25. #include "imgutils.h"
  26. #include "mem.h"
  27. #include "samplefmt.h"
  28. MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
  29. MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
  30. MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
  31. MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
  32. MAKE_ACCESSORS(AVFrame, frame, int, channels)
  33. MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)
  34. MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
  35. MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags)
  36. MAKE_ACCESSORS(AVFrame, frame, int, pkt_size)
  37. MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
  38. MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
  39. #define CHECK_CHANNELS_CONSISTENCY(frame) \
  40. av_assert2(!(frame)->channel_layout || \
  41. (frame)->channels == \
  42. av_get_channel_layout_nb_channels((frame)->channel_layout))
  43. AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;};
  44. int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
  45. {
  46. av_buffer_unref(&f->qp_table_buf);
  47. f->qp_table_buf = buf;
  48. f->qscale_table = buf->data;
  49. f->qstride = stride;
  50. f->qscale_type = qp_type;
  51. return 0;
  52. }
  53. int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
  54. {
  55. *stride = f->qstride;
  56. *type = f->qscale_type;
  57. if (!f->qp_table_buf)
  58. return NULL;
  59. return f->qp_table_buf->data;
  60. }
  61. const char *av_get_colorspace_name(enum AVColorSpace val)
  62. {
  63. static const char *name[] = {
  64. [AVCOL_SPC_RGB] = "GBR",
  65. [AVCOL_SPC_BT709] = "bt709",
  66. [AVCOL_SPC_FCC] = "fcc",
  67. [AVCOL_SPC_BT470BG] = "bt470bg",
  68. [AVCOL_SPC_SMPTE170M] = "smpte170m",
  69. [AVCOL_SPC_SMPTE240M] = "smpte240m",
  70. [AVCOL_SPC_YCOCG] = "YCgCo",
  71. };
  72. if ((unsigned)val >= FF_ARRAY_ELEMS(name))
  73. return NULL;
  74. return name[val];
  75. }
  76. static void get_frame_defaults(AVFrame *frame)
  77. {
  78. if (frame->extended_data != frame->data)
  79. av_freep(&frame->extended_data);
  80. memset(frame, 0, sizeof(*frame));
  81. frame->pts =
  82. frame->pkt_dts =
  83. frame->pkt_pts = AV_NOPTS_VALUE;
  84. av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
  85. av_frame_set_pkt_duration (frame, 0);
  86. av_frame_set_pkt_pos (frame, -1);
  87. av_frame_set_pkt_size (frame, -1);
  88. frame->key_frame = 1;
  89. frame->sample_aspect_ratio = (AVRational){ 0, 1 };
  90. frame->format = -1; /* unknown */
  91. frame->extended_data = frame->data;
  92. frame->color_primaries = AVCOL_PRI_UNSPECIFIED;
  93. frame->color_trc = AVCOL_TRC_UNSPECIFIED;
  94. frame->colorspace = AVCOL_SPC_UNSPECIFIED;
  95. frame->color_range = AVCOL_RANGE_UNSPECIFIED;
  96. frame->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
  97. }
  98. static void free_side_data(AVFrameSideData **ptr_sd)
  99. {
  100. AVFrameSideData *sd = *ptr_sd;
  101. av_freep(&sd->data);
  102. av_dict_free(&sd->metadata);
  103. av_freep(ptr_sd);
  104. }
  105. AVFrame *av_frame_alloc(void)
  106. {
  107. AVFrame *frame = av_mallocz(sizeof(*frame));
  108. if (!frame)
  109. return NULL;
  110. frame->extended_data = NULL;
  111. get_frame_defaults(frame);
  112. return frame;
  113. }
  114. void av_frame_free(AVFrame **frame)
  115. {
  116. if (!frame || !*frame)
  117. return;
  118. av_frame_unref(*frame);
  119. av_freep(frame);
  120. }
  121. static int get_video_buffer(AVFrame *frame, int align)
  122. {
  123. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
  124. int ret, i;
  125. if (!desc)
  126. return AVERROR(EINVAL);
  127. if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0)
  128. return ret;
  129. if (!frame->linesize[0]) {
  130. for(i=1; i<=align; i+=i) {
  131. ret = av_image_fill_linesizes(frame->linesize, frame->format,
  132. FFALIGN(frame->width, i));
  133. if (ret < 0)
  134. return ret;
  135. if (!(frame->linesize[0] & (align-1)))
  136. break;
  137. }
  138. for (i = 0; i < 4 && frame->linesize[i]; i++)
  139. frame->linesize[i] = FFALIGN(frame->linesize[i], align);
  140. }
  141. for (i = 0; i < 4 && frame->linesize[i]; i++) {
  142. int h = FFALIGN(frame->height, 32);
  143. if (i == 1 || i == 2)
  144. h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
  145. frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1);
  146. if (!frame->buf[i])
  147. goto fail;
  148. frame->data[i] = frame->buf[i]->data;
  149. }
  150. if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
  151. av_buffer_unref(&frame->buf[1]);
  152. frame->buf[1] = av_buffer_alloc(1024);
  153. if (!frame->buf[1])
  154. goto fail;
  155. frame->data[1] = frame->buf[1]->data;
  156. }
  157. frame->extended_data = frame->data;
  158. return 0;
  159. fail:
  160. av_frame_unref(frame);
  161. return AVERROR(ENOMEM);
  162. }
  163. static int get_audio_buffer(AVFrame *frame, int align)
  164. {
  165. int channels;
  166. int planar = av_sample_fmt_is_planar(frame->format);
  167. int planes;
  168. int ret, i;
  169. if (!frame->channels)
  170. frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout);
  171. channels = frame->channels;
  172. planes = planar ? channels : 1;
  173. CHECK_CHANNELS_CONSISTENCY(frame);
  174. if (!frame->linesize[0]) {
  175. ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
  176. frame->nb_samples, frame->format,
  177. align);
  178. if (ret < 0)
  179. return ret;
  180. }
  181. if (planes > AV_NUM_DATA_POINTERS) {
  182. frame->extended_data = av_mallocz_array(planes,
  183. sizeof(*frame->extended_data));
  184. frame->extended_buf = av_mallocz_array((planes - AV_NUM_DATA_POINTERS),
  185. sizeof(*frame->extended_buf));
  186. if (!frame->extended_data || !frame->extended_buf) {
  187. av_freep(&frame->extended_data);
  188. av_freep(&frame->extended_buf);
  189. return AVERROR(ENOMEM);
  190. }
  191. frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;
  192. } else
  193. frame->extended_data = frame->data;
  194. for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
  195. frame->buf[i] = av_buffer_alloc(frame->linesize[0]);
  196. if (!frame->buf[i]) {
  197. av_frame_unref(frame);
  198. return AVERROR(ENOMEM);
  199. }
  200. frame->extended_data[i] = frame->data[i] = frame->buf[i]->data;
  201. }
  202. for (i = 0; i < planes - AV_NUM_DATA_POINTERS; i++) {
  203. frame->extended_buf[i] = av_buffer_alloc(frame->linesize[0]);
  204. if (!frame->extended_buf[i]) {
  205. av_frame_unref(frame);
  206. return AVERROR(ENOMEM);
  207. }
  208. frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data;
  209. }
  210. return 0;
  211. }
  212. int av_frame_get_buffer(AVFrame *frame, int align)
  213. {
  214. if (frame->format < 0)
  215. return AVERROR(EINVAL);
  216. if (frame->width > 0 && frame->height > 0)
  217. return get_video_buffer(frame, align);
  218. else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0))
  219. return get_audio_buffer(frame, align);
  220. return AVERROR(EINVAL);
  221. }
  222. int av_frame_ref(AVFrame *dst, const AVFrame *src)
  223. {
  224. int i, ret = 0;
  225. dst->format = src->format;
  226. dst->width = src->width;
  227. dst->height = src->height;
  228. dst->channels = src->channels;
  229. dst->channel_layout = src->channel_layout;
  230. dst->nb_samples = src->nb_samples;
  231. ret = av_frame_copy_props(dst, src);
  232. if (ret < 0)
  233. return ret;
  234. /* duplicate the frame data if it's not refcounted */
  235. if (!src->buf[0]) {
  236. ret = av_frame_get_buffer(dst, 32);
  237. if (ret < 0)
  238. return ret;
  239. ret = av_frame_copy(dst, src);
  240. if (ret < 0)
  241. av_frame_unref(dst);
  242. return ret;
  243. }
  244. /* ref the buffers */
  245. for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
  246. if (!src->buf[i])
  247. continue;
  248. dst->buf[i] = av_buffer_ref(src->buf[i]);
  249. if (!dst->buf[i]) {
  250. ret = AVERROR(ENOMEM);
  251. goto fail;
  252. }
  253. }
  254. if (src->extended_buf) {
  255. dst->extended_buf = av_mallocz_array(sizeof(*dst->extended_buf),
  256. src->nb_extended_buf);
  257. if (!dst->extended_buf) {
  258. ret = AVERROR(ENOMEM);
  259. goto fail;
  260. }
  261. dst->nb_extended_buf = src->nb_extended_buf;
  262. for (i = 0; i < src->nb_extended_buf; i++) {
  263. dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);
  264. if (!dst->extended_buf[i]) {
  265. ret = AVERROR(ENOMEM);
  266. goto fail;
  267. }
  268. }
  269. }
  270. /* duplicate extended data */
  271. if (src->extended_data != src->data) {
  272. int ch = src->channels;
  273. if (!ch) {
  274. ret = AVERROR(EINVAL);
  275. goto fail;
  276. }
  277. CHECK_CHANNELS_CONSISTENCY(src);
  278. dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch);
  279. if (!dst->extended_data) {
  280. ret = AVERROR(ENOMEM);
  281. goto fail;
  282. }
  283. memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch);
  284. } else
  285. dst->extended_data = dst->data;
  286. memcpy(dst->data, src->data, sizeof(src->data));
  287. memcpy(dst->linesize, src->linesize, sizeof(src->linesize));
  288. return 0;
  289. fail:
  290. av_frame_unref(dst);
  291. return ret;
  292. }
  293. AVFrame *av_frame_clone(const AVFrame *src)
  294. {
  295. AVFrame *ret = av_frame_alloc();
  296. if (!ret)
  297. return NULL;
  298. if (av_frame_ref(ret, src) < 0)
  299. av_frame_free(&ret);
  300. return ret;
  301. }
  302. void av_frame_unref(AVFrame *frame)
  303. {
  304. int i;
  305. for (i = 0; i < frame->nb_side_data; i++) {
  306. free_side_data(&frame->side_data[i]);
  307. }
  308. av_freep(&frame->side_data);
  309. for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
  310. av_buffer_unref(&frame->buf[i]);
  311. for (i = 0; i < frame->nb_extended_buf; i++)
  312. av_buffer_unref(&frame->extended_buf[i]);
  313. av_freep(&frame->extended_buf);
  314. av_dict_free(&frame->metadata);
  315. av_buffer_unref(&frame->qp_table_buf);
  316. get_frame_defaults(frame);
  317. }
  318. void av_frame_move_ref(AVFrame *dst, AVFrame *src)
  319. {
  320. *dst = *src;
  321. if (src->extended_data == src->data)
  322. dst->extended_data = dst->data;
  323. memset(src, 0, sizeof(*src));
  324. get_frame_defaults(src);
  325. }
  326. int av_frame_is_writable(AVFrame *frame)
  327. {
  328. int i, ret = 1;
  329. /* assume non-refcounted frames are not writable */
  330. if (!frame->buf[0])
  331. return 0;
  332. for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
  333. if (frame->buf[i])
  334. ret &= !!av_buffer_is_writable(frame->buf[i]);
  335. for (i = 0; i < frame->nb_extended_buf; i++)
  336. ret &= !!av_buffer_is_writable(frame->extended_buf[i]);
  337. return ret;
  338. }
  339. int av_frame_make_writable(AVFrame *frame)
  340. {
  341. AVFrame tmp;
  342. int ret;
  343. if (!frame->buf[0])
  344. return AVERROR(EINVAL);
  345. if (av_frame_is_writable(frame))
  346. return 0;
  347. memset(&tmp, 0, sizeof(tmp));
  348. tmp.format = frame->format;
  349. tmp.width = frame->width;
  350. tmp.height = frame->height;
  351. tmp.channels = frame->channels;
  352. tmp.channel_layout = frame->channel_layout;
  353. tmp.nb_samples = frame->nb_samples;
  354. ret = av_frame_get_buffer(&tmp, 32);
  355. if (ret < 0)
  356. return ret;
  357. ret = av_frame_copy(&tmp, frame);
  358. if (ret < 0) {
  359. av_frame_unref(&tmp);
  360. return ret;
  361. }
  362. ret = av_frame_copy_props(&tmp, frame);
  363. if (ret < 0) {
  364. av_frame_unref(&tmp);
  365. return ret;
  366. }
  367. av_frame_unref(frame);
  368. *frame = tmp;
  369. if (tmp.data == tmp.extended_data)
  370. frame->extended_data = frame->data;
  371. return 0;
  372. }
  373. int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
  374. {
  375. int i;
  376. dst->key_frame = src->key_frame;
  377. dst->pict_type = src->pict_type;
  378. dst->sample_aspect_ratio = src->sample_aspect_ratio;
  379. dst->pts = src->pts;
  380. dst->repeat_pict = src->repeat_pict;
  381. dst->interlaced_frame = src->interlaced_frame;
  382. dst->top_field_first = src->top_field_first;
  383. dst->palette_has_changed = src->palette_has_changed;
  384. dst->sample_rate = src->sample_rate;
  385. dst->opaque = src->opaque;
  386. #if FF_API_AVFRAME_LAVC
  387. dst->type = src->type;
  388. #endif
  389. dst->pkt_pts = src->pkt_pts;
  390. dst->pkt_dts = src->pkt_dts;
  391. dst->pkt_pos = src->pkt_pos;
  392. dst->pkt_size = src->pkt_size;
  393. dst->pkt_duration = src->pkt_duration;
  394. dst->reordered_opaque = src->reordered_opaque;
  395. dst->quality = src->quality;
  396. dst->best_effort_timestamp = src->best_effort_timestamp;
  397. dst->coded_picture_number = src->coded_picture_number;
  398. dst->display_picture_number = src->display_picture_number;
  399. dst->flags = src->flags;
  400. dst->decode_error_flags = src->decode_error_flags;
  401. dst->color_primaries = src->color_primaries;
  402. dst->color_trc = src->color_trc;
  403. dst->colorspace = src->colorspace;
  404. dst->color_range = src->color_range;
  405. dst->chroma_location = src->chroma_location;
  406. av_dict_copy(&dst->metadata, src->metadata, 0);
  407. memcpy(dst->error, src->error, sizeof(dst->error));
  408. for (i = 0; i < src->nb_side_data; i++) {
  409. const AVFrameSideData *sd_src = src->side_data[i];
  410. AVFrameSideData *sd_dst;
  411. if ( sd_src->type == AV_FRAME_DATA_PANSCAN
  412. && (src->width != dst->width || src->height != dst->height))
  413. continue;
  414. sd_dst = av_frame_new_side_data(dst, sd_src->type,
  415. sd_src->size);
  416. if (!sd_dst) {
  417. for (i = 0; i < dst->nb_side_data; i++) {
  418. free_side_data(&dst->side_data[i]);
  419. }
  420. av_freep(&dst->side_data);
  421. return AVERROR(ENOMEM);
  422. }
  423. memcpy(sd_dst->data, sd_src->data, sd_src->size);
  424. av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
  425. }
  426. dst->qscale_table = NULL;
  427. dst->qstride = 0;
  428. dst->qscale_type = 0;
  429. if (src->qp_table_buf) {
  430. dst->qp_table_buf = av_buffer_ref(src->qp_table_buf);
  431. if (dst->qp_table_buf) {
  432. dst->qscale_table = dst->qp_table_buf->data;
  433. dst->qstride = src->qstride;
  434. dst->qscale_type = src->qscale_type;
  435. }
  436. }
  437. return 0;
  438. }
  439. AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane)
  440. {
  441. uint8_t *data;
  442. int planes, i;
  443. if (frame->nb_samples) {
  444. int channels = frame->channels;
  445. if (!channels)
  446. return NULL;
  447. CHECK_CHANNELS_CONSISTENCY(frame);
  448. planes = av_sample_fmt_is_planar(frame->format) ? channels : 1;
  449. } else
  450. planes = 4;
  451. if (plane < 0 || plane >= planes || !frame->extended_data[plane])
  452. return NULL;
  453. data = frame->extended_data[plane];
  454. for (i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) {
  455. AVBufferRef *buf = frame->buf[i];
  456. if (data >= buf->data && data < buf->data + buf->size)
  457. return buf;
  458. }
  459. for (i = 0; i < frame->nb_extended_buf; i++) {
  460. AVBufferRef *buf = frame->extended_buf[i];
  461. if (data >= buf->data && data < buf->data + buf->size)
  462. return buf;
  463. }
  464. return NULL;
  465. }
  466. AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
  467. enum AVFrameSideDataType type,
  468. int size)
  469. {
  470. AVFrameSideData *ret, **tmp;
  471. if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
  472. return NULL;
  473. tmp = av_realloc(frame->side_data,
  474. (frame->nb_side_data + 1) * sizeof(*frame->side_data));
  475. if (!tmp)
  476. return NULL;
  477. frame->side_data = tmp;
  478. ret = av_mallocz(sizeof(*ret));
  479. if (!ret)
  480. return NULL;
  481. ret->data = av_malloc(size);
  482. if (!ret->data) {
  483. av_freep(&ret);
  484. return NULL;
  485. }
  486. ret->size = size;
  487. ret->type = type;
  488. frame->side_data[frame->nb_side_data++] = ret;
  489. return ret;
  490. }
  491. AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
  492. enum AVFrameSideDataType type)
  493. {
  494. int i;
  495. for (i = 0; i < frame->nb_side_data; i++) {
  496. if (frame->side_data[i]->type == type)
  497. return frame->side_data[i];
  498. }
  499. return NULL;
  500. }
  501. static int frame_copy_video(AVFrame *dst, const AVFrame *src)
  502. {
  503. const uint8_t *src_data[4];
  504. int i, planes;
  505. if (dst->width < src->width ||
  506. dst->height < src->height)
  507. return AVERROR(EINVAL);
  508. planes = av_pix_fmt_count_planes(dst->format);
  509. for (i = 0; i < planes; i++)
  510. if (!dst->data[i] || !src->data[i])
  511. return AVERROR(EINVAL);
  512. memcpy(src_data, src->data, sizeof(src_data));
  513. av_image_copy(dst->data, dst->linesize,
  514. src_data, src->linesize,
  515. dst->format, src->width, src->height);
  516. return 0;
  517. }
  518. static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
  519. {
  520. int planar = av_sample_fmt_is_planar(dst->format);
  521. int channels = dst->channels;
  522. int planes = planar ? channels : 1;
  523. int i;
  524. if (dst->nb_samples != src->nb_samples ||
  525. dst->channels != src->channels ||
  526. dst->channel_layout != src->channel_layout)
  527. return AVERROR(EINVAL);
  528. CHECK_CHANNELS_CONSISTENCY(src);
  529. for (i = 0; i < planes; i++)
  530. if (!dst->extended_data[i] || !src->extended_data[i])
  531. return AVERROR(EINVAL);
  532. av_samples_copy(dst->extended_data, src->extended_data, 0, 0,
  533. dst->nb_samples, channels, dst->format);
  534. return 0;
  535. }
  536. int av_frame_copy(AVFrame *dst, const AVFrame *src)
  537. {
  538. if (dst->format != src->format || dst->format < 0)
  539. return AVERROR(EINVAL);
  540. if (dst->width > 0 && dst->height > 0)
  541. return frame_copy_video(dst, src);
  542. else if (dst->nb_samples > 0 && dst->channel_layout)
  543. return frame_copy_audio(dst, src);
  544. return AVERROR(EINVAL);
  545. }
  546. void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
  547. {
  548. int i;
  549. for (i = 0; i < frame->nb_side_data; i++) {
  550. AVFrameSideData *sd = frame->side_data[i];
  551. if (sd->type == type) {
  552. free_side_data(&frame->side_data[i]);
  553. frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
  554. frame->nb_side_data--;
  555. }
  556. }
  557. }
  558. const char *av_frame_side_data_name(enum AVFrameSideDataType type)
  559. {
  560. switch(type) {
  561. case AV_FRAME_DATA_PANSCAN: return "AVPanScan";
  562. case AV_FRAME_DATA_A53_CC: return "ATSC A53 Part 4 Closed Captions";
  563. case AV_FRAME_DATA_STEREO3D: return "Stereoscopic 3d metadata";
  564. case AV_FRAME_DATA_MATRIXENCODING: return "AVMatrixEncoding";
  565. case AV_FRAME_DATA_DOWNMIX_INFO: return "Metadata relevant to a downmix procedure";
  566. case AV_FRAME_DATA_REPLAYGAIN: return "AVReplayGain";
  567. case AV_FRAME_DATA_DISPLAYMATRIX: return "3x3 displaymatrix";
  568. case AV_FRAME_DATA_MOTION_VECTORS: return "Motion vectors";
  569. }
  570. return NULL;
  571. }