Tuesday, January 12, 2010

Computer

Double Click

def doubleclicked(self, data, third):
        if os.path.isfile(os.path.abspath(self.soundfile)):
            self.player.set_property("uri", "file://" +
                                     os.path.abspath(self.soundfile))
        self.player.set_state(gst.STATE_PLAYING)
        else:
           pass


Quality Tab

class Tab(interface.NewTab):
    def make(self):
        # change these to glade callbacks later.
        self.video, self.audio, self.image, self.lapse, self.width, self.height, self.rate = 4, 4, 4, 4, 100, 75, 12000

    def on_video_changed(self, widget):
        self.video = widget.get_value()
        print "video quality", self.video
    if self.video < 1.50:
        self.width = 100
        self.height = 75
    if self.video >= 1.50 and self.video < 2.50:
        self.width = 200
        self.height = 150
        print "optimal"
    if self.video >= 2.50 and self.video < 3.50:
        self.width = 256
        self.height = 192
    if self.video >= 3.50 and self.video < 4.50:
        self.width = 320
        self.height = 240
    if self.video >= 4.50 and self.video < 5.50:
        self.width = 400
        self.width = 300
    if self.video >= 5.50 and self.video <= 6.00:
        self.width = 512
        self.height = 384

    def on_audio_changed(self, widget):
        self.audio = widget.get_value()        
    print "audio quality", self.audio
    if self.audio < 1.50:
        self.rate = 12000
    if self.audio >= 1.50 and self.video < 2.50:
        self.rate = 18000
    if self.audio >= 2.50 and self.video < 3.50:
        self.rate = 24000
    if self.audio >= 3.50 and self.video < 4.50:
        self.rate = 30000
    if self.audio >= 4.50 and self.video < 5.50:
        self.rate = 36000
    if self.audio >= 5.50 and self.video <= 6.00:
        self.rate = 48000

Cameramic

 def video(self):
        VIDEO_GST_PIPE = ['v4l2src', 'queue', 'videorate',
                          'video/x-raw-yuv,framerate=15/1', 'videoscale',
                          'video/x-raw-yuv,width=%d,height=%d' % (qualitytab.tab.width, qualitytab.tab.height),
                          'ffmpegcolorspace', 'theoraenc', 'oggmux']
        pipe = VIDEO_GST_PIPE + ["filesink location=%s" % (self.video_temp)]
        self.video_pipe = gst.parse_launch('!'.join(pipe))
        self.video_pipe.set_state(gst.STATE_PLAYING)
    print qualitytab.tab.width
    print qualitytab.tab.height
            
    def audio(self):
        AUDIO_GST_PIPE = ["alsasrc",
                          "audio/x-raw-int,rate=%d,channels=1,depth=16" %
                          qualitytab.tab.rate, "audioconvert","flacenc"]
        pipe = AUDIO_GST_PIPE + ["filesink location=%s" % (self.audio_temp)]
        self.audio_pipe = gst.parse_launch('!'.join(pipe))
        self.audio_pipe.set_state(gst.STATE_PLAYING)
    print qualitytab.tab.rate        


No comments:

Post a Comment