[pkg-freevo-commits] r121 - in packages/freevo/trunk/debian: . patches
mennucc1 at alioth.debian.org
mennucc1 at alioth.debian.org
Sat Mar 29 11:38:59 UTC 2008
Author: mennucc1
Date: 2008-03-29 11:38:58 +0000 (Sat, 29 Mar 2008)
New Revision: 121
Added:
packages/freevo/trunk/debian/patches/encodingclient.py.diff
packages/freevo/trunk/debian/patches/encodingcore.py.diff
packages/freevo/trunk/debian/patches/encodingserver.py.diff
packages/freevo/trunk/debian/patches/reencode.py.diff
Modified:
packages/freevo/trunk/debian/changelog
packages/freevo/trunk/debian/patches/series
Log:
add slice encoding patches from SVN (to remove when 1.8.1 is out)
Modified: packages/freevo/trunk/debian/changelog
===================================================================
--- packages/freevo/trunk/debian/changelog 2008-03-29 10:51:56 UTC (rev 120)
+++ packages/freevo/trunk/debian/changelog 2008-03-29 11:38:58 UTC (rev 121)
@@ -4,8 +4,9 @@
to Traduz - Portuguese Translation Team (Closes: #472863).
* readd dependency on "python-xml" , thanks to rUrek
(Closes: #472916) and reopens 468586.
+ * add slice encoding patches from SVN
- --
+ -- A Mennucc1 <mennucc1 at debian.org> Sat, 29 Mar 2008 12:05:59 +0100
freevo (1.8.0-1) unstable; urgency=low
Added: packages/freevo/trunk/debian/patches/encodingclient.py.diff
===================================================================
--- packages/freevo/trunk/debian/patches/encodingclient.py.diff (rev 0)
+++ packages/freevo/trunk/debian/patches/encodingclient.py.diff 2008-03-29 11:38:58 UTC (rev 121)
@@ -0,0 +1,278 @@
+--- freevo/src/video/encodingclient.py 2008/03/24 21:51:48 10586
++++ freevo/src/video/encodingclient.py 2008/03/26 11:48:29 10587
+@@ -81,8 +81,6 @@
+
+ """
+
+-
+-
+ def returnFromJelly(status, response):
+ """Un-serialize EncodingServer responses"""
+ if status:
+@@ -90,11 +88,11 @@
+ else:
+ return (status, response)
+
++
+ def connectionTest(teststr='testing'):
+ """Test connectivity
+
+ Returns false if the EncodingServer cannot be reached"""
+-
+ try:
+ (status, response) = server.echotest(teststr)
+ except:
+@@ -102,6 +100,7 @@
+
+ return (status, response)
+
++
+ def initEncodeJob(source, output, friendlyname="", title=None):
+ """Initialize the encodingjob.
+
+@@ -116,7 +115,6 @@
+ @param title: is obligatory if you have a dvd/dvd-on-disc, in wich case you need
+ to specify a title (integer)
+ """
+-
+ _debug_('initEncodeJob(%s, %s, %s, %s)' % (source, output, friendlyname, title), DINFO)
+ if not (source or output):
+ return (False, "EncodingClient: no source and/or output")
+@@ -130,27 +128,36 @@
+
+ return (status, response)
+
++
+ def getContainerCAP():
+ """Get a list of possible container formats
+
+ This returns a list with plain strings, each identifiyng a container format, like
+ Avi, MPEG or OGG. Currently only Avi is available. The strings are user-readable.
+ """
+-
+ try:
+ response = server.getContainerCAP()
+ except:
+- return (False ,'EncodingClient: connection error')
++ return (False, 'EncodingClient: connection error')
+
+ return (True, response )
+
++
++def setTimeslice(idnr, timeslice):
++ """Set """
++ try:
++ (status, response) = server.setTimeslice(idnr, timeslice)
++ except:
++ return (False, 'EncodingClient: connection error')
++ return (status, response)
++
++
+ def setContainer(idnr, container):
+ """Set a container format
+
+ container is one of the possible container formats. It should be one of the strings
+ returned by getContainerCAP.
+ """
+-
+ if not (idnr or container):
+ return (False, "EncodingClient: no idnr and/or container")
+
+@@ -161,19 +168,20 @@
+
+ return (status, response)
+
++
+ def getVideoCodecCAP():
+ """Get a list of possible video codecs (depending on the input and container format)
+
+ This returns a list with plain strings, each identifiyng a video codec, like
+ MPEG4(divx), Xvid etc. Currently only MPEG4 is available. The strings are user-readable.
+ """
+-
+ try:
+ response = server.getVideoCodecCAP()
+ except:
+- return (False,'EncodingClient: connection error')
++ return (False, 'EncodingClient: connection error')
++
++ return (True, response)
+
+- return (True,response)
+
+ def setVideoCodec(idnr, vcodec, tgtsize, multipass=False, vbitrate=0, altprofile=None):
+ """Set a video codec
+@@ -187,7 +195,6 @@
+ @param vbitrate: is the video bitrate, if it is not 0 then this value is used instead
+ of using the tgtsize.
+ """
+-
+ if not (idnr or vcodec or tgtsize or vbitrate):
+ return (False, "EncodingClient: no idnr and/or videocodec and/or targetsize")
+
+@@ -198,13 +205,13 @@
+
+ return (status, response)
+
++
+ def getAudioCodecCAP():
+ """Get a list of possible audio codecs (depending on the input and container format)
+
+ This returns a list with plain strings, each identifiyng a audio codec, like
+ MP3, Ogg, etc. Currently only MP3 is available. The strings are user-readable.
+ """
+-
+ try:
+ response = server.getAudioCodecCAP()
+ except:
+@@ -212,6 +219,7 @@
+
+ return (True, response )
+
++
+ def setAudioCodec(idnr, acodec, abrate):
+ """Set a audio codec
+
+@@ -222,7 +230,6 @@
+ between 0 and 320 is valid, it is advisable to take standard encoding bitrates
+ like 32, 64, 128, 160, 192, 256 and 320.
+ """
+-
+ if not (idnr or acodec or abrate):
+ return (False, "EncodingClient: no idnr and/or audiocodec and/or audiobitrate")
+
+@@ -233,13 +240,13 @@
+
+ return (status, response)
+
++
+ def setVideoRes(idnr, videores):
+ """Set the video resolution
+
+ @param vidoeres: is a string in the form of x:y
+
+ """
+-
+ if not (idnr or videores):
+ return (False, "EncodingClient: no idnr or no videores")
+
+@@ -250,13 +257,13 @@
+
+ return (status, response)
+
++
+ def setNumThreads(idnr, numthreads):
+ """Set the number of encoder threads
+
+ @param numthreads: is a string value from 1-8
+
+ """
+-
+ if not (idnr or numthreads):
+ return (False, "EncodingClient: no idnr or no numthreads")
+
+@@ -267,6 +274,7 @@
+
+ return (status, response)
+
++
+ def getVideoFiltersCAP():
+ """Get a dict of possible video filters & processing operations
+
+@@ -274,13 +282,13 @@
+ a list of options (also human-readable strings) as possible settings for each filter.
+ The first option in the list is the default.
+ """
+-
+ try:
+ response = server.getVideoFiltersCAP()
+ except:
+ return (False, 'EncodingClient: connection error')
+
+- return (True ,response)
++ return (True, response)
++
+
+ def setVideoFilters(idnr, filters):
+ """Set a number of possible video filters & processing operations
+@@ -291,7 +299,6 @@
+ to each keyword is thus a string (wich means you cannot choose more then 1 option/setting) per
+ video filter.
+ """
+-
+ if not (idnr or filters):
+ return (False, "EncodingClient: no idnr or filter dictionary")
+
+@@ -302,11 +309,11 @@
+
+ return (status, response)
+
++
+ def queueIt(idnr, now=False):
+ """Insert the current job in the encodingqueue
+ If now is true, the encoding queue is automatically started
+ """
+-
+ if not idnr:
+ return (False, "EncodingClient: no idnr")
+
+@@ -317,6 +324,7 @@
+
+ return (status, response)
+
++
+ def getProgress():
+ """Get the progress & pass information of the job currently encoding.
+
+@@ -336,7 +344,6 @@
+ @returns: When the queue is active, this call returns a tuple of 4 values:
+ (friendlyname, status, perc, timerem)
+ """
+-
+ try:
+ (status, response) = server.getProgress()
+ except:
+@@ -344,9 +351,9 @@
+
+ return returnFromJelly(status, response)
+
++
+ def startQueue():
+ """Start the encoding queue"""
+-
+ try:
+ (status, response) = server.startQueue()
+ except:
+@@ -354,6 +361,7 @@
+
+ return (status, response)
+
++
+ def listJobs():
+ """Get a list with all jobs in the encoding queue and their current state
+
+@@ -362,7 +370,6 @@
+ containing 3 values (idnr, friendlyname, status) These values have the same
+ meaning as the corresponding values returned by the getProgress call
+ """
+-
+ try:
+ (status, response) = server.listJobs()
+ except:
+@@ -389,14 +396,14 @@
+ if function == "runtest":
+ #(status, idnr) = initEncodeJob('/storage/video/dvd/BRUCE_ALMIGHTY/', 'bam.avi', 'lala', 17)
+ (status, idnr) = initEncodeJob('/dev/cdrom', '/home/rdc/fogu.avi', 'lala', 1)
+- print "Job has idnr nr : %s" % idnr
++ print "Job has idnr num: %s" % idnr
+ print idnr
+ #sleep(5)
+ (status, codec) = getVideoCodecCAP(idnr)
+ print codec[0]
+ print codec[1]
+ print setVideoCodec(idnr, codec[1], 1400, True, 0)
+- #print setVideoFilters(idnr, {'Denoise' : 'HQ denoise'})
++ #print setVideoFilters(idnr, {'Denoise': 'HQ denoise'})
+ #sleep(5)
+ print queueIt(idnr, True)
+ sleep(5)
Added: packages/freevo/trunk/debian/patches/encodingcore.py.diff
===================================================================
--- packages/freevo/trunk/debian/patches/encodingcore.py.diff (rev 0)
+++ packages/freevo/trunk/debian/patches/encodingcore.py.diff 2008-03-29 11:38:58 UTC (rev 121)
@@ -0,0 +1,324 @@
+--- freevo/src/encodingcore.py 2008/03/24 21:51:48 10586
++++ freevo/src/encodingcore.py 2008/03/26 11:48:29 10587
+@@ -96,42 +96,45 @@
+
+
+
+-#from pytvgrab enum.py, see http://pytvgrab.sourceforge.net
+ class Enum(dict):
+ """Enum
++ from pytvgrab enum.py, see http://pytvgrab.sourceforge.net
+
+ Enum(names, x=0)"""
+-
+ def __init__(self, names, x=0):
+ for i in range(x, x+len(names)):
+ self.__dict__[names[i-x]]=i
+ self[i]=names[i-x]
+ # __init__()
+
+-
+ status = Enum(['notset', 'apass', 'vpass1', 'vpassfinal', 'postmerge'])
+
++
++
+ class EncodingOptions:
+ def getContainerList(self):
+ """Return a list of possible containers"""
+ return mappings['lists']['containers']
+
++
+ def getVideoCodecList(self):
+ """Return a list of possible video codecs"""
+ return mappings['lists']['videocodecs']
+
++
+ def getAudioCodecList(self):
+ """Return a possible audio codec list"""
+ return mappings['lists']['audiocodecs']
+
++
+ def getVideoFiltersList(self):
+ """Return a list of possible video filters"""
+ return mappings['filtertype']
+
+
++
+ class EncodingJob:
+ """Class for creation & configuration of EncodingJobs. This generates the mencoder commands"""
+-
+ def __init__(self, source, output, friendlyname, idnr, chapter=None):
+ """Initialize class instance"""
+ _debug_('encodingcore.EncodingJob.__init__(%s, %s, %s, %s, %s)' % \
+@@ -157,6 +160,11 @@
+ self.crop = None
+ self.cropres = None
+
++ # list of initial and end point of slice to encode
++ self.timeslice = [ None , None ]
++ # corresponding arguments for mencoder
++ self.timeslice_mencoder = []
++
+ self.acodec = mappings['lists']['audiocodecs'][0]
+ self.abrate = 128
+ self.afilters = {} # Not used atm, might be used in the future
+@@ -195,6 +203,24 @@
+ self.finishedanalyze = True
+
+
++ def setTimeslice(self, timeslice):
++ "Set the encoding timeslice"
++ self.timeslice = timeslice
++ assert(type(timeslice) == type([]))
++ assert(len(timeslice) == 2)
++ self.timeslice_mencoder = []
++ start=0
++ if timeslice[0]:
++ self.timeslice_mencoder += [ '-ss', str(timeslice[0])]
++ start = timeslice[0]
++ if timeslice[1]:
++ self.timeslice_mencoder += ['-endpos', str(timeslice[1]-start)]
++ if timeslice[1] < start:
++ self.timeslice_mencoder = []
++ self.timeslice = [ None , None ]
++ return 'Invalid slice of times: end is before start ??'
++
++
+ def setContainer(self, container):
+ """Set a container to hold the audio & video streams"""
+ #safety checks
+@@ -210,6 +236,7 @@
+ else:
+ self.output = ('%s.%s' % (self.output, self.container))
+
++
+ def setVideoCodec(self, vcodec, tgtsize, multipass=False, vbitrate=0, altprofile=None):
+ """Set video codec and target filesize (in MB) or bit rate (in kbits/sec)"""
+ _debug_('setVideoCodec(self, vcodec=%s, tgtsize=%s, multipass=%s, vbitrate=%s)' % \
+@@ -237,21 +264,25 @@
+ self.acodec = acodec
+ self.abrate = abrate
+
++
+ def setVideoFilters(self, videofilters):
+ """Set video filters"""
+ for vfilter, option in videofilters:
+ if mappings['filter'].has_key(option):
+ self.vfilters += [ mappings['filter'][option]]
+
++
+ def setVideoRes(self, videores):
+ if videores == 'Optimal':
+ (self.resx, self.resy) = (0, 0)
+ else:
+ (self.resx, self.resy) = videores.split(':')
+
++
+ def setNumThreads(self, numthreads):
+ self.threads = numthreads
+
++
+ def _CalcVideoBR(self):
+ """Calculates the video bitrate"""
+
+@@ -296,18 +327,25 @@
+ self._CropDetect()
+
+
+- def _CropDetect(self): #contains pieces of QuickRip
+- """Detect cropping
++ def _CropDetect(self):
++ """Detect cropping, contains pieces of QuickRip
+
+ Function is always called because cropping is a good thing, and we can pass our ideal values
+ back to the client wich can verify them visually if needed.""" #not true atm
+ #build mplayer parameters
+- if hasattr(self, 'length'):
+- sstep = int(self.length / 27)
++ start = 0
++ if self.timeslice[0]:
++ start = self.timeslice[0]
++ if self.timeslice[1]:
++ sstep = int( (self.timeslice[1] - start) / 27)
++ elif hasattr(self, "length"):
++ sstep = int( (self.length - start) / 27)
+ else:
+ sstep = 60
+
+- arguments = [ '-vf', 'cropdetect=30', '-nosound', '-vo', 'null', '-frames', '10','-fps=540', '-sstep', str(sstep)]
++ arguments = self.timeslice_mencoder + [ "-vf", "cropdetect=30", "-nosound", "-vo", "null", "-fps", "540"]
++ if sstep > 0:
++ arguments += [ "-sstep", str(sstep)]
+
+ if self.info.mime == 'video/dvd':
+ arguments += [ '-dvd-device', self.source, 'dvd://%s' % self.chapter ]
+@@ -319,6 +357,7 @@
+ #print (' '.join([mplayer]+arguments))
+ self._run(mplayer, arguments, self._CropDetectParse, None, 0, None)
+
++
+ def _GenerateCLMencoder(self):
+ """Generate the command line(s) to be executed, using MEncoder for encoding"""
+ #calculate the videobitrate
+@@ -344,6 +383,7 @@
+
+ self.cls = [ videopass1, videopass2 ]
+
++
+ def _GCLMSource(self):
+ """Returns source part of mencoder"""
+ if self.info.mime == 'video/dvd':
+@@ -355,6 +395,7 @@
+ else:
+ return [ self.source ]
+
++
+ def _GCLMVideopass(self, passnr):
+ """Returns video pass specefic part of mencoder cl"""
+ vf = copy(self.vfilters)
+@@ -478,13 +519,16 @@
+ if yscaled:
+ args += ['-sws', '1']
+
++ args = self.timeslice_mencoder + args
++
+ return args
+
+
+- #from QuickRip, heavily adapted, new algo
+- #TODO give this another name, it does more then crop detection only
+ def _CropDetectParse(self, lines, data): #seek to remove data
+- """Parses Mplayer output to obtain ideal cropping parameters, and do PAL/NTSC detection"""
++ """Parses Mplayer output to obtain ideal cropping parameters, and do PAL/NTSC detection
++ from QuickRip, heavily adapted, new algo
++ TODO give this another name, it does more then crop detection only
++ """
+ #print '_CropDetectParse(self, lines=%r, data=%r)' % (lines, data)
+
+ re_crop = re.compile('.*-vf crop=(\d*:\d*:\d*:\d*).*')
+@@ -613,12 +657,14 @@
+ #end analyzing
+ self.finishedanalyze = True
+
++
+ def _CalcBPP(self, x, y):
+ """Perform a BPP (Bits per Pixel calculation)"""
+ bpp = (self.vbrate * 1000) / (x * y * self.fps)
+ _debug_('_CalcBPP() = %s, fps=%s' % (bpp, self.fps))
+ return bpp
+
++
+ def _OptimalRes(self, x, y):
+ """Using BPP calculations, try to find out the ideal resolution for this movie"""
+ nonoptimal = True
+@@ -639,9 +685,12 @@
+
+ return ( int(optx), int (opty) )
+
+- #from Quickrip, adapted
+- def _MencoderParse(self, line, data): #seek to remove data
+- """Parses mencoder stdout to get progress and trem"""
++
++ def _MencoderParse(self, line, data):
++ """Parses mencoder stdout to get progress and them
++ from Quickrip, adapted
++ seek to remove data
++ """
+ #(passtype, title) = data
+
+ re_progress = re.compile('(\d+)\%\) .*Trem:\s*(\d+\w+)\s+')
+@@ -650,22 +699,23 @@
+ self.trem = re_progress.search(line).group(2)
+ #self.ui_updateProgress(perc, trem, passtype)
+
+- #from QuickRip, adapted
+- def _run(self, program, arguments, finalfunc, updatefunc=None,
+- flushbuffer=0, data=None, lock=None): # seek to remove data and/or crop (not really used)
+- """Runs a program; supply program name (string) and arguments (list)"""
++
++ def _run(self, program, arguments, finalfunc, updatefunc=None, flushbuffer=0, data=None, lock=None):
++ """Runs a program; supply program name (string) and arguments (list)
++ seek to remove data and/or crop (not really used)
++ """
+ command = [program]
+ command += arguments
+
+- self.thread = CommandThread(self, command, updatefunc, finalfunc,
+- flushbuffer, data, None) #self.lock)
++ self.thread = CommandThread(self, command, updatefunc, finalfunc, flushbuffer, data, None)
+ self.thread.start()
+
+
+
+-#command executing class - Taken from Quickrip & adapted.
+ class CommandThread(threading.Thread): # seek to remove data andor crop (not really used)
+- """Handle threading of external commands"""
++ """Handle threading of external commands
++ command executing class - Taken from Quickrip & adapted.
++ """
+ def __init__(self, parent, command, updatefunc, finalfunc, flushbuffer, data, lock):
+ threading.Thread.__init__(self)
+ self.parent = parent
+@@ -677,6 +727,7 @@
+ self.lock = lock
+ _debug_('command=\"%s\"' % ' '.join(command))
+
++
+ def run(self):
+ #self.lock.acquire()
+ self.pipe = popen2.Popen4(self.command)
+@@ -736,7 +787,6 @@
+
+ class EncodingQueue:
+ """Class for generating an encoding queue"""
+-
+ def __init__(self):
+ #we keep a list and a dict because a dict doesn't store an order
+ self.qlist = []
+@@ -746,12 +796,14 @@
+ #remove old files
+ self._removeTmp()
+
++
+ def addEncodingJob(self, encjob):
+ """Adds an encodingjob to the queue"""
+
+ self.qlist += [encjob]
+ self.qdict[encjob.idnr] = encjob
+
++
+ def getProgress(self):
+ """Gets progress on the current job"""
+ if hasattr(self, 'currentjob'):
+@@ -760,6 +812,7 @@
+ else:
+ return 'No job currently running'
+
++
+ def startQueue(self):
+ """Start the queue"""
+ if not self.running:
+@@ -767,6 +820,7 @@
+ _debug_('queue started', DINFO)
+ self._runQueue()
+
++
+ def listJobs(self):
+ """Returns a list of queue'ed jobs"""
+ if self.qdict == {}:
+@@ -777,6 +831,7 @@
+ jlist += [ (idnr, job.name, job.status) ]
+ return jlist
+
++
+ def _removeTmp(self):
+ """Removes possible temporary files created during encoding"""
+ tmpfiles = ['frameno.avi', 'divx2pass.log', 'xvid-twopass.stats', 'x264_2pass.log' ]
+@@ -785,6 +840,7 @@
+ if os.path.exists(tmpfile):
+ os.remove(tmpfile)
+
++
+ def _runQueue(self, line='', data=''):
+ """Executes the jobs in the queue, and gets called after every mencoder run is completed"""
+ if self.qlist == []:
Added: packages/freevo/trunk/debian/patches/encodingserver.py.diff
===================================================================
--- packages/freevo/trunk/debian/patches/encodingserver.py.diff (rev 0)
+++ packages/freevo/trunk/debian/patches/encodingserver.py.diff 2008-03-29 11:38:58 UTC (rev 121)
@@ -0,0 +1,199 @@
+--- freevo/src/helpers/encodingserver.py 2008/03/24 21:51:48 10586
++++ freevo/src/helpers/encodingserver.py 2008/03/26 11:48:29 10587
+@@ -68,7 +68,6 @@
+
+
+ class EncodingServer(xmlrpc.XMLRPC):
+-
+ def __init__(self, debug=False, allowNone=False):
+ """ Initialise the EncodingServer class """
+ _debug_('EncodingServer.__init__(debug=%r, allowNone=%r)' % (debug, allowNone), 2)
+@@ -80,14 +79,16 @@
+ self.jobs = {}
+ self.encodingopts = EncodingOptions()
+ self.queue = EncodingQueue()
+- _debug_("EncodingServer started...", DINFO)
++ _debug_('EncodingServer started...', DINFO)
++
+
+ def xmlrpc_echotest(self, blah):
+ """ Using Twisted check the connection """
+ _debug_('xmlrpc_echotest(blah=%r)' % (blah), 2)
+ return (True, 'EncodingServer::echotest: %s' % blah)
+
+- def xmlrpc_initEncodeJob(self, source, output, friendlyname="", chapter=None):
++
++ def xmlrpc_initEncodeJob(self, source, output, friendlyname='', chapter=None):
+ """ Using Twisted initialise an encoding job """
+ _debug_('xmlrpc_initEncodeJob(source=%r, output=%r, friendlyname=%r, chapter=%r)' % \
+ (source, output, friendlyname, chapter), 1)
+@@ -95,11 +96,11 @@
+ if not (source or output):
+ return (False, 'EncodingServer::initEncodeJob: no source or output given')
+
+- # generate a "random" idnr based on the time in p2.3, int() can return long
++ # generate a 'random' idnr based on the time in p2.3, int() can return long
+ # int's, which is fine, except it makes XMLRPC fail somewhere along the way so we
+ # devide or random number by 100 :)
+ idnr = int((time.time() / random.random()) / 100)
+- _debug_("idnr=%s" % (idnr), 2)
++ _debug_('idnr=%s' % (idnr), 2)
+ self.jobs[idnr] = EncodingJob(source, output, friendlyname, idnr, chapter)
+
+ #wait for the analyzing to end
+@@ -109,30 +110,43 @@
+ _debug_('Analysis failed')
+ return (False,10)
+
+- _debug_("Initialized job %s (idnr : %s)" % (friendlyname, idnr), DINFO)
++ _debug_('Initialized job %s (idnr: %s)' % (friendlyname, idnr), DINFO)
+
+ return (True, idnr)
+
++
+ def xmlrpc_getContainerCAP(self):
+ """ Using Twisted get the container capabilities """
+ _debug_('xmlrpc_getContainerCAP()' , 2)
+ return EncodingOptions.getContainerList( self.encodingopts)
+
++
+ def xmlrpc_setContainer(self, idnr, container):
+ """ Using Twisted set the container """
+ _debug_('xmlrpc_setContainer(idnr=%r, container=%r)' % (idnr, container), 2)
+ status = self.jobs[idnr].setContainer(container)
+
+ if not status:
+- return (True, "EncodingServer::setContainer: OK")
++ return (True, 'EncodingServer::setContainer: OK')
++ else:
++ return (False, 'EncodingServer::setContainer: %s' % status)
++
++
++ def xmlrpc_setTimeslice(self,idnr,timeslice):
++ _debug_('xmlrpc_setTimeslice(self, %s, %s)' % (idnr, timeslice), 3)
++ status = self.jobs[idnr].setTimeslice(timeslice)
++ if not status:
++ return (True, 'EncodingServer::setTimeslice: OK')
+ else:
+- return (False, "EncodingServer::setContainer: %s" % status)
++ return (False, 'EncodingServer::setTimeslice: %s' % status)
++
+
+ def xmlrpc_getVideoCodecCAP(self):
+ """ Using Twisted get the video capabilities """
+ _debug_('xmlrpc_getVideoCodecCAP()', 2)
+ return EncodingOptions.getVideoCodecList(self.encodingopts)
+
++
+ def xmlrpc_setVideoCodec(self, idnr, vcodec, tgtsize, multipass=False, vbitrate=0, altprofile=None):
+ """ Using Twisted set the video codec """
+ _debug_('xmlrpc_setVideoCodec(idnr=%r, vcodec=%r, tgtsize=%r, multipass=%r, vbitrate==%r)' % \
+@@ -144,15 +158,17 @@
+ status = self.jobs[idnr].setVideoCodec(vcodec, tgtsize, multipass, vbitrate, altprofile)
+
+ if not status:
+- return (True, "EncodingServer::setVideoCodec: OK")
++ return (True, 'EncodingServer::setVideoCodec: OK')
+ else:
+- return (False, "EncodingServer::setVideoCodec: %s" % status)
++ return (False, 'EncodingServer::setVideoCodec: %s' % status)
++
+
+ def xmlrpc_getAudioCodecCAP(self):
+ """ Using Twisted get the audio capabilities """
+ _debug_('xmlrpc_getAudioCodecCAP()', 2)
+ return EncodingOptions.getAudioCodecList(self.encodingopts)
+
++
+ def xmlrpc_setAudioCodec(self, idnr, acodec, abrate):
+ """ Using Twisted set the audio codec """
+ _debug_('xmlrpc_setAudioCodec(idnr=%r, acodec=%r, abrate=%r)' % (idnr, acodec, abrate), 2)
+@@ -163,9 +179,9 @@
+ status = self.jobs[idnr].setAudioCodec(acodec, abrate)
+
+ if not status:
+- return (True, "EncodingServer::setAudioCodec: OK")
++ return (True, 'EncodingServer::setAudioCodec: OK')
+ else:
+- return (False, "EncodingServer::setAudioCodec: %s" % status)
++ return (False, 'EncodingServer::setAudioCodec: %s' % status)
+
+
+ def xmlrpc_setVideoRes(self, idnr, videores ):
+@@ -178,9 +194,9 @@
+ status = self.jobs[idnr].setVideoRes( videores)
+
+ if not status:
+- return (True, "EncodingServer::setVideoRes: OK")
++ return (True, 'EncodingServer::setVideoRes: OK')
+ else:
+- return (False, "EncodingServer::setVideoRes: %s" % status)
++ return (False, 'EncodingServer::setVideoRes: %s' % status)
+
+
+ def xmlrpc_setNumThreads(self, idnr, numthreads ):
+@@ -193,9 +209,9 @@
+ status = self.jobs[idnr].setNumThreads( numthreads)
+
+ if not status:
+- return (True, "EncodingServer::setNumThreads: OK")
++ return (True, 'EncodingServer::setNumThreads: OK')
+ else:
+- return (False, "EncodingServer::setNumThreads: %s" % status)
++ return (False, 'EncodingServer::setNumThreads: %s' % status)
+
+
+ def xmlrpc_getVideoFiltersCAP(self):
+@@ -214,33 +230,37 @@
+ status = self.jobs[idnr].setVideoFilters(unjam(filters))
+
+ if not status:
+- return (True, "EncodingServer::setVideoFilters: OK")
++ return (True, 'EncodingServer::setVideoFilters: OK')
+ else:
+- return (False, "EncodingServer::setVideoFilters: %s" % status)
++ return (False, 'EncodingServer::setVideoFilters: %s' % status)
++
+
+ def xmlrpc_queueIt(self, idnr, now=False):
+ """ Using Twisted queue a job to run """
+ _debug_('xmlrpc_queueIt(idnr=%r, now=%r)' % (idnr, now), 2)
+ self.queue.addEncodingJob(self.jobs[idnr])
+ del self.jobs[idnr]
+- _debug_("Added job %s to the queue" % idnr, DINFO)
++ _debug_('Added job %s to the queue' % idnr, DINFO)
+ if now:
+ self.queue.startQueue()
+- return (True, "EncodingServer::queueIt: OK")
++ return (True, 'EncodingServer::queueIt: OK')
++
+
+ def xmlrpc_getProgress(self):
+ """ Using Twisted get the progress status of the current job """
+ _debug_('xmlrpc_getProgress()', 2)
+ prog = self.queue.getProgress()
+ if type(prog) is str:
+- return (False, "EncodingServer::getProgress: %s" % prog)
++ return (False, 'EncodingServer::getProgress: %s' % prog)
+ return (True, jam(prog))
+
++
+ def xmlrpc_startQueue(self):
+ """ Using Twisted start the job queue """
+ _debug_('xmlrpc_startQueue()', 2)
+ self.queue.startQueue()
+- return (True, "EncodingServer::startqueue: OK")
++ return (True, 'EncodingServer::startqueue: OK')
++
+
+ def xmlrpc_listJobs(self):
+ """ List the current jobs """
+@@ -257,7 +277,7 @@
+ os.chdir(tmppath)
+
+ debug = False
+- if len(sys.argv) >= 2 and sys.argv[1] == "debug":
++ if len(sys.argv) >= 2 and sys.argv[1] == 'debug':
+ debug = True
+ import encodingcore
+ encodingcore.DEBUG = debug
Added: packages/freevo/trunk/debian/patches/reencode.py.diff
===================================================================
--- packages/freevo/trunk/debian/patches/reencode.py.diff (rev 0)
+++ packages/freevo/trunk/debian/patches/reencode.py.diff 2008-03-29 11:38:58 UTC (rev 121)
@@ -0,0 +1,196 @@
+--- freevo/src/video/plugins/reencode.py 2008/03/24 21:51:48 10586
++++ freevo/src/video/plugins/reencode.py 2008/03/26 11:48:29 10587
+@@ -29,11 +29,12 @@
+ # -----------------------------------------------------------------------
+
+
++import os
+ from os.path import join, split
++import config
+ import plugin
+ import menu
+-import os
+-import config
++import util
+ from video.encodingclient import *
+ from gui.AlertBox import AlertBox
+ from gui.PopupBox import PopupBox
+@@ -57,9 +58,11 @@
+ self.source = ''
+ self.output = ''
+ self.resetprofile()
++ self.timeslice = [ None, None ]
+
+ def resetprofile(self):
+ self.profile = {}
++ self.timeslice = [ None, None ]
+ self.profile['container'] = config.REENCODE_CONTAINER
+ self.profile['resolution'] = config.REENCODE_RESOLUTION
+ self.profile['videocodec'] = config.REENCODE_VIDEOCODEC
+@@ -148,6 +151,8 @@
+ menu_items += [ menu.MenuItem(_('Start Encoding'), self.create_job, self.profile) ]
+ menu_items += [ menu.MenuItem(_('Select Encoding Profile'), action=self.select_profile) ]
+ menu_items += [ menu.MenuItem(_('Modify Container'), action=self.mod_container) ]
++ menu_items += [ menu.MenuItem(_('Modify Start Time'), action=self.mod_start_time) ]
++ menu_items += [ menu.MenuItem(_('Modify End Time'), action=self.mod_end_time) ]
+ menu_items += [ menu.MenuItem(_('Modify Resolution'), action=self.mod_resolution) ]
+ menu_items += [ menu.MenuItem(_('Modify Video Codec'), action=self.mod_videocodec) ]
+ menu_items += [ menu.MenuItem(_('Modify Video Bitrate'), action=self.mod_videobitrate) ]
+@@ -161,6 +166,7 @@
+ menuw.pushmenu(encoding_menu)
+ menuw.refresh()
+
++
+ def select_profile(self, arg=None, menuw=None):
+ _debug_('select_profile(self, arg=None, menuw=None)', 2)
+ menu_items = []
+@@ -173,6 +179,46 @@
+ menuw.pushmenu(encoding_menu)
+ menuw.refresh()
+
++
++ def set_start_time(self, arg=None, menuw=None):
++ self.timeslice[0] = arg
++ if menuw:
++ menuw.back_one_menu(arg='reload')
++
++
++ def set_end_time(self, arg=None, menuw=None):
++ self.timeslice[1] = arg
++ if menuw:
++ menuw.back_one_menu(arg='reload')
++
++
++ def _select_time(self, arg=None, menuw=None, which=None):
++ bookmarkfile = util.get_bookmarkfile(self.item.filename)
++ if not os.path.exists(bookmarkfile):
++ self.error(_('No bookmarks are set for this video'))
++ return
++ menu_items = []
++ menu_items = [ menu.MenuItem(_('Do not set'), action=which, arg=None),]
++ for line in util.readfile(bookmarkfile):
++ sec = int(line)
++ hour = int(sec/3600)
++ min = int((sec-(hour*3600))/60)
++ time = '%0.2d:%0.2d:%0.2d' % (hour,min,sec % 60)
++ menu_items.append(menu.MenuItem(time, action=which, arg=sec))
++ encoding_menu = menu.Menu(_('Select Time'), menu_items, item_types = 'video encoding menu')
++ encoding_menu.infoitem = self
++ menuw.pushmenu(encoding_menu)
++ menuw.refresh()
++
++
++ def mod_start_time(self, arg=None, menuw=None):
++ self._select_time(arg, menuw, self.set_start_time)
++
++
++ def mod_end_time(self, arg=None, menuw=None):
++ self._select_time(arg, menuw, self.set_end_time)
++
++
+ def mod_container(self, arg=None, menuw=None):
+ _debug_('mod_container(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -183,6 +229,7 @@
+ menuw.pushmenu(container_menu)
+ menuw.refresh()
+
++
+ def mod_resolution(self, arg=None, menuw=None):
+ _debug_('mod_resolution(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -193,6 +240,7 @@
+ menuw.pushmenu(resolution_menu)
+ menuw.refresh()
+
++
+ def mod_videocodec(self, arg=None, menuw=None):
+ _debug_('mod_videocodec(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -203,6 +251,7 @@
+ menuw.pushmenu(videocodec_menu)
+ menuw.refresh()
+
++
+ def mod_videobitrate(self, arg=None, menuw=None):
+ _debug_('mod_videobitrate(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -213,6 +262,7 @@
+ menuw.pushmenu(videobitrate_menu)
+ menuw.refresh()
+
++
+ def mod_audiocodec(self, arg=None, menuw=None):
+ _debug_('mod_audiocodec(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -223,6 +273,7 @@
+ menuw.pushmenu(audiocodec_menu)
+ menuw.refresh()
+
++
+ def mod_audiobitrate(self, arg=None, menuw=None):
+ _debug_('mod_audiobitrate(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -233,6 +284,7 @@
+ menuw.pushmenu(audiobitrate_menu)
+ menuw.refresh()
+
++
+ def mod_numpasses(self, arg=None, menuw=None):
+ _debug_('mod_numpasses(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -243,6 +295,7 @@
+ menuw.pushmenu(numpasses_menu)
+ menuw.refresh()
+
++
+ def mod_numthreads(self, arg=None, menuw=None):
+ _debug_('mod_numthreads(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -253,6 +306,7 @@
+ menuw.pushmenu(numthreads_menu)
+ menuw.refresh()
+
++
+ def mod_videofilter(self, arg=None, menuw=None):
+ _debug_('mod_videofilter(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ items = []
+@@ -263,6 +317,7 @@
+ menuw.pushmenu(videofilter_menu)
+ menuw.refresh()
+
++
+ def select_encoding_profile(self, arg=None, menuw=None):
+ _debug_('select_encoding_profile(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+
+@@ -314,6 +369,7 @@
+ if menuw:
+ menuw.back_one_menu(arg='reload')
+
++
+ def alter_prop(self, arg=(None, None), menuw=None):
+ _debug_('alter_prop(self, arg=%r, menuw=%r)' % (arg, menuw), 2)
+ (prop, val) = arg
+@@ -371,6 +427,12 @@
+
+ idnr = resp
+
++ (status, resp) = setTimeslice(idnr, self.timeslice)
++ _debug_('setTimeslice:status:%s resp:%s' % (status, resp))
++ if not status:
++ self.error(resp)
++ return
++
+ (status, resp) = setContainer(idnr, profile['container'])
+ _debug_('setContainer:status:%s resp:%s' % (status, resp))
+ if not status:
+@@ -378,7 +440,8 @@
+ return
+
+ multipass = profile['numpasses'] > 1
+- (status, resp) = setVideoCodec(idnr, profile['videocodec'], 0, multipass, profile['videobitrate'], profile['altprofile'])
++ (status, resp) = setVideoCodec(idnr, profile['videocodec'], 0, multipass,
++ profile['videobitrate'], profile['altprofile'])
+ _debug_('setVideoCodec:status:%s resp:%s' % (status, resp))
+ if not status:
+ self.error(resp)
Modified: packages/freevo/trunk/debian/patches/series
===================================================================
--- packages/freevo/trunk/debian/patches/series 2008-03-29 10:51:56 UTC (rev 120)
+++ packages/freevo/trunk/debian/patches/series 2008-03-29 11:38:58 UTC (rev 121)
@@ -4,3 +4,10 @@
umask.diff
config_py.diff
local_conf_py_example_remarks.diff
+#
+#slice encoding, from SVN
+encodingclient.py.diff
+encodingcore.py.diff
+encodingserver.py.diff
+reencode.py.diff
+#
\ No newline at end of file
More information about the Pkg-freevo-commits
mailing list