Changeset 469


Ignore:
Timestamp:
23-05-11 20:05:31 (2 years ago)
Author:
thomas
Message:
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r468 r469  
     12011-05-23  Thomas Vander Stichele  <thomas at apestaart dot org> 
     2 
     3        * morituri/common/encode.py: 
     4          Convert TagReadTask to gstreamer.GstPipelineTask and 
     5          remove lots of duplicate code. 
     6 
    172011-05-23  Thomas Vander Stichele  <thomas at apestaart dot org> 
    28 
  • trunk/morituri/common/encode.py

    r468 r469  
    252252            self.warning('No peak found, something went wrong!') 
    253253 
    254 class TagReadTask(task.Task): 
     254class TagReadTask(gstreamer.GstPipelineTask): 
    255255    """ 
    256256    I am a task that reads tags. 
     
    273273        self._path = path 
    274274 
    275     def start(self, runner): 
    276         task.Task.start(self, runner) 
    277  
    278         # here to avoid import gst eating our options 
    279         import gst 
    280  
    281         self._pipeline = gst.parse_launch(''' 
     275    def getPipelineDesc(self): 
     276        return ''' 
    282277            filesrc location="%s" ! 
    283278            decodebin name=decoder ! 
    284279            fakesink''' % ( 
    285                 common.quoteParse(self._path).encode('utf-8'))) 
    286  
    287         self.debug('pausing pipeline') 
    288         self._pipeline.set_state(gst.STATE_PAUSED) 
    289         ret = self._pipeline.get_state() 
    290         self.debug('paused pipeline, get_state returned %r', ret) 
    291  
    292         # add eos handling 
    293         bus = self._pipeline.get_bus() 
    294         bus.add_signal_watch() 
    295         bus.connect('message::eos', self._message_eos_cb) 
    296  
    297         # set up tag callbacks 
    298         bus.connect('message::tag', self._message_tag_cb) 
    299  
    300         def play(): 
    301             self._pipeline.set_state(gst.STATE_PLAYING) 
    302             return False 
    303         self.runner.schedule(0, play) 
    304  
    305     def _message_eos_cb(self, bus, message): 
     280                common.quoteParse(self._path).encode('utf-8')) 
     281 
     282    def bus_eos_cb(self, bus, message): 
    306283        self.debug('eos, scheduling stop') 
    307284        self.runner.schedule(0, self.stop) 
    308285 
    309     def _message_tag_cb(self, bus, message): 
     286    def bus_tag_cb(self, bus, message): 
    310287        taglist = message.parse_tag() 
    311288        self.taglist = taglist 
    312  
    313     def stop(self): 
    314         # here to avoid import gst eating our options 
    315         import gst 
    316  
    317         self.debug('stopping') 
    318         self.debug('setting state to NULL') 
    319         self._pipeline.set_state(gst.STATE_NULL) 
    320         self.debug('set state to NULL') 
    321         task.Task.stop(self) 
    322289 
    323290class TagWriteTask(task.Task): 
Note: See TracChangeset for help on using the changeset viewer.