Add more error codes. Fix documentation.

This commit is contained in:
gb 2010-04-27 11:59:23 +00:00 committed by Gwenole Beauchesne
parent eddf6b0d6c
commit 29f1784dd7
2 changed files with 15 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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
};