Lines Matching refs:SimpleControl

45 #define BUFFER_VALID(p)        (SimpleControl.readBuffer[p].isValid)
88 static THPSimple SimpleControl; variable
119 memset(&SimpleControl, 0, sizeof(THPSimple)); in THPSimpleInit()
220 if (SimpleControl.open) in THPSimpleOpen()
229 memset(&SimpleControl.videoInfo, 0, sizeof(THPVideoInfo)); in THPSimpleOpen()
230 memset(&SimpleControl.audioInfo, 0, sizeof(THPAudioInfo)); in THPSimpleOpen()
232 if (DVDOpen(fileName, &SimpleControl.fileInfo) == FALSE) in THPSimpleOpen()
241 if (DVDRead(&SimpleControl.fileInfo, WorkBuffer, 64, 0) < 0) in THPSimpleOpen()
246 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
250 memcpy(&SimpleControl.header, WorkBuffer, sizeof(THPHeader)); in THPSimpleOpen()
253 if (strcmp(SimpleControl.header.magic, "THP") != 0) in THPSimpleOpen()
258 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
263 if (SimpleControl.header.version != THP_VERSION) in THPSimpleOpen()
268 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
272 offset = (s32)SimpleControl.header.compInfoDataOffsets; in THPSimpleOpen()
275 if (DVDRead(&SimpleControl.fileInfo, WorkBuffer, 32, offset) < 0) in THPSimpleOpen()
280 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
284 memcpy(&SimpleControl.compInfo, WorkBuffer, sizeof(THPFrameCompInfo)); in THPSimpleOpen()
288 SimpleControl.audioExist = 0; in THPSimpleOpen()
291 for(i = 0 ; i < SimpleControl.compInfo.numComponents ; i++) in THPSimpleOpen()
293 switch(SimpleControl.compInfo.frameComp[i]) in THPSimpleOpen()
296 if (DVDRead(&SimpleControl.fileInfo, WorkBuffer, 32, offset) < 0) in THPSimpleOpen()
301 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
304 memcpy(&SimpleControl.videoInfo, WorkBuffer, sizeof(THPVideoInfo)); in THPSimpleOpen()
308 if (DVDRead(&SimpleControl.fileInfo, WorkBuffer, 32, offset) < 0) in THPSimpleOpen()
313 DVDClose(&SimpleControl.fileInfo); in THPSimpleOpen()
316 memcpy(&SimpleControl.audioInfo, WorkBuffer, sizeof(THPAudioInfo)); in THPSimpleOpen()
317 SimpleControl.audioExist = 1; in THPSimpleOpen()
329 SimpleControl.curOffset = (s32)SimpleControl.header.movieDataOffsets; in THPSimpleOpen()
330 SimpleControl.readSize = (s32)SimpleControl.header.firstFrameSize; in THPSimpleOpen()
331 SimpleControl.readIndex = 0; in THPSimpleOpen()
332 SimpleControl.totalReadFrame = 0; in THPSimpleOpen()
333 SimpleControl.dvdError = FALSE; in THPSimpleOpen()
334 SimpleControl.textureSet.frameNumber = -1; in THPSimpleOpen()
335 SimpleControl.nextDecodeIndex = 0; in THPSimpleOpen()
336 SimpleControl.audioDecodeIndex = 0; in THPSimpleOpen()
337 SimpleControl.audioOutputIndex = 0; in THPSimpleOpen()
338 SimpleControl.preFetchState = FALSE; in THPSimpleOpen()
339 SimpleControl.audioState = FALSE; in THPSimpleOpen()
340 SimpleControl.loop = THP_PLAY_ONESHOT; in THPSimpleOpen()
341 SimpleControl.open = TRUE; in THPSimpleOpen()
342 SimpleControl.curVolume = 127.0f; in THPSimpleOpen()
343 SimpleControl.targetVolume = SimpleControl.curVolume; in THPSimpleOpen()
344 SimpleControl.rampCount = 0; in THPSimpleOpen()
361 if (SimpleControl.open) in THPSimpleClose()
363 if (SimpleControl.preFetchState == FALSE) in THPSimpleClose()
365 if (SimpleControl.audioExist) in THPSimpleClose()
367 if (SimpleControl.audioState == TRUE) in THPSimpleClose()
374 SimpleControl.audioState = FALSE; in THPSimpleClose()
377 if (!SimpleControl.readProgress) in THPSimpleClose()
379 SimpleControl.open = FALSE; in THPSimpleClose()
381 DVDClose(&SimpleControl.fileInfo); in THPSimpleClose()
406 if (SimpleControl.open) in THPSimpleCalcNeedMemory()
409 size = OSRoundUp32B(SimpleControl.header.bufSize) * READ_BUFFER_NUM; in THPSimpleCalcNeedMemory()
412 size += OSRoundUp32B(SimpleControl.videoInfo.xSize * SimpleControl.videoInfo.ySize); //Y in THPSimpleCalcNeedMemory()
413 size += OSRoundUp32B(SimpleControl.videoInfo.xSize * SimpleControl.videoInfo.ySize / 4); //U in THPSimpleCalcNeedMemory()
414 size += OSRoundUp32B(SimpleControl.videoInfo.xSize * SimpleControl.videoInfo.ySize / 4); //V in THPSimpleCalcNeedMemory()
417 if (SimpleControl.audioExist) in THPSimpleCalcNeedMemory()
419 size += (OSRoundUp32B(SimpleControl.header.audioMaxSamples * 4) * AUDIO_BUFFER_NUM); in THPSimpleCalcNeedMemory()
450 if (SimpleControl.open && SimpleControl.preFetchState == FALSE) in THPSimpleSetBuffer()
452 if (SimpleControl.audioState == TRUE) in THPSimpleSetBuffer()
457 ysize = OSRoundUp32B(SimpleControl.videoInfo.xSize * SimpleControl.videoInfo.ySize); in THPSimpleSetBuffer()
458 uvsize = OSRoundUp32B(SimpleControl.videoInfo.xSize * SimpleControl.videoInfo.ySize / 4); in THPSimpleSetBuffer()
463 SimpleControl.textureSet.ytexture = ptr; in THPSimpleSetBuffer()
466 SimpleControl.textureSet.utexture = ptr; in THPSimpleSetBuffer()
469 SimpleControl.textureSet.vtexture = ptr; in THPSimpleSetBuffer()
476 SimpleControl.readBuffer[i].ptr = ptr; in THPSimpleSetBuffer()
477 ptr += OSRoundUp32B(SimpleControl.header.bufSize); in THPSimpleSetBuffer()
478 SimpleControl.readBuffer[i].isValid = FALSE; in THPSimpleSetBuffer()
482 if (SimpleControl.audioExist) in THPSimpleSetBuffer()
486 SimpleControl.audioBuffer[i].buffer = (s16 *)ptr; in THPSimpleSetBuffer()
487 SimpleControl.audioBuffer[i].curPtr = (s16 *)ptr; in THPSimpleSetBuffer()
488 SimpleControl.audioBuffer[i].validSample = 0; in THPSimpleSetBuffer()
489 ptr += OSRoundUp32B(SimpleControl.header.audioMaxSamples * 4); in THPSimpleSetBuffer()
493 SimpleControl.thpWork = (void *)ptr; in THPSimpleSetBuffer()
511 if (!SimpleControl.dvdError && SimpleControl.preFetchState == TRUE) in ReadFrameAsync()
513 if (SimpleControl.totalReadFrame > SimpleControl.header.numFrames - 1) in ReadFrameAsync()
516 if (SimpleControl.loop == THP_PLAY_LOOP) in ReadFrameAsync()
518 SimpleControl.totalReadFrame = 0; in ReadFrameAsync()
519 SimpleControl.curOffset = (s32)SimpleControl.header.movieDataOffsets; in ReadFrameAsync()
520 SimpleControl.readSize = (s32)SimpleControl.header.firstFrameSize; in ReadFrameAsync()
529 SimpleControl.readProgress = TRUE; in ReadFrameAsync()
531 if (DVDReadAsync(&SimpleControl.fileInfo, in ReadFrameAsync()
532 GET_READ_BUFFER(SimpleControl), in ReadFrameAsync()
533 SimpleControl.readSize, in ReadFrameAsync()
534 SimpleControl.curOffset, in ReadFrameAsync()
537 SimpleControl.readProgress = FALSE; in ReadFrameAsync()
538 SimpleControl.dvdError = TRUE; in ReadFrameAsync()
563 SimpleControl.dvdError = TRUE; in __THPSimpleDVDCallback()
572 SimpleControl.readProgress = FALSE; in __THPSimpleDVDCallback()
575 SimpleControl.readBuffer[SimpleControl.readIndex].frameNumber = SimpleControl.totalReadFrame; in __THPSimpleDVDCallback()
577 SimpleControl.totalReadFrame++; in __THPSimpleDVDCallback()
579 SimpleControl.readBuffer[SimpleControl.readIndex].isValid = TRUE; in __THPSimpleDVDCallback()
580 SimpleControl.curOffset += SimpleControl.readSize; in __THPSimpleDVDCallback()
581 SimpleControl.readSize = (s32)NEXT_READ_SIZE(SimpleControl); in __THPSimpleDVDCallback()
582 SimpleControl.readIndex = NEXT_BUFFER(SimpleControl.readIndex); in __THPSimpleDVDCallback()
585 if (!BUFFER_VALID(SimpleControl.readIndex)) in __THPSimpleDVDCallback()
610 if (!BUFFER_VALID(SimpleControl.readIndex) && !SimpleControl.readProgress) in CheckPrefetch()
634 if (SimpleControl.open && (SimpleControl.preFetchState == FALSE)) in THPSimplePreLoad()
640 if (SimpleControl.header.numFrames < READ_BUFFER_NUM) in THPSimplePreLoad()
642 readNum = SimpleControl.header.numFrames; in THPSimplePreLoad()
649 if (DVDRead(&SimpleControl.fileInfo, in THPSimplePreLoad()
650 SimpleControl.readBuffer[SimpleControl.readIndex].ptr, in THPSimplePreLoad()
651 SimpleControl.readSize, in THPSimplePreLoad()
652 SimpleControl.curOffset) < 0) in THPSimplePreLoad()
657 SimpleControl.dvdError = TRUE; in THPSimplePreLoad()
661 SimpleControl.curOffset += SimpleControl.readSize; in THPSimplePreLoad()
662 SimpleControl.readSize = (s32)NEXT_READ_SIZE(SimpleControl); in THPSimplePreLoad()
664 SimpleControl.readBuffer[SimpleControl.readIndex].isValid = TRUE; in THPSimplePreLoad()
665SimpleControl.readBuffer[SimpleControl.readIndex].frameNumber = SimpleControl.totalReadFrame; in THPSimplePreLoad()
667 SimpleControl.readIndex = NEXT_BUFFER(SimpleControl.readIndex); in THPSimplePreLoad()
669 SimpleControl.totalReadFrame++; in THPSimplePreLoad()
671 if (SimpleControl.totalReadFrame > SimpleControl.header.numFrames - 1) in THPSimplePreLoad()
673 if (SimpleControl.loop == THP_PLAY_LOOP) in THPSimplePreLoad()
675 SimpleControl.totalReadFrame = 0; in THPSimplePreLoad()
676 SimpleControl.curOffset = (s32)SimpleControl.header.movieDataOffsets; in THPSimplePreLoad()
677 SimpleControl.readSize = (s32)SimpleControl.header.firstFrameSize; in THPSimplePreLoad()
683 SimpleControl.loop = (u8)loop; in THPSimplePreLoad()
684 SimpleControl.preFetchState = TRUE; in THPSimplePreLoad()
704 SimpleControl.audioState = TRUE; in THPSimpleAudioStart()
721 SimpleControl.audioState = FALSE; in THPSimpleAudioStop()
740 if (SimpleControl.open && (SimpleControl.audioState == FALSE)) in THPSimpleLoadStop()
742 SimpleControl.preFetchState = FALSE; in THPSimpleLoadStop()
745 if (SimpleControl.readProgress) in THPSimpleLoadStop()
747 DVDCancel(&SimpleControl.fileInfo.cb); in THPSimpleLoadStop()
748 SimpleControl.readProgress = FALSE; in THPSimpleLoadStop()
754 SimpleControl.readBuffer[i].isValid = 0; in THPSimpleLoadStop()
759 SimpleControl.audioBuffer[i].validSample = 0; in THPSimpleLoadStop()
762 SimpleControl.textureSet.frameNumber = -1; in THPSimpleLoadStop()
763 SimpleControl.curOffset = (s32)SimpleControl.header.movieDataOffsets; in THPSimpleLoadStop()
764 SimpleControl.readSize = (s32)SimpleControl.header.firstFrameSize; in THPSimpleLoadStop()
765 SimpleControl.readIndex = 0; in THPSimpleLoadStop()
766 SimpleControl.totalReadFrame = 0; in THPSimpleLoadStop()
767 SimpleControl.dvdError = FALSE; in THPSimpleLoadStop()
768 SimpleControl.nextDecodeIndex = 0; in THPSimpleLoadStop()
769 SimpleControl.audioDecodeIndex = 0; in THPSimpleLoadStop()
770 SimpleControl.audioOutputIndex = 0; in THPSimpleLoadStop()
771 SimpleControl.curVolume = SimpleControl.targetVolume; in THPSimpleLoadStop()
772 SimpleControl.rampCount = 0; in THPSimpleLoadStop()
805 if (BUFFER_VALID(SimpleControl.nextDecodeIndex)) in THPSimpleDecode()
807 compSizePtr = (u32 *)(GET_DECODE_BUFFER(SimpleControl) + 8); in THPSimpleDecode()
808 ptr = GET_DECODE_BUFFER(SimpleControl) + SimpleControl.compInfo.numComponents * 4 in THPSimpleDecode()
811 if (SimpleControl.audioExist) in THPSimpleDecode()
813 if (audioTrack < 0 || audioTrack >= SimpleControl.audioInfo.sndNumTracks) in THPSimpleDecode()
822 if (SimpleControl.audioBuffer[SimpleControl.audioDecodeIndex].validSample == 0) in THPSimpleDecode()
824 for (i = 0 ; i < SimpleControl.compInfo.numComponents ; i++) in THPSimpleDecode()
826 switch (SimpleControl.compInfo.frameComp[i]) in THPSimpleDecode()
837 … sample = THPAudioDecode(SimpleControl.audioBuffer[SimpleControl.audioDecodeIndex].buffer, in THPSimpleDecode()
842SimpleControl.audioBuffer[SimpleControl.audioDecodeIndex].validSample = sample; in THPSimpleDecode()
844 SimpleControl.audioBuffer[SimpleControl.audioDecodeIndex].curPtr in THPSimpleDecode()
845 = SimpleControl.audioBuffer[SimpleControl.audioDecodeIndex].buffer; in THPSimpleDecode()
847 SimpleControl.audioDecodeIndex++; in THPSimpleDecode()
848 if (SimpleControl.audioDecodeIndex >= AUDIO_BUFFER_NUM) in THPSimpleDecode()
850 SimpleControl.audioDecodeIndex = 0; in THPSimpleDecode()
868 for (i = 0 ; i < SimpleControl.compInfo.numComponents ; i++) in THPSimpleDecode()
870 switch (SimpleControl.compInfo.frameComp[i]) in THPSimpleDecode()
885 SimpleControl.readBuffer[SimpleControl.nextDecodeIndex].isValid = FALSE; in THPSimpleDecode()
886 SimpleControl.nextDecodeIndex = NEXT_BUFFER(SimpleControl.nextDecodeIndex); in THPSimpleDecode()
916 SimpleControl.textureSet.ytexture, in VideoDecode()
917 SimpleControl.textureSet.utexture, in VideoDecode()
918 SimpleControl.textureSet.vtexture, in VideoDecode()
919 SimpleControl.thpWork); in VideoDecode()
923 SimpleControl.textureSet.frameNumber in VideoDecode()
924 = SimpleControl.readBuffer[SimpleControl.nextDecodeIndex].frameNumber; in VideoDecode()
951 if (SimpleControl.textureSet.frameNumber >= 0) in THPSimpleDrawCurrentFrame()
954 THPGXYuv2RgbDraw( SimpleControl.textureSet.ytexture, in THPSimpleDrawCurrentFrame()
955 SimpleControl.textureSet.utexture, in THPSimpleDrawCurrentFrame()
956 SimpleControl.textureSet.vtexture, in THPSimpleDrawCurrentFrame()
958 (s16)SimpleControl.videoInfo.xSize, (s16)SimpleControl.videoInfo.ySize, in THPSimpleDrawCurrentFrame()
962 return (s32)SimpleControl.textureSet.frameNumber; in THPSimpleDrawCurrentFrame()
990 if (SimpleControl.open && (SimpleControl.audioState == TRUE) && SimpleControl.audioExist) in MixAudio()
998 if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample) in MixAudio()
1000 … if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample >= requestSample) in MixAudio()
1006 … sampleNum = SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample; in MixAudio()
1009 thpsrc = SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].curPtr; in MixAudio()
1014 if (SimpleControl.rampCount) in MixAudio()
1016 SimpleControl.rampCount--; in MixAudio()
1017 SimpleControl.curVolume += SimpleControl.deltaVolume; in MixAudio()
1021 SimpleControl.curVolume = SimpleControl.targetVolume; in MixAudio()
1024 attenuation = VolumeTable[(s32)SimpleControl.curVolume]; in MixAudio()
1063SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample -= sampleNum; in MixAudio()
1064 SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].curPtr = thpsrc; in MixAudio()
1066 if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample == 0) in MixAudio()
1068 SimpleControl.audioOutputIndex++; in MixAudio()
1069 if (SimpleControl.audioOutputIndex >= AUDIO_BUFFER_NUM) in MixAudio()
1071 SimpleControl.audioOutputIndex = 0; in MixAudio()
1094 if (SimpleControl.open && (SimpleControl.audioState == TRUE) && SimpleControl.audioExist) in MixAudio()
1101 if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample) in MixAudio()
1103 … if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample >= requestSample) in MixAudio()
1109 … sampleNum = SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample; in MixAudio()
1112 thpsrc = SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].curPtr; in MixAudio()
1117 if (SimpleControl.rampCount) in MixAudio()
1119 SimpleControl.rampCount--; in MixAudio()
1120 SimpleControl.curVolume += SimpleControl.deltaVolume; in MixAudio()
1124 SimpleControl.curVolume = SimpleControl.targetVolume; in MixAudio()
1127 attenuation = VolumeTable[(s32)SimpleControl.curVolume]; in MixAudio()
1164SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample -= sampleNum; in MixAudio()
1165 SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].curPtr = thpsrc; in MixAudio()
1167 if (SimpleControl.audioBuffer[SimpleControl.audioOutputIndex].validSample == 0) in MixAudio()
1169 SimpleControl.audioOutputIndex++; in MixAudio()
1170 if (SimpleControl.audioOutputIndex >= AUDIO_BUFFER_NUM) in MixAudio()
1172 SimpleControl.audioOutputIndex = 0; in MixAudio()
1209 if (SimpleControl.open) in THPSimpleGetVideoInfo()
1211 memcpy(videoInfo, &SimpleControl.videoInfo, sizeof(THPVideoInfo)); in THPSimpleGetVideoInfo()
1231 if (SimpleControl.open) in THPSimpleGetAudioInfo()
1233 memcpy(audioInfo, &SimpleControl.audioInfo, sizeof(THPAudioInfo)); in THPSimpleGetAudioInfo()
1254 if (SimpleControl.open) in THPSimpleGetFrameRate()
1257 return SimpleControl.header.frameRate; in THPSimpleGetFrameRate()
1276 if (SimpleControl.open) in THPSimpleGetTotalFrame()
1278 return SimpleControl.header.numFrames; in THPSimpleGetTotalFrame()
1372 if (SimpleControl.open && SimpleControl.audioExist) in THPSimpleSetVolume()
1405 SimpleControl.targetVolume = (f32)vol; in THPSimpleSetVolume()
1409 SimpleControl.rampCount = samplePerMs * time; in THPSimpleSetVolume()
1410 SimpleControl.deltaVolume = (SimpleControl.targetVolume - SimpleControl.curVolume) in THPSimpleSetVolume()
1411 / (f32)SimpleControl.rampCount; in THPSimpleSetVolume()
1415 SimpleControl.rampCount = 0; in THPSimpleSetVolume()
1416 SimpleControl.curVolume = SimpleControl.targetVolume; in THPSimpleSetVolume()
1440 if (SimpleControl.open) in THPSimpleGetVolume()
1442 return (s32)SimpleControl.curVolume; in THPSimpleGetVolume()