From 29f1784dd705f6ea007eb4fc77584b5a0132e311 Mon Sep 17 00:00:00 2001 From: gb Date: Tue, 27 Apr 2010 11:59:23 +0000 Subject: [PATCH] Add more error codes. Fix documentation. --- gst-libs/gst/vaapi/gstvaapidecoder.c | 10 +++++++--- gst-libs/gst/vaapi/gstvaapidecoder.h | 10 ++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index dabb8aa..2c07c57 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -73,7 +73,10 @@ decoder_thread_cb(gpointer data) g_mutex_unlock(priv->adapter_mutex); if (!priv->decoder_thread_cancel) { - if (status == GST_VAAPI_DECODER_STATUS_SUCCESS) { + switch (status) { + case GST_VAAPI_DECODER_STATUS_SUCCESS: + case GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA: + GST_DEBUG("decode"); g_object_ref(decoder); status = klass->decode(decoder); g_object_unref(decoder); @@ -85,8 +88,8 @@ decoder_thread_cb(gpointer data) status = GST_VAAPI_DECODER_STATUS_END_OF_STREAM; GST_DEBUG("decode frame (status = %d)", status); - } - else { + break; + default: /* XXX: something went wrong, simply destroy any buffer until this decoder is destroyed */ g_mutex_lock(priv->adapter_mutex); @@ -96,6 +99,7 @@ decoder_thread_cb(gpointer data) /* Signal the main thread we got an error */ if (status != GST_VAAPI_DECODER_STATUS_END_OF_STREAM) gst_vaapi_decoder_push_surface(decoder, NULL); + break; } } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.h b/gst-libs/gst/vaapi/gstvaapidecoder.h index 4c2d4c0..3a33db0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder.h @@ -60,8 +60,12 @@ typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass; * GstVaapiDecoderStatus: * @GST_VAAPI_DECODER_STATUS_SUCCESS: Success. * @GST_VAAPI_DECODER_STATUS_TIMEOUT: Timeout. Try again later. - * @GST_VAAPI_DECODER_STATUS_EOS: End-Of-Stream. - * @GST_VAAPI_DECODER_STATUS_ERROR: Unknown error. + * @GST_VAAPI_DECODER_STATUS_END_OF_STREAM: End-Of-Stream. + * @GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED: No memory left. + * @GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED: Decoder initialization failure. + * @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA: Not enough input data to decode. + * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE: Invalid surface. + * @GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN: Unknown error. * * Decoder status for gst_vaapi_decoder_get_surface(). */ @@ -71,6 +75,8 @@ enum _GstVaapiDecoderStatus { GST_VAAPI_DECODER_STATUS_END_OF_STREAM, GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED, GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED, + GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA, + GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE, GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN }; -- 2.7.4