Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Apr 2017 01:15:29 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r438756 - in head/multimedia/py-cec: . files
Message-ID:  <201704180115.v3I1FTQ5011750@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Tue Apr 18 01:15:29 2017
New Revision: 438756
URL: https://svnweb.freebsd.org/changeset/ports/438756

Log:
  Fix py-cec build after update of libcec.
  
  Submitted by:	swills
  Differential Revision:	https://reviews.freebsd.org/D10396

Added:
  head/multimedia/py-cec/files/
  head/multimedia/py-cec/files/patch-cec.cpp   (contents, props changed)
  head/multimedia/py-cec/files/patch-device.cpp   (contents, props changed)
Modified:
  head/multimedia/py-cec/Makefile

Modified: head/multimedia/py-cec/Makefile
==============================================================================
--- head/multimedia/py-cec/Makefile	Mon Apr 17 23:11:53 2017	(r438755)
+++ head/multimedia/py-cec/Makefile	Tue Apr 18 01:15:29 2017	(r438756)
@@ -2,6 +2,7 @@
 
 PORTNAME=	cec
 PORTVERSION=	0.2.5
+PORTREVISION=	1
 CATEGORIES=	multimedia python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}

Added: head/multimedia/py-cec/files/patch-cec.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/py-cec/files/patch-cec.cpp	Tue Apr 18 01:15:29 2017	(r438756)
@@ -0,0 +1,109 @@
+--- cec.cpp.orig	2017-04-14 13:57:59.489525000 +0000
++++ cec.cpp	2017-04-14 15:16:14.322425000 +0000
+@@ -93,7 +93,7 @@ using namespace CEC;
+ #endif
+ 
+ // cec_adapter_descriptor and DetectAdapters were introduced in 2.1.0
+-#if CEC_LIB_VERSION_MAJOR >= 2 && CEC_LIB_VERSION_MINOR >= 1
++#if CEC_LIB_VERSION_MAJOR >=3 || CEC_LIB_VERSION_MAJOR >= 2 && CEC_LIB_VERSION_MINOR >= 1
+ #define CEC_ADAPTER_TYPE cec_adapter_descriptor
+ #define CEC_FIND_ADAPTERS DetectAdapters
+ #define HAVE_CEC_ADAPTER_DESCRIPTOR 1
+@@ -520,36 +520,34 @@ static PyMethodDef CecMethods[] = {
+ libcec_configuration * CEC_config;
+ ICECCallbacks * CEC_callbacks; 
+ 
+-int log_cb(void * self, const cec_log_message message) {
++void log_cb(void * self, const cec_log_message* message) {
+    debug("got log callback\n");
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
+-   int level = message.level;
+-   long int time = message.time;
++   int level = message->level;
++   long int time = message->time;
+    PyObject * args = Py_BuildValue("(iils)", EVENT_LOG, 
+          level,
+          time,
+-         message.message);
++         message->message);
+    trigger_event(EVENT_LOG, args);
+    Py_DECREF(args);
+    PyGILState_Release(gstate);
+-   return 1;
+ }
+ 
+-int keypress_cb(void * self, const cec_keypress key) {
++void keypress_cb(void * self, const cec_keypress* key) {
+    debug("got keypress callback\n");
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
+    PyObject * args = Py_BuildValue("(iBI)", EVENT_KEYPRESS,
+-         key.keycode,
+-         key.duration);
++         key->keycode,
++         key->duration);
+    trigger_event(EVENT_KEYPRESS, args);
+    Py_DECREF(args);
+    PyGILState_Release(gstate);
+-   return 1;
+ }
+ 
+-int command_cb(void * self, const cec_command command) {
++void command_cb(void * self, const cec_command* command) {
+    debug("got command callback\n");
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
+@@ -560,10 +558,9 @@ int command_cb(void * self, const cec_co
+    //trigger_event(EVENT_COMMAND, args);
+    Py_DECREF(args);
+    PyGILState_Release(gstate);
+-   return 1;
+ }
+ 
+-int config_cb(void * self, const libcec_configuration) {
++void config_cb(void * self, const libcec_configuration*) {
+    debug("got config callback\n");
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
+@@ -578,10 +575,9 @@ int config_cb(void * self, const libcec_
+    //trigger_event(EVENT_CONFIG_CHANGE, args);
+    Py_DECREF(args);
+    PyGILState_Release(gstate);
+-   return 1;
+ }
+ 
+-int alert_cb(void * self, const libcec_alert alert, const libcec_parameter p) {
++void alert_cb(void * self, const libcec_alert alert, const libcec_parameter p) {
+    debug("got alert callback\n");
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
+@@ -595,7 +591,6 @@ int alert_cb(void * self, const libcec_a
+    trigger_event(EVENT_ALERT, args);
+    Py_DECREF(args);
+    PyGILState_Release(gstate);
+-   return 1;
+ }
+ 
+ int menu_cb(void * self, const cec_menu_state menu) {
+@@ -654,13 +649,13 @@ PyMODINIT_FUNC initcec(void) {
+ #if CEC_LIB_VERSION_MAJOR > 1 || ( CEC_LIB_VERSION_MAJOR == 1 && CEC_LIB_VERSION_MINOR >= 7 )
+    CEC_callbacks->Clear();
+ #endif
+-   CEC_callbacks->CBCecLogMessage = log_cb;
+-   CEC_callbacks->CBCecKeyPress = keypress_cb;
+-   CEC_callbacks->CBCecCommand = command_cb;
+-   CEC_callbacks->CBCecConfigurationChanged = config_cb;
+-   CEC_callbacks->CBCecAlert = alert_cb;
+-   CEC_callbacks->CBCecMenuStateChanged = menu_cb;
+-   CEC_callbacks->CBCecSourceActivated = activated_cb;
++   CEC_callbacks->logMessage = log_cb;
++   CEC_callbacks->keyPress = keypress_cb;
++   CEC_callbacks->commandReceived = command_cb;
++   CEC_callbacks->configurationChanged = config_cb;
++   CEC_callbacks->alert = alert_cb;
++   CEC_callbacks->menuStateChanged = menu_cb;
++   CEC_callbacks->sourceActivated = activated_cb;
+ 
+    CEC_config->callbacks = CEC_callbacks;
+ 

Added: head/multimedia/py-cec/files/patch-device.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/py-cec/files/patch-device.cpp	Tue Apr 18 01:15:29 2017	(r438756)
@@ -0,0 +1,25 @@
+--- device.cpp.orig	2017-04-14 15:17:22.504454000 +0000
++++ device.cpp	2017-04-14 15:27:24.544699000 +0000
+@@ -244,17 +244,17 @@ static PyObject * Device_new(PyTypeObjec
+ 
+       if( !(self->cecVersion = Py_BuildValue("s", ver_str)) ) return NULL;
+ 
+-      cec_osd_name name;
++      std::string name;
+       Py_BEGIN_ALLOW_THREADS
+       name = adapter->GetDeviceOSDName(self->addr);
+       Py_END_ALLOW_THREADS
+-      if( !(self->osdName = Py_BuildValue("s", name.name)) ) return NULL;
++      if( !(self->osdName = Py_BuildValue("s", name.c_str())) ) return NULL;
+ 
+-      cec_menu_language lang;
++      std::string lang;
+       Py_BEGIN_ALLOW_THREADS
+-      adapter->GetDeviceMenuLanguage(self->addr, &lang);
++      lang = adapter->GetDeviceMenuLanguage(self->addr);
+       Py_END_ALLOW_THREADS
+-      if( !(self->lang = Py_BuildValue("s", lang.language)) ) return NULL;
++      if( !(self->lang = Py_BuildValue("s", lang.c_str())) ) return NULL;
+    }
+ 
+    return (PyObject *)self;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704180115.v3I1FTQ5011750>