Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-11-03 03:36:48 (GMT)
committer erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-11-03 03:36:48 (GMT)
commit4e06f49609e92c52980c45a47c755166b597a517 (patch)
treefa16858c3ed7507d23617c9832c7b049376619b2
parent153ec8fa087707774abb08805e5b9a38a64bdc0a (diff)
audio speedups
new eben thumbnails git-svn-id: http://mediamods.com/public-svn/camera-activity/Record.activity@858 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
-rw-r--r--constants.py6
-rw-r--r--gfx/object-audio.svg10
-rw-r--r--gfx/object-photo.svg8
-rw-r--r--gfx/object-video.svg14
-rw-r--r--glive.py62
-rw-r--r--ui.py6
-rw-r--r--utils.py5
7 files changed, 79 insertions, 32 deletions
diff --git a/constants.py b/constants.py
index f1637c1..845ad79 100644
--- a/constants.py
+++ b/constants.py
@@ -155,19 +155,19 @@ class Constants:
def __init__( self, ca ):
self.__class__.activityId = ca._activity_id
- thumbPhotoSvgPath = os.path.join(self.__class__.gfxPath, 'thumb_photo.svg')
+ thumbPhotoSvgPath = os.path.join(self.__class__.gfxPath, 'object-photo.svg')
thumbPhotoSvgFile = open(thumbPhotoSvgPath, 'r')
self.__class__.thumbPhotoSvgData = thumbPhotoSvgFile.read()
self.__class__.thumbPhotoSvg = utils.loadSvg(self.__class__.thumbPhotoSvgData, Instance.colorStroke.hex, Instance.colorFill.hex)
thumbPhotoSvgFile.close()
- thumbVideoSvgPath = os.path.join(self.__class__.gfxPath, 'thumb_video.svg')
+ thumbVideoSvgPath = os.path.join(self.__class__.gfxPath, 'object-video.svg')
thumbVideoSvgFile = open(thumbVideoSvgPath, 'r')
self.__class__.thumbVideoSvgData = thumbVideoSvgFile.read()
self.__class__.thumbVideoSvg = utils.loadSvg(self.__class__.thumbVideoSvgData, Instance.colorStroke.hex, Instance.colorFill.hex)
thumbVideoSvgFile.close()
- thumbAudioSvgPath = os.path.join(self.__class__.gfxPath, 'thumb_video.svg')
+ thumbAudioSvgPath = os.path.join(self.__class__.gfxPath, 'object-audio.svg')
thumbAudioSvgFile = open(thumbAudioSvgPath, 'r')
self.__class__.thumbAudioSvgData = thumbAudioSvgFile.read()
self.__class__.thumbAudioSvg = utils.loadSvg(self.__class__.thumbAudioSvgData, Instance.colorStroke.hex, Instance.colorFill.hex)
diff --git a/gfx/object-audio.svg b/gfx/object-audio.svg
new file mode 100644
index 0000000..8a3c9b5
--- /dev/null
+++ b/gfx/object-audio.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#CCCCCC">
+]><svg enable-background="new 0 0 123.5 123.5" height="123.5px" version="1.1" viewBox="0 0 123.5 123.5" width="123.5px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="object-audio_1_">
+ <rect fill="&fill_color;" height="120" stroke="&stroke_color;" stroke-width="3.5" width="120" x="1.75" y="1.75"/>
+ <rect fill="#EEEEEE" height="80.188" width="109.164" x="7.168" y="7.167"/>
+ <g>
+ <path d=" M13.625,104.216c1.186-0.999,2.513-2.458,4.421-2.242c2.045,0.408,3.177,2.035,4.639,3.133c1.025,0.945,2.734,1.868,4.261,1.1 c2.358-1.07,3.49-3.422,6.083-4.194c1.918-0.391,3.319,1.063,4.505,2.062c1.197,1.034,2.452,2.42,4.365,2.435 c2.362-0.416,3.584-2.332,5.291-3.545c1.016-0.854,2.694-1.43,4.011-0.651c2.224,1.116,3.369,7.95,5.89,9.341 c1.996,0.771,4.659-7.438,4.659-7.438s2.514-7.895,4.422-7.497c2.045,0.755,3.177,7.29,4.639,8.388 c1.025,0.945,2.733,1.868,4.262,1.1c2.356-1.07,3.488-3.422,6.082-4.194c1.918-0.391,3.319,1.063,4.507,2.062 c1.196,1.034,2.452,2.42,4.363,2.435c2.362-0.416,3.585-2.332,5.291-3.545c1.016-0.854,2.694-1.43,4.012-0.651 c2.224,1.116,3.369,3.354,5.89,4.107c1.995,0.418,3.442-1.188,4.658-2.204" fill="none" id="path152_2_" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25"/>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/gfx/object-photo.svg b/gfx/object-photo.svg
new file mode 100644
index 0000000..a3b8838
--- /dev/null
+++ b/gfx/object-photo.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#CCCCCC">
+]><svg enable-background="new 0 0 123.5 123.5" height="123.5px" version="1.1" viewBox="0 0 123.5 123.5" width="123.5px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="object-photo">
+ <rect fill="&fill_color;" height="120" stroke="&stroke_color;" stroke-width="3.5" width="120" x="1.75" y="1.75"/>
+ <rect fill="#EEEEEE" height="80.188" width="109.164" x="7.168" y="7.167"/>
+ <circle cx="61.75" cy="104.25" fill="#FFFFFF" r="5"/>
+</g></svg> \ No newline at end of file
diff --git a/gfx/object-video.svg b/gfx/object-video.svg
new file mode 100644
index 0000000..bbc4085
--- /dev/null
+++ b/gfx/object-video.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#CCCCCC">
+]><svg enable-background="new 0 0 123.5 123.5" height="123.5px" version="1.1" viewBox="0 0 123.5 123.5" width="123.5px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="object-video">
+ <rect fill="&fill_color;" height="120" stroke="&stroke_color;" stroke-width="3.5" width="120" x="1.75" y="1.75"/>
+ <rect fill="#EEEEEE" height="80.188" width="109.164" x="7.168" y="7.167"/>
+ <g>
+ <circle cx="17.667" cy="104.25" fill="#FFFFFF" r="2.5"/>
+ <circle cx="39.708" cy="104.25" fill="#FFFFFF" r="2.5"/>
+ <circle cx="61.75" cy="104.25" fill="#FFFFFF" r="5"/>
+ <circle cx="83.791" cy="104.25" fill="#FFFFFF" r="2.5"/>
+ <circle cx="105.834" cy="104.25" fill="#FFFFFF" r="2.5"/>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/glive.py b/glive.py
index 0f3d996..2b28542 100644
--- a/glive.py
+++ b/glive.py
@@ -191,7 +191,7 @@ class Glive:
v4l2 = True
elif (self._PIPETYPE == self.PIPETYPE_AUDIO_RECORD):
- pipeline = gst.parse_launch("v4l2src name=v4l2src_"+n+" ! tee name=videoTee_"+n+" ! xvimagesink name=xvimagesink_"+n+" videoTee_"+n+". ! queue name=picQueue_"+n+" ! ffmpegcolorspace name=picFfmpegcolorspace_"+n+" ! jpegenc name=picJPegenc_"+n+" ! fakesink name=picFakesink_"+n+" alsasrc name=audioAlsasrc_"+n+" ! audio/x-raw-int,rate=16000,channels=1,depth=16 ! queue name=audioQueue_"+n+ " ! audioconvert name=audioAudioconvert_"+n +" ! wavenc name=audioVorbisenc_"+n+" ! filesink name=audioFilesink_"+n )
+ pipeline = gst.parse_launch("v4l2src name=v4l2src_"+n+" ! tee name=videoTee_"+n+" ! xvimagesink name=xvimagesink_"+n+" videoTee_"+n+". ! queue name=picQueue_"+n+" ! ffmpegcolorspace name=picFfmpegcolorspace_"+n+" ! jpegenc name=picJPegenc_"+n+" ! fakesink name=picFakesink_"+n+" alsasrc name=audioAlsasrc_"+n+" ! audio/x-raw-int,rate=16000,channels=1,depth=16 ! queue name=audioQueue_"+n+ " ! audioconvert name=audioAudioconvert_"+n +" ! wavenc name=audioWavenc_"+n+" ! filesink name=audioFilesink_"+n )
v4l2 = True
audioQueue = pipeline.get_by_name('audioQueue_'+n)
@@ -215,10 +215,6 @@ class Glive:
elif (self._PIPETYPE == self.PIPETYPE_SUGAR_JHBUILD):
pipeline = gst.parse_launch("fakesrc ! queue name=xQueue_"+n+" ! videorate ! video/x-raw-yuv,framerate=2/1 ! videoscale ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace ! ximagesink name=ximagesink_"+n)
- if (pipeline == None):
- #todo: handle this?
- print("no pipeline error!")
-
if (v4l2):
v4l2src = pipeline.get_by_name('v4l2src_'+n)
try:
@@ -226,7 +222,6 @@ class Glive:
except:
pass
- #todo: this should be checked with an attribute dictionary
if ((self._PIPETYPE == self.PIPETYPE_XV_VIDEO_DISPLAY_RECORD)
or (self._PIPETYPE == self.PIPETYPE_X_VIDEO_DISPLAY)
or (self._PIPETYPE == self.PIPETYPE_AUDIO_RECORD)):
@@ -279,8 +274,9 @@ class Glive:
def stoppedRecordingAudio( self ):
+ record.Record.log.debug("stoppedRecordingAudio")
if (self.audioPixbuf != None):
- audioFilepath = self.el("audioFilesink").get_property("location")
+ audioFilepath = os.path.join(Instance.tmpPath, "output.wav")#self.el("audioFilesink").get_property("location")
if (not os.path.exists(audioFilepath)):
self.record = False
self.audio = False
@@ -292,14 +288,17 @@ class Glive:
self.ca.m.cannotSaveVideo()
return
+ record.Record.log.debug("pre self.ca.ui.setPostProcessPixBuf")
self.ca.ui.setPostProcessPixBuf(self.audioPixbuf)
+ record.Record.log.debug("post self.ca.ui.setPostProcessPixBuf")
n = "0"
line = 'filesrc location=' + str(audioFilepath) + ' name=audioFilesrc_'+n+' ! wavparse name=audioWavparse_'+n+' ! audioconvert name=audioAudioconvert_'+n+' ! vorbisenc name=audioVorbisenc_'+n+' ! oggmux name=audioOggmux_'+n+' ! filesink name=audioFilesink_'+n
audioline = gst.parse_launch(line)
- taglist = self.getTags()
+ taglist = self.getTags(Constants.TYPE_AUDIO)
base64AudioSnapshot = utils.getStringFromPixbuf(self.audioPixbuf)
taglist[gst.TAG_EXTENDED_COMMENT] = "coverart="+str(base64AudioSnapshot)
+ record.Record.log.debug("post taglist[gst.TAG_EXTENDED_COMMENT]")
vorbisEnc = audioline.get_by_name('audioVorbisenc_'+n)
vorbisEnc.merge_tags(taglist, gst.TAG_MERGE_KEEP)
@@ -307,24 +306,30 @@ class Glive:
audioFilesink = audioline.get_by_name('audioFilesink_'+n)
audioOggFilepath = os.path.join(Instance.tmpPath, "output.ogg")
audioFilesink.set_property("location", audioOggFilepath )
+ record.Record.log.debug("post audioFilesink")
audioBus = audioline.get_bus()
audioBus.add_signal_watch()
self.AUDIO_MUX_MESSAGE_ID = audioBus.connect('message', self._onMuxedAudioMessageCb, audioline)
- #add a listener here to monitor % of transcoding...
- self.AUDIO_TRANSCODE_ID = gobject.timeout_add(self.TRANSCODE_UPDATE_INTERVAL, self._transcodeUpdateCb, audioline)
+ self.TRANSCODE_ID = gobject.timeout_add(self.TRANSCODE_UPDATE_INTERVAL, self._transcodeUpdateCb, audioline)
+ record.Record.log.debug("post AUDIO_TRANSCODE_ID")
gobject.idle_add( audioline.set_state, gst.STATE_PLAYING )
+ record.Record.log.debug("post idle_add")
else:
self.record = False
self.audio = False
self.ca.m.cannotSaveVideo()
- def getTags( self ):
+ def getTags( self, type ):
tl = gst.TagList()
tl[gst.TAG_ARTIST] = str(Instance.nickName)
tl[gst.TAG_COMMENT] = "olpc"
- #todo: more
+ record.Record.log.debug("self.ca.metadata['title']->" + str(self.ca.metadata['title']) )
+ tl[gst.TAG_ALBUM] = self.ca.metadata['title']
+ tl[gst.TAG_DATE] = utils.getDateString(int(time.time()))
+ stringType = Constants.mediaTypes[type][Constants.keyIstr]
+ tl[gst.TAG_TITLE] = Constants.istrBy % {"1":stringType, "2":str(Instance.nickName)}
return tl
@@ -402,27 +407,21 @@ class Glive:
self.ca.ui.setPostProcessPixBuf(self.thumbBuf)
- #todo: just remove these on EOS
- if ( len(self.muxPipes) > 0 ):
- self.muxPipe().get_bus().disable_sync_message_emission()
- self.muxPipe().get_bus().disconnect(self.MUX_MESSAGE_ID)
- self.muxPipe().get_bus().remove_signal_watch()
-
wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
muxFilepath = os.path.join(Instance.tmpPath, "mux.ogg") #ogv
n = str(len(self.muxPipes))
muxline = gst.parse_launch('filesrc location=' + str(oggFilepath) + ' name=muxVideoFilesrc_'+n+' ! oggdemux name=muxOggdemux_'+n+' ! theoradec name=muxTheoradec_'+n+' ! theoraenc name=muxTheoraenc_'+n+' ! oggmux name=muxOggmux_'+n+' ! filesink location=' + str(muxFilepath) + ' name=muxFilesink_'+n+' filesrc location=' + str(wavFilepath) + ' name=muxAudioFilesrc_'+n+' ! wavparse name=muxWavparse_'+n+' ! audioconvert name=muxAudioconvert_'+n+' ! vorbisenc name=muxVorbisenc_'+n+' ! muxOggmux_'+n+'.')
- taglist = self.getTags()
+ taglist = self.getTags(Constants.TYPE_VIDEO)
vorbisEnc = muxline.get_by_name('muxVorbisenc_'+n)
vorbisEnc.merge_tags(taglist, gst.TAG_MERGE_KEEP)
muxBus = muxline.get_bus()
muxBus.add_signal_watch()
- self.MUX_MESSAGE_ID = muxBus.connect('message', self._onMuxedVideoMessageCb)
+ self.VIDEO_TRANSCODE_ID = muxBus.connect('message', self._onMuxedVideoMessageCb, muxline)
self.muxPipes.append(muxline)
#add a listener here to monitor % of transcoding...
- self.VIDEO_TRANSCODE_ID = gobject.timeout_add(self.TRANSCODE_UPDATE_INTERVAL, self._transcodeUpdateCb, muxline)
+ self.TRANSCODE_ID = gobject.timeout_add(self.TRANSCODE_UPDATE_INTERVAL, self._transcodeUpdateCb, muxline)
muxline.set_state(gst.STATE_PLAYING)
else:
self.record = False
@@ -454,15 +453,18 @@ class Glive:
return (position, duration)
- def _onMuxedVideoMessageCb(self, bus, message):
+ def _onMuxedVideoMessageCb(self, bus, message, pipe):
t = message.type
if (t == gst.MESSAGE_EOS):
self.record = False
self.audio = False
- gobject.source_remove( self.VIDEO_TRANSCODE_ID )
+ gobject.source_remove(self.VIDEO_TRANSCODE_ID)
self.VIDEO_TRANSCODE_ID = 0
-
- self.muxPipe().set_state(gst.STATE_NULL)
+ gobject.source_remove(self.TRANSCODE_ID)
+ self.TRANSCODE_ID = 0
+ pipe.set_state(gst.STATE_NULL)
+ pipe.get_bus().disable_sync_message_emission()
+ pipe.get_bus().remove_signal_watch()
wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
oggFilepath = os.path.join(Instance.tmpPath, "output.ogg") #ogv
@@ -478,12 +480,18 @@ class Glive:
def _onMuxedAudioMessageCb(self, bus, message, pipe):
t = message.type
+ record.Record.log.debug("_onMuxedAudioMessageCb " + str(t) + ", " + str(pipe))
if (t == gst.MESSAGE_EOS):
+ record.Record.log.debug("gst.MESSAGE_EOS")
self.record = False
self.audio = False
- gobject.source_remove( self.AUDIO_TRANSCODE_ID )
- self.AUDIO_TRANSCODE_ID = 0
+ gobject.source_remove(self.AUDIO_MUX_MESSAGE_ID)
+ self.AUDIO_MUX_MESSAGE_ID = 0
+ gobject.source_remove(self.TRANSCODE_ID)
+ self.TRANSCODE_ID = 0
pipe.set_state(gst.STATE_NULL)
+ pipe.get_bus().disable_sync_message_emission()
+ pipe.get_bus().remove_signal_watch()
wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
oggFilepath = os.path.join(Instance.tmpPath, "output.ogg")
diff --git a/ui.py b/ui.py
index 44552e7..b807b19 100644
--- a/ui.py
+++ b/ui.py
@@ -1555,6 +1555,9 @@ class UI:
def setPostProcessPixBuf( self, pixbuf ):
+ if (pixbuf.width>160):
+ pixbuf = scale_simple(160, 120, gtk.gdk.INTERP_NEAREST)
+
pixbuf = utils.grayScalePixBuf(pixbuf, True)
img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
self.backgdCanvas.setImage(img)
@@ -1564,8 +1567,7 @@ class UI:
self.photographerNameLabel.set_label( recd.recorderName )
self.nameTextfield.set_text( recd.title )
self.nameTextfield.set_sensitive( True )
- #todo: internationalize the date
- self.dateDateLabel.set_label( strftime( "%a, %b %d, %I:%M:%S %p", time.localtime(recd.time) ) )
+ self.dateDateLabel.set_label( utils.getDateString(recd.time) )
self.photographerPanel.show()
self.namePanel.show()
diff --git a/utils.py b/utils.py
index e116148..a552ddc 100644
--- a/utils.py
+++ b/utils.py
@@ -84,6 +84,11 @@ def scaleSvgToDim( handle, dim ):
return scale
+def getDateString( time ):
+ #todo: internationalize the date
+ return strftime( "%a, %b %d, %I:%M:%S %p", time.localtime(time) )
+
+
def grayScalePixBuf( pb, copy ):
arr = pb.get_pixels_array()
if (copy):