[Merge] lp:~alfonsosanchezbeato/media-hub/get-dim-from-caps into lp:media-hub
Jim Hodapp
jim.hodapp at canonical.com
Mon Feb 27 15:49:19 UTC 2017
Review: Needs Fixing code
Were you able to test this on the phone as well?
Some changes needed inline below.
Diff comments:
> === modified file 'src/core/media/gstreamer/playbin.cpp'
> --- src/core/media/gstreamer/playbin.cpp 2017-02-16 10:16:46 +0000
> +++ src/core/media/gstreamer/playbin.cpp 2017-02-27 15:31:59 +0000
> @@ -702,9 +702,27 @@
> };
>
> // Initialize to default value prior to querying actual values from the sink.
> - uint32_t video_width = 0, video_height = 0;
> - g_object_get (video_sink, "height", &video_height, nullptr);
> - g_object_get (video_sink, "width", &video_width, nullptr);
> + int video_width = 0, video_height = 0;
> +
> + // There should be only one pad actually
> + GstIterator *iter = gst_element_iterate_pads(video_sink);
> + for (GValue item{};
> + gst_iterator_next(iter, &item) == GST_ITERATOR_OK;
> + g_value_unset(&item))
> + {
> + GstPad *pad = GST_PAD(g_value_get_object(&item));
const
> + GstCaps *caps = gst_pad_get_current_caps(pad);
const
> +
> + if (caps) {
> + GstStructure *s = gst_caps_get_structure(caps, 0);
const
> + gst_structure_get_int(s, "width", &video_width);
> + gst_structure_get_int(s, "height", &video_height);
> + MH_DEBUG("Video dimensions are %d x %d", video_width, video_height);
> +
> + gst_caps_unref(caps);
> + }
> + }
> + gst_iterator_free(iter);
>
> // TODO(tvoss): We should probably check here if width and height are valid.
> return core::ubuntu::media::video::Dimensions
--
https://code.launchpad.net/~alfonsosanchezbeato/media-hub/get-dim-from-caps/+merge/318373
Your team Ubuntu Phablet Team is subscribed to branch lp:media-hub.
More information about the Ubuntu-reviews
mailing list