Add more error codes. Fix documentation.
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Tue, 27 Apr 2010 11:59:23 +0000 (11:59 +0000)
committerGwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Mon, 20 Sep 2010 10:55:32 +0000 (12:55 +0200)
gst-libs/gst/vaapi/gstvaapidecoder.c
gst-libs/gst/vaapi/gstvaapidecoder.h

index dabb8aa..2c07c57 100644 (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;
             }
         }
 
index 4c2d4c0..3a33db0 100644 (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
 };