diff -r 000000000000 -r c397a899490f gmyth-stream/server/0.3/lib/transcoder.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth-stream/server/0.3/lib/transcoder.py Wed May 30 19:53:13 2007 +0100 @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +__author__ = "Gustavo Sverzut Barbieri / Artur Duque de Souza" +__author_email__ = "barbieri@gmail.com / artur.souza@indt.org.br" +__license__ = "GPL" +__version__ = "0.4" + +__all__ = ("Transcoder") + +class Transcoder(object): + """Transcoder's Class: parent class to implement + a plugin for transcoding data.""" + priority = 0 # negative values have higher priorities + name = None # to be used in requests + status = None + log = None + tid = -1 + + def __init__(self, params): + self.params = params + # __init__() + + + def params_first(self, key, default=None): + if default is None: + return self.params[key][0] + else: + try: + return self.params[key][0] + except: + return default + # params_first() + + + def get_mimetype(self): + mux = self.params_first("mux", "mpg") + + if mux == "mpeg": + return "video/mpeg" + elif mux == "avi": + return "video/x-msvideo" + else: + return "application/octet-stream" + # get_mimetype() + + def start(self, outfile): + return True + # start() + + + def stop(self): + return True + # stop() + + def __str__(self): + return '%s: %s( params=%s ) - Status: %s%%' % \ + (self.__class__.__name__, self.tid, + self.params, self.status) + # __str__() +# Transcoder