Use the 3D Reference Displays Info SEI message to link a view_id with an eye.
Unified · Split
| @@ -3970,6 +3970,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, · 3969 unmodified lines | |||
| 3970 | s->sei.common.mastering_display = s0->sei.common.mastering_display; | 3970 | s->sei.common.mastering_display = s0->sei.common.mastering_display; |
| 3971 | s->sei.common.content_light = s0->sei.common.content_light; | 3971 | s->sei.common.content_light = s0->sei.common.content_light; |
| 3972 | s->sei.common.aom_film_grain = s0->sei.common.aom_film_grain; | 3972 | s->sei.common.aom_film_grain = s0->sei.common.aom_film_grain; |
| 3973 | s->sei.tdrdi = s0->sei.tdrdi; | ||
| 3973 | 3974 | ||
| 3974 | return 0; | 3975 | return 0; |
| 3975 | } | 3976 | } |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include "libavutil/mem.h" | 24 | #include "libavutil/mem.h" |
| 25 | #include "libavutil/stereo3d.h" | ||
| 25 | 26 | ||
| 26 | #include "container_fifo.h" | 27 | #include "container_fifo.h" |
| 27 | #include "decode.h" | 28 | #include "decode.h" |
| @@ -103,6 +104,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) · 75 unmodified lines | |||
| 103 | 104 | ||
| 104 | // add view ID side data if it's nontrivial | 105 | // add view ID side data if it's nontrivial |
| 105 | if (vps->nb_layers > 1 || view_id) { | 106 | if (vps->nb_layers > 1 || view_id) { |
| 107 | HEVCSEITDRDI *tdrdi = &s->sei.tdrdi; | ||
| 106 | AVFrameSideData *sd = av_frame_side_data_new(&frame->f->side_data, | 108 | AVFrameSideData *sd = av_frame_side_data_new(&frame->f->side_data, |
| 107 | &frame->f->nb_side_data, | 109 | &frame->f->nb_side_data, |
| 108 | AV_FRAME_DATA_VIEW_ID, | 110 | AV_FRAME_DATA_VIEW_ID, |
| @@ -110,6 +112,22 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) · 1 unmodified line | |||
| 110 | if (!sd) | 112 | if (!sd) |
| 111 | goto fail; | 113 | goto fail; |
| 112 | *(int*)sd->data = view_id; | 114 | *(int*)sd->data = view_id; |
| 115 | |||
| 116 | if (tdrdi->num_ref_displays) { | ||
| 117 | AVStereo3D *stereo_3d; | ||
| 118 | |||
| 119 | stereo_3d = av_stereo3d_create_side_data(frame->f); | ||
| 120 | if (!stereo_3d) | ||
| 121 | goto fail; | ||
| 122 | |||
| 123 | stereo_3d->type = AV_STEREO3D_FRAMESEQUENCE; | ||
| 124 | if (tdrdi->left_view_id[0] == view_id) | ||
| 125 | stereo_3d->view = AV_STEREO3D_VIEW_LEFT; | ||
| 126 | else if (tdrdi->right_view_id[0] == view_id) | ||
| 127 | stereo_3d->view = AV_STEREO3D_VIEW_RIGHT; | ||
| 128 | else | ||
| 129 | stereo_3d->view = AV_STEREO3D_VIEW_UNSPEC; | ||
| 130 | } | ||
| 113 | } | 131 | } |
| 114 | 132 | ||
| 115 | ret = ff_progress_frame_get_buffer(s->avctx, &frame->tf, | 133 | ret = ff_progress_frame_get_buffer(s->avctx, &frame->tf, |