video: Some porting bugfixes

This commit is contained in:
Sebastian Dröge 2012-04-24 21:32:08 +02:00
parent b945c01549
commit a8c40a658c
3 changed files with 16 additions and 12 deletions

View file

@ -841,6 +841,7 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
decoder->priv->current_frame_events = decoder->priv->current_frame_events =
g_list_prepend (decoder->priv->current_frame_events, event); g_list_prepend (decoder->priv->current_frame_events, event);
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
ret = TRUE;
} }
} }
@ -851,7 +852,7 @@ newseg_wrong_format:
GST_DEBUG_OBJECT (decoder, "received non TIME newsegment"); GST_DEBUG_OBJECT (decoder, "received non TIME newsegment");
gst_event_unref (event); gst_event_unref (event);
/* SWALLOW EVENT */ /* SWALLOW EVENT */
return FALSE; return TRUE;
} }
} }

View file

@ -593,14 +593,11 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
if (!ret) if (!ret)
GST_WARNING_OBJECT (encoder, "rejected caps %" GST_PTR_FORMAT, caps); GST_WARNING_OBJECT (encoder, "rejected caps %" GST_PTR_FORMAT, caps);
gst_object_unref (encoder);
return ret; return ret;
parse_fail: parse_fail:
{ {
GST_WARNING_OBJECT (encoder, "Failed to parse caps"); GST_WARNING_OBJECT (encoder, "Failed to parse caps");
gst_object_unref (encoder);
return FALSE; return FALSE;
} }
} }
@ -630,7 +627,9 @@ gst_video_encoder_proxy_getcaps (GstVideoEncoder * encoder, GstCaps * caps,
/* Allow downstream to specify width/height/framerate/PAR constraints /* Allow downstream to specify width/height/framerate/PAR constraints
* and forward them upstream for video converters to handle * and forward them upstream for video converters to handle
*/ */
templ_caps = caps ? caps : gst_pad_get_pad_template_caps (encoder->sinkpad); templ_caps =
caps ? gst_caps_ref (caps) :
gst_pad_get_pad_template_caps (encoder->sinkpad);
allowed = gst_pad_get_allowed_caps (encoder->srcpad); allowed = gst_pad_get_allowed_caps (encoder->srcpad);
if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) { if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) {
@ -836,6 +835,7 @@ gst_video_encoder_sink_event_default (GstVideoEncoder * encoder,
encoder->priv->at_eos = FALSE; encoder->priv->at_eos = FALSE;
encoder->input_segment = segment; encoder->input_segment = segment;
ret = TRUE;
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
break; break;
} }
@ -891,6 +891,7 @@ gst_video_encoder_sink_event_default (GstVideoEncoder * encoder,
encoder->priv->current_frame_events = encoder->priv->current_frame_events =
g_list_prepend (encoder->priv->current_frame_events, event); g_list_prepend (encoder->priv->current_frame_events, event);
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
ret = TRUE;
} }
} }

View file

@ -853,9 +853,14 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
if (gst_structure_has_name (structure, "video/x-raw") && if (gst_structure_has_name (structure, "video/x-raw")) {
!(s = gst_structure_get_string (structure, "format"))) { if (!(s = gst_structure_get_string (structure, "format")))
goto no_format; goto no_format;
format = gst_video_format_from_string (s);
if (format == GST_VIDEO_FORMAT_UNKNOWN)
goto unknown_format;
} else if (g_str_has_prefix (gst_structure_get_name (structure), "video/") || } else if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
g_str_has_prefix (gst_structure_get_name (structure), "image/")) { g_str_has_prefix (gst_structure_get_name (structure), "image/")) {
format = GST_VIDEO_FORMAT_ENCODED; format = GST_VIDEO_FORMAT_ENCODED;
@ -863,10 +868,6 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
goto wrong_name; goto wrong_name;
} }
format = gst_video_format_from_string (s);
if (format == GST_VIDEO_FORMAT_UNKNOWN)
goto unknown_format;
/* width and height are mandatory, except for non-raw-formats */ /* width and height are mandatory, except for non-raw-formats */
if (!gst_structure_get_int (structure, "width", &width) && if (!gst_structure_get_int (structure, "width", &width) &&
format != GST_VIDEO_FORMAT_ENCODED) format != GST_VIDEO_FORMAT_ENCODED)
@ -1432,6 +1433,7 @@ fill_planes (GstVideoInfo * info)
info->stride[2] * (GST_ROUND_UP_4 (height) / 4); info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
break; break;
case GST_VIDEO_FORMAT_ENCODED: case GST_VIDEO_FORMAT_ENCODED:
break;
case GST_VIDEO_FORMAT_UNKNOWN: case GST_VIDEO_FORMAT_UNKNOWN:
GST_ERROR ("invalid format"); GST_ERROR ("invalid format");
g_warning ("invalid format"); g_warning ("invalid format");