[vlc-commits] x264.c: use pf_log to get x264 log messages

Ilkka Ollakka git at videolan.org
Sat Jan 21 15:58:09 CET 2012


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Jan 21 16:54:22 2012 +0200| [30c93dead54d85b7273a80df7935ab4b51d20f02] | committer: Ilkka Ollakka

x264.c: use pf_log to get x264 log messages

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30c93dead54d85b7273a80df7935ab4b51d20f02
---

 modules/codec/x264.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 9c46731..97bb3c3 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -51,6 +51,7 @@
  *****************************************************************************/
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
+static void x264_log( void *, int i_level, const char *psz, va_list );
 
 /* Frame-type options */
 
@@ -1235,6 +1236,8 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.rc.b_stat_read = i_val & 2;
     }
 
+    p_sys->param.pf_log = x264_log;
+    p_sys->param.p_log_private = p_enc;
     /* We need to initialize pthreadw32 before we open the encoder,
        but only once for the whole application. Since pthreadw32
        doesn't keep a refcount, do it ourselves. */
@@ -1316,6 +1319,30 @@ static int  Open ( vlc_object_t *p_this )
 }
 
 /****************************************************************************
+ * Logging
+ ****************************************************************************/
+static void x264_log( void *data, int i_level, const char *psz, va_list args)
+{
+    encoder_t *p_enc = (encoder_t *)data;
+
+    switch( i_level )
+    {
+        case X264_LOG_ERROR:
+            i_level = VLC_MSG_ERR;
+            break;
+        case X264_LOG_WARNING:
+            i_level = VLC_MSG_WARN;
+        case X264_LOG_INFO:
+        case X264_LOG_DEBUG:
+            i_level = VLC_MSG_DBG;
+        default:
+            i_level = VLC_MSG_DBG;
+    }
+
+    msg_GenericVa( p_enc, i_level, MODULE_STRING, psz, args );
+};
+
+/****************************************************************************
  * Encode:
  ****************************************************************************/
 static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )



More information about the vlc-commits mailing list