omx: Use open/close vfuncs

This commit is contained in:
Sebastian Dröge 2012-10-22 14:34:53 +02:00
parent 9d0e582484
commit bced70525a
2 changed files with 20 additions and 14 deletions

View file

@ -51,6 +51,8 @@ static GstStateChangeReturn
gst_omx_video_dec_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_omx_video_dec_open (GstVideoDecoder * decoder);
static gboolean gst_omx_video_dec_close (GstVideoDecoder * decoder);
static gboolean gst_omx_video_dec_start (GstVideoDecoder * decoder);
static gboolean gst_omx_video_dec_stop (GstVideoDecoder * decoder);
static gboolean gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
@ -93,6 +95,8 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_omx_video_dec_change_state);
video_decoder_class->open = GST_DEBUG_FUNCPTR (gst_omx_video_dec_open);
video_decoder_class->close = GST_DEBUG_FUNCPTR (gst_omx_video_dec_close);
video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_omx_video_dec_start);
video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_omx_video_dec_stop);
video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_omx_video_dec_reset);
@ -119,8 +123,9 @@ gst_omx_video_dec_init (GstOMXVideoDec * self)
}
static gboolean
gst_omx_video_dec_open (GstOMXVideoDec * self)
gst_omx_video_dec_open (GstVideoDecoder * decoder)
{
GstOMXVideoDec *self = GST_OMX_VIDEO_DEC (decoder);
GstOMXVideoDecClass *klass = GST_OMX_VIDEO_DEC_GET_CLASS (self);
GST_DEBUG_OBJECT (self, "Opening decoder");
@ -173,8 +178,10 @@ gst_omx_video_dec_shutdown (GstOMXVideoDec * self)
}
static gboolean
gst_omx_video_dec_close (GstOMXVideoDec * self)
gst_omx_video_dec_close (GstVideoDecoder * decoder)
{
GstOMXVideoDec *self = GST_OMX_VIDEO_DEC (decoder);
GST_DEBUG_OBJECT (self, "Closing decoder");
if (!gst_omx_video_dec_shutdown (self))
@ -216,8 +223,6 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_omx_video_dec_open (self))
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
if (self->in_port)
@ -266,8 +271,6 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
if (!gst_omx_video_dec_close (self))
ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;
@ -995,11 +998,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) {
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
gst_omx_video_dec_stop (GST_VIDEO_DECODER (self));
gst_omx_video_dec_close (self);
gst_omx_video_dec_close (GST_VIDEO_DECODER (self));
GST_VIDEO_DECODER_STREAM_LOCK (self);
if (!gst_omx_video_dec_open (self))
if (!gst_omx_video_dec_open (GST_VIDEO_DECODER (self)))
return FALSE;
needs_disable = FALSE;
} else {

View file

@ -79,6 +79,8 @@ static GstStateChangeReturn
gst_omx_video_enc_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_omx_video_enc_open (GstVideoEncoder * encoder);
static gboolean gst_omx_video_enc_close (GstVideoEncoder * encoder);
static gboolean gst_omx_video_enc_start (GstVideoEncoder * encoder);
static gboolean gst_omx_video_enc_stop (GstVideoEncoder * encoder);
static gboolean gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
@ -174,6 +176,8 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_omx_video_enc_change_state);
video_encoder_class->open = GST_DEBUG_FUNCPTR (gst_omx_video_enc_open);
video_encoder_class->close = GST_DEBUG_FUNCPTR (gst_omx_video_enc_close);
video_encoder_class->start = GST_DEBUG_FUNCPTR (gst_omx_video_enc_start);
video_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_omx_video_enc_stop);
video_encoder_class->reset = GST_DEBUG_FUNCPTR (gst_omx_video_enc_reset);
@ -207,8 +211,9 @@ gst_omx_video_enc_init (GstOMXVideoEnc * self)
}
static gboolean
gst_omx_video_enc_open (GstOMXVideoEnc * self)
gst_omx_video_enc_open (GstVideoEncoder * encoder)
{
GstOMXVideoEnc *self = GST_OMX_VIDEO_ENC (encoder);
GstOMXVideoEncClass *klass = GST_OMX_VIDEO_ENC_GET_CLASS (self);
self->component =
@ -343,8 +348,10 @@ gst_omx_video_enc_shutdown (GstOMXVideoEnc * self)
}
static gboolean
gst_omx_video_enc_close (GstOMXVideoEnc * self)
gst_omx_video_enc_close (GstVideoEncoder * encoder)
{
GstOMXVideoEnc *self = GST_OMX_VIDEO_ENC (encoder);
GST_DEBUG_OBJECT (self, "Closing encoder");
if (!gst_omx_video_enc_shutdown (self))
@ -453,8 +460,6 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_omx_video_enc_open (self))
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
if (self->in_port)
@ -504,8 +509,6 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
if (!gst_omx_video_enc_close (self))
ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;