mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
amc: crop values are not mandatory in format
Android documentation has example code how to compute width and height when crop values are present. https://developer.android.com/reference/android/media/MediaCodec#accessing-raw-video-bytebuffers-on-older-devices
This commit is contained in:
parent
a604796c41
commit
06fc7880bb
1 changed files with 8 additions and 17 deletions
|
@ -766,13 +766,14 @@ gst_amc_video_dec_set_src_caps (GstAmcVideoDec * self, GstAmcFormat * format)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_amc_format_get_int (format, "crop-left", &crop_left, &err) ||
|
||||
!gst_amc_format_get_int (format, "crop-right", &crop_right, &err) ||
|
||||
!gst_amc_format_get_int (format, "crop-top", &crop_top, &err) ||
|
||||
!gst_amc_format_get_int (format, "crop-bottom", &crop_bottom, &err)) {
|
||||
GST_ERROR_OBJECT (self, "Failed to get crop rectangle: %s", err->message);
|
||||
g_clear_error (&err);
|
||||
return FALSE;
|
||||
if (gst_amc_format_get_int (format, "crop-left", &crop_left, NULL) &&
|
||||
gst_amc_format_get_int (format, "crop-right", &crop_right, NULL)) {
|
||||
width = crop_right + 1 - crop_left;
|
||||
}
|
||||
|
||||
if (gst_amc_format_get_int (format, "crop-top", &crop_top, NULL) &&
|
||||
gst_amc_format_get_int (format, "crop-bottom", &crop_bottom, NULL)) {
|
||||
height = crop_bottom + 1 - crop_top;
|
||||
}
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
|
@ -780,16 +781,6 @@ gst_amc_video_dec_set_src_caps (GstAmcVideoDec * self, GstAmcFormat * format)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (crop_bottom)
|
||||
height = height - (height - crop_bottom - 1);
|
||||
if (crop_top)
|
||||
height = height - crop_top;
|
||||
|
||||
if (crop_right)
|
||||
width = width - (width - crop_right - 1);
|
||||
if (crop_left)
|
||||
width = width - crop_left;
|
||||
|
||||
mime = caps_to_mime (self->input_state->caps);
|
||||
if (!mime) {
|
||||
GST_ERROR_OBJECT (self, "Failed to convert caps to mime");
|
||||
|
|
Loading…
Reference in a new issue