decoder: maintain caps for interlaced streams.

Extend GstVaapiDecoder base object to maintain caps with "interlaced"
property.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Holger Kaelberer 2012-02-07 15:54:15 +01:00 committed by Gwenole Beauchesne
parent 8593fb619c
commit 82f11ffb30
2 changed files with 27 additions and 0 deletions

View file

@ -162,6 +162,7 @@ set_caps(GstVaapiDecoder *decoder, GstCaps *caps)
GstVaapiProfile profile;
const GValue *v_codec_data;
gint v1, v2;
gboolean b;
profile = gst_vaapi_profile_from_caps(caps);
if (!profile)
@ -188,6 +189,9 @@ set_caps(GstVaapiDecoder *decoder, GstCaps *caps)
priv->par_d = v2;
}
if (gst_structure_get_boolean(structure, "interlaced", &b))
priv->is_interlaced = b;
v_codec_data = gst_structure_get_value(structure, "codec_data");
if (v_codec_data)
set_codec_data(decoder, gst_value_get_buffer(v_codec_data));
@ -346,6 +350,7 @@ gst_vaapi_decoder_init(GstVaapiDecoder *decoder)
priv->par_d = 0;
priv->buffers = g_queue_new();
priv->surfaces = g_queue_new();
priv->is_interlaced = FALSE;
}
/**
@ -503,6 +508,23 @@ gst_vaapi_decoder_set_pixel_aspect_ratio(
}
}
void
gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced)
{
GstVaapiDecoderPrivate * const priv = decoder->priv;
if (priv->is_interlaced != interlaced) {
GST_DEBUG("interlaced changed to %s", interlaced ? "true" : "false");
priv->is_interlaced = interlaced;
gst_caps_set_simple(
priv->caps,
"interlaced", G_TYPE_BOOLEAN, interlaced,
NULL
);
g_object_notify(G_OBJECT(decoder), "caps");
}
}
gboolean
gst_vaapi_decoder_ensure_context(
GstVaapiDecoder *decoder,

View file

@ -125,6 +125,7 @@ struct _GstVaapiDecoderPrivate {
guint par_d;
GQueue *buffers;
GQueue *surfaces;
guint is_interlaced : 1;
};
void
@ -148,6 +149,10 @@ gst_vaapi_decoder_set_pixel_aspect_ratio(
guint par_d
) attribute_hidden;
void
gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced)
attribute_hidden;
gboolean
gst_vaapi_decoder_ensure_context(
GstVaapiDecoder *decoder,