static gboolean gst_vtenc_sink_setcaps (GstPad * pad, GstCaps * caps) { GstVTEnc *self = GST_VTENC_CAST (GST_PAD_PARENT (pad)); GstStructure *structure; VTCompressionSessionRef session; GST_OBJECT_LOCK (self); structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "width", &self->negotiated_width); gst_structure_get_int (structure, "height", &self->negotiated_height); gst_structure_get_fraction (structure, "framerate", &self->negotiated_fps_n, &self->negotiated_fps_d); gst_vtenc_destroy_session (self, &self->session); GST_OBJECT_UNLOCK (self); session = gst_vtenc_create_session (self); GST_OBJECT_LOCK (self); self->session = session; if (self->options != NULL) CFRelease (self->options); self->options = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); GST_OBJECT_UNLOCK (self); return TRUE; }
static gboolean gst_vtenc_sink_setcaps (GstVTEnc * self, GstCaps * caps) { GstStructure *structure; VTCompressionSessionRef session; GST_OBJECT_LOCK (self); structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "width", &self->negotiated_width); gst_structure_get_int (structure, "height", &self->negotiated_height); gst_structure_get_fraction (structure, "framerate", &self->negotiated_fps_n, &self->negotiated_fps_d); if (!gst_video_info_from_caps (&self->video_info, caps)) return FALSE; gst_vtenc_destroy_session (self, &self->session); GST_OBJECT_UNLOCK (self); session = gst_vtenc_create_session (self); GST_OBJECT_LOCK (self); self->session = session; if (self->options != NULL) CFRelease (self->options); self->options = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); /* renegotiate when upstream caps change */ gst_pad_mark_reconfigure (self->srcpad); GST_OBJECT_UNLOCK (self); return TRUE; }