Commit 9b773b56 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

vtenc: Signal ignored alpha component with ProRes

When the image is opaque but the output ProRes format has an alpha
component (4 component, 32 bits per pixel), Apple requires that we
signal that it should be ignored by setting the depth to 24 bits per
pixel. Not doing so causes the encoded files to fail validation.

So we set that in the caps and qtmux sets the depth value in the
container, which will be read by demuxers so that decoders can skip
those bytes entirely. qtdemux does this, but vtdec does not use this
information at present.

The sister change was made in qtmux and qtdemux in:
gstreamer/gst-plugins-good!1061

Part-of: <gstreamer/gstreamer!1489>
parent 6603f8a7
Pipeline #477182 waiting for manual action with stages
in 1 minute and 38 seconds
...@@ -820,6 +820,28 @@ gst_vtenc_is_negotiated (GstVTEnc * self) ...@@ -820,6 +820,28 @@ gst_vtenc_is_negotiated (GstVTEnc * self)
return self->negotiated_width != 0; return self->negotiated_width != 0;
} }
/*
* When the image is opaque but the output ProRes format has an alpha
* component (4 component, 32 bits per pixel), Apple requires that we signal
* that it should be ignored by setting the depth to 24 bits per pixel. Not
* doing so causes the encoded files to fail validation.
*
* So we set that in the caps and qtmux sets the depth value in the container,
* which will be read by demuxers so that decoders can skip those bytes
* entirely. qtdemux does this, but vtdec does not use this information at
* present.
*/
static gboolean
gst_vtenc_signal_ignored_alpha_component (GstVTEnc * self)
{
if (self->preserve_alpha)
return FALSE;
if (self->specific_format_id == kCMVideoCodecType_AppleProRes4444XQ ||
self->specific_format_id == kCMVideoCodecType_AppleProRes4444)
return TRUE;
return FALSE;
}
static gboolean static gboolean
gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf) gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf)
{ {
...@@ -883,6 +905,8 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf) ...@@ -883,6 +905,8 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf)
gst_structure_set (s, "variant", G_TYPE_STRING, gst_structure_set (s, "variant", G_TYPE_STRING,
gst_vtutil_codec_type_to_prores_variant (self->specific_format_id), gst_vtutil_codec_type_to_prores_variant (self->specific_format_id),
NULL); NULL);
if (gst_vtenc_signal_ignored_alpha_component (self))
gst_structure_set (s, "depth", G_TYPE_INT, 24, NULL);
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment