Skip to content

Commit

Permalink
just more implementation and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Hallman committed Nov 27, 2014
1 parent cab0477 commit bfdd189
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
4 changes: 2 additions & 2 deletions example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
kurento = KurentoClient("ws://localhost:8888/kurento")


class Participant:
class Participant(object):
def __init__(self, room, offer):
self.participant_id = str(uuid.uuid4())
self.room = room
Expand All @@ -40,7 +40,7 @@ def connect(self, participant, offer):
return outgoing.processOffer(offer)


class Room:
class Room(object):
rooms = {}

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion pykurento/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pykurento import media
from pykurento.transport import KurentoTransport

class KurentoClient:
class KurentoClient(object):
def __init__(self, url):
self.url = url
self.transport = KurentoTransport(self.url)
Expand Down
48 changes: 36 additions & 12 deletions pykurento/media.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
class MediaObject:
import logging

# This is the object graph as described at http://www.kurento.org/docs/5.0.3/mastering/kurento_API.html
# We dont mimic it precisely yet as its still being built out, not all abstractions are necessary
# MediaObject
# Hub MediaElement MediaPipeline
# HubPort Endpoint Filter
# InputEndpoint OutputEndpoint
logger = logging.getLogger(__name__)

# This is the object graph as described at http://www.kurento.org/docs/5.0.3/mastering/kurento_API.html
# We dont mimic it precisely yet as its still being built out, not all abstractions are necessary
# MediaObject
# Hub MediaElement MediaPipeline
# HubPort Endpoint Filter
# InputEndpoint OutputEndpoint


class MediaObject(object):
def __init__(self, parent, **args):
logger.debug("Creating new %s", self.__class__.__name__)
self.parent = parent
args["mediaPipeline"] = self.get_pipeline().id
self.options = args
self.id = self.get_transport().create(self.__class__.__name__, **args)

def get_transport(self):
Expand All @@ -31,15 +36,15 @@ def release(self):


class MediaPipeline(MediaObject):
def __init__(self, parent, **args):
self.parent = parent
self.id = self.get_transport().create(self.__class__.__name__, **args)

def get_pipeline(self):
return self


class MediaElement(MediaObject):
def __init__(self, parent, **args):
args["mediaPipeline"] = parent.get_pipeline().id
super(MediaElement, self).__init__(parent, **args)

def connect(self, sink):
return self.invoke("connect", sink=sink.id)

Expand All @@ -49,22 +54,39 @@ def connect(self, sink):
class HttpGetEndpoint(MediaElement):
pass


class HttpPostEndpoint(MediaElement):
pass


class PlayerEndpoint(MediaElement):
pass


class RecorderEndpoint(MediaElement):
pass


class RtpEndpoint(MediaElement):
pass


class WebRtcEndpoint(MediaElement):
def generateOffer(self):
return self.invoke("generateOffer")

def processOffer(self, offer):
return self.invoke("processOffer", offer=offer)

def processAnswer(self, answer):
return self.invoke("processAnswer", answer=answer)

def getLocalSessionDescriptor(self):
return self.invoke("getLocalSessionDescriptor")

def getRemoteSessionDescriptor(self):
return self.invoke("getRemoteSessionDescriptor")


# FILTERS

Expand All @@ -86,9 +108,11 @@ def on_code_found_event(self, fn):
class Composite(MediaElement):
pass


class Dispatcher(MediaElement):
pass


class DispatcherOneToMany(MediaElement):
pass

Expand Down
4 changes: 2 additions & 2 deletions pykurento/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TimeoutException(Exception):
pass


class Timeout:
class Timeout(object):
def __init__(self, seconds=1, error_message='Timeout'):
self.seconds = seconds
self.error_message = error_message
Expand All @@ -36,7 +36,7 @@ def __str__(self):
return "%s - %s" % (str(self.message), json.dumps(self.response))


class KurentoTransport:
class KurentoTransport(object):
def __init__(self, url):
logger.debug("Creating new KurentoTransport with url: %s" % url)
self.url = url
Expand Down

0 comments on commit bfdd189

Please sign in to comment.