From: David Schleef Date: Tue, 12 Feb 2013 01:39:24 +0000 (-0800) Subject: mfc: quiet debugging when mfc device doesn't exist X-Git-Tag: 1.1.1~654 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20627cc5d5d5da9cab63a884333a94f3ff170ef1;p=platform%2Fupstream%2Fgst-plugins-bad.git mfc: quiet debugging when mfc device doesn't exist Avoid registering the element if the mfc device doesn't work, but allow plugin loading to succeed. --- diff --git a/sys/mfc/gstmfc.c b/sys/mfc/gstmfc.c index 79c4de2..7fb22ce 100644 --- a/sys/mfc/gstmfc.c +++ b/sys/mfc/gstmfc.c @@ -39,7 +39,7 @@ plugin_init (GstPlugin * plugin) if (!context) { GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "Failed to initialize MFC decoder context"); - return FALSE; + return TRUE; } mfc_dec_destroy (context); diff --git a/sys/mfc/mfc_decoder/mfc_decoder.c b/sys/mfc/mfc_decoder/mfc_decoder.c index 31b82f9..b050ded 100644 --- a/sys/mfc/mfc_decoder/mfc_decoder.c +++ b/sys/mfc/mfc_decoder/mfc_decoder.c @@ -51,6 +51,7 @@ #include #include #include +#include #include /* For logging */ @@ -279,6 +280,7 @@ struct mfc_dec_context* mfc_dec_create(unsigned int codec) { struct mfc_dec_context *ctx; struct v4l2_capability caps; + struct stat sb; pthread_mutex_lock(&mutex); if (mfc_in_use) { @@ -295,10 +297,17 @@ struct mfc_dec_context* mfc_dec_create(unsigned int codec) GST_ERROR ("Unable to allocate memory for context"); return NULL; } + + if (stat (MFC_PATH, &sb) < 0) { + GST_INFO ("MFC device node doesn't exist, failing quietly"); + free(ctx); + return NULL; + } + GST_INFO ("Opening MFC device node at: %s", MFC_PATH); ctx->fd = open(MFC_PATH, O_RDWR, 0); if (ctx->fd == -1) { - GST_ERROR ("Unable to open MFC device node: %d", errno); + GST_WARNING ("Unable to open MFC device node: %d", errno); free(ctx); return NULL; }