import multimedia
import os
import time
class Mmedia(multimedia.Multimedia):
def __init__(self):
#print "[yylee debug] multimedia init ##"
multimedia.Multimedia.__init__(self)
def audio_play(self, file, vol, loop=False):
#if not os.access('/var/run/vengine.id', os.R_OK):
if loop:
#self.audioplayer(self.AUDIO_PLAYER_CMD_LOOPPLAY, vol, file)
self.mediaplayer(self.MEDIA_PLAYER_CMD_LOOPPLAY, vol, 0, 0, 0, 0, file)
#self.cmd_send(self.MMEDIA_MODE_AUDIO_PLAYER , self.AUDIO_PLAYER_CMD_LOOPPLAY, vol, file)
else:
#self.audioplayer(self.AUDIO_PLAYER_CMD_PLAY, vol, file)
self.mediaplayer(self.MEDIA_PLAYER_CMD_PLAY, vol, 0, 0, 0, 0, file)
#self.cmd_send(self.MMEDIA_MODE_AUDIO_PLAYER , self.AUDIO_PLAYER_CMD_PLAY, vol, file)
def audio_play_sync(self, file, vol):
self.mediaplayer(self.MEDIA_PLAYER_CMD_PLAY_SYNC, vol, 0, 0, 0, 0, file)
def audio_stop(self):
#self.audioplayer(self.AUDIO_PLAYER_CMD_STOP, 0, "null")
self.mediaplayer(self.MEDIA_PLAYER_CMD_STOP, 0, 0, 0, 0, 0, "null")
#self.audioplayer(self.AUDIO_PLAYER_CMD_STOP, 0, 0, 0, 0, 0, "null")
#self.cmd_send(self.MMEDIA_MODE_AUDIO_PLAYER , self.AUDIO_PLAYER_CMD_STOP, 0, "null")
def video_play(self, file, vol, xres, yres, xpos, ypos):
self.mediaplayer(self.MEDIA_PLAYER_CMD_PLAY, vol, xres, yres, xpos, ypos, file)
def video_stop(self):
self.mediaplayer(self.MEDIA_PLAYER_CMD_STOP, 0, 0, 0, 0, 0, "null")
def recorder_preview(self, record_resolution, xres, yres, xpos, ypos):
self.mediarecorder(self.MEDIA_RECORDER_CMD_PREVIEW, record_resolution, xres, yres, xpos, ypos, "null")
def recorder_recordvideo(self, file):
self.mediarecorder(self.MEDIA_RECORDER_CMD_RECORD, self.RECORD_VIDEOCODEC_DEFAULT, self.RECORD_VIDEO_BITRATE_DEFAULT, self.RECORD_AUDIOCODEC_DEFAULT, self.RECORD_AUDIO_BITRATE_DEFAULT, self.RECORD_VIDEO_FRAMERATE_DEFAULT, file)
def recorder_recordaudio(self, file, use_hs_mic=False):
if use_hs_mic:
device = 1
else:
device = 0
#self.mediarecorder(self.MEDIA_RECORDER_CMD_RECORD, self.RECORD_VIDEOCODEC_NONE, 0, self.RECORD_AUDIOCODEC_DEFAULT, self.RECORD_AUDIO_BITRATE_DEFAULT, self.RECORD_VIDEO_FRAMERATE_DEFAULT, file)
self.record_start(self.RECORD_VIDEOCODEC_NONE, 0, self.RECORD_AUDIOCODEC_DEFAULT, self.RECORD_AUDIO_BITRATE_DEFAULT, self.RECORD_VIDEO_FRAMERATE_DEFAULT, device, file)
def get_thumbnail(self, video_file, thumb_file):
self.getthumbnail(self.GETTHUMBNAIL_CMD_GETTHUMBNAIL, 352, 288, video_file, thumb_file)
def still_preview(self, camera_mode, xres, yres, xpos, ypos):
self.stillcapture(self.STILL_CAPTURE_CMD_PREVIEW, camera_mode, xres, yres, xpos, ypos, "null")
def still_capture(self):
self.stillcapture(self.STILL_CAPTURE_CMD_CAPTURE, 0, 0, 0, 0, 0, "null")
def still_save_jpg(self):
self.stillcapture(self.STILL_CAPTURE_CMD_SAVE, self.IMAGE_FORMAT_JPG, 0, 0, 0, 0, '/tmp/ci-capture.jpg')
def still_save_png(self):
self.stillcapture(self.STILL_CAPTURE_CMD_SAVE, self.IMAGE_FORMAT_PNG, 0, 0, 0, 0, '/tmp/ci-capture.png')
def image_file_resize(self, in_file, out_file, width, height):
return self.getthumbnail(self.GETTHUMBNAIL_CMD_GETTHUMBNAIL, width, height, in_file, out_file)
def check_image_isvalid(self, filename):
return self.image_isvalid(filename)
def unload(self):
self.makeidle()
'''
self.makeidle()
self.makeidle()
'''
'''
self.cmd_send(self.MMEDIA_MODE_NONE, 0, 0, "null")
self.cmd_send(self.MMEDIA_MODE_NONE, 0, 0, "null")
self.cmd_send(self.MMEDIA_MODE_NONE, 0, 0, "null")
'''
def HAL_mixer_pause(self):
self.mixer_pause()
def HAL_mixer_resume(self):
self.mixer_resume()