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.

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