diff options
author | Jan Schmidt <jan@centricular.com> | 2015-06-15 16:10:37 +1000 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2015-06-23 11:58:41 +1000 |
commit | b7cbfe1fa10963fce2bd2e3a50cbe0cf77bda627 (patch) | |
tree | 1ee9220a642935e41b4fba2198feab2f8fa5a3c8 /gst/isomp4/qtdemux.c | |
parent | dd72267a8da0d2884ff9ecff6731ab753562258d (diff) | |
download | gstreamer-plugins-good-b7cbfe1fa10963fce2bd2e3a50cbe0cf77bda627.tar.gz |
qtdemux: Move multiview caps calculations, add half-aspect heuristics
Move the multiview caps calculations to the configure_stream()
function, so the rest of the video info is available, and
use the gst_video_multiview_guess_half_aspect() function to
determine if the half-aspect flag should be set on frame-packed
video.
Diffstat (limited to 'gst/isomp4/qtdemux.c')
-rw-r--r-- | gst/isomp4/qtdemux.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 01c163284..1958781f7 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -6285,8 +6285,12 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream) GST_DEBUG_OBJECT (qtdemux, "video size %dx%d, target display size %dx%d", stream->width, stream->height, stream->display_width, stream->display_height); - - if (stream->display_width > 0 && stream->display_height > 0 && + /* qt file might have pasp atom */ + if (stream->par_w > 0 && stream->par_h > 0) { + GST_DEBUG_OBJECT (qtdemux, "par %d:%d", stream->par_w, stream->par_h); + gst_caps_set_simple (stream->caps, "pixel-aspect-ratio", + GST_TYPE_FRACTION, stream->par_w, stream->par_h, NULL); + } else if (stream->display_width > 0 && stream->display_height > 0 && stream->width > 0 && stream->height > 0) { gint n, d; @@ -6296,18 +6300,35 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream) if (n == d) n = d = 1; GST_DEBUG_OBJECT (qtdemux, "setting PAR to %d/%d", n, d); + stream->par_w = n; + stream->par_h = d; gst_caps_set_simple (stream->caps, "pixel-aspect-ratio", - GST_TYPE_FRACTION, n, d, NULL); + GST_TYPE_FRACTION, stream->par_w, stream->par_h, NULL); } - /* qt file might have pasp atom */ - if (stream->par_w > 0 && stream->par_h > 0) { - GST_DEBUG_OBJECT (qtdemux, "par %d:%d", stream->par_w, stream->par_h); - gst_caps_set_simple (stream->caps, "pixel-aspect-ratio", - GST_TYPE_FRACTION, stream->par_w, stream->par_h, NULL); + if (stream->multiview_mode != GST_VIDEO_MULTIVIEW_MODE_NONE) { + guint par_w = 1, par_h = 1; + + if (stream->par_w > 0 && stream->par_h > 0) { + par_w = stream->par_w; + par_h = stream->par_h; + } + + if (gst_video_multiview_guess_half_aspect (stream->multiview_mode, + stream->width, stream->height, par_w, par_h)) { + stream->multiview_flags |= GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT; + } + + gst_caps_set_simple (stream->caps, + "multiview-mode", G_TYPE_STRING, + gst_video_multiview_mode_to_caps_string (stream->multiview_mode), + "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, + stream->multiview_flags, GST_FLAG_SET_MASK_EXACT, NULL); } } - } else if (stream->subtype == FOURCC_soun) { + } + + else if (stream->subtype == FOURCC_soun) { if (stream->caps) { stream->caps = gst_caps_make_writable (stream->caps); if (stream->rate > 0) @@ -11664,20 +11685,12 @@ qtdemux_video_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, gst_video_info_init (&info); gst_video_info_set_format (&info, format, stream->width, stream->height); - GST_VIDEO_INFO_MULTIVIEW_MODE (&info) = stream->multiview_mode; - GST_VIDEO_INFO_MULTIVIEW_FLAGS (&info) = stream->multiview_flags; caps = gst_video_info_to_caps (&info); *codec_name = gst_pb_utils_get_codec_description (caps); /* enable clipping for raw video streams */ stream->need_clip = TRUE; - } else if (stream->multiview_mode != GST_VIDEO_MULTIVIEW_MODE_NONE) { - gst_caps_set_simple (caps, - "multiview-mode", G_TYPE_STRING, - gst_video_multiview_mode_to_caps_string (stream->multiview_mode), - "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, - stream->multiview_flags, GST_FLAG_SET_MASK_EXACT, NULL); } return caps; |