gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11171: Some AmigaOS4 audio/video ch


From: Andrea Palmatè
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11171: Some AmigaOS4 audio/video changes
Date: Sat, 27 Jun 2009 17:26:16 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11171
committer: Andrea Palmatè <address@hidden>
branch nick: gnash
timestamp: Sat 2009-06-27 17:26:16 +0200
message:
  Some AmigaOS4 audio/video changes
modified:
  gui/aos4.cpp
  gui/aos4_agg_glue.cpp
  libsound/aos4/sound_handler_ahi.cpp
=== modified file 'gui/aos4.cpp'
--- a/gui/aos4.cpp      2009-06-22 22:05:53 +0000
+++ b/gui/aos4.cpp      2009-06-27 15:26:16 +0000
@@ -39,6 +39,8 @@
 
 #include <getopt.h>
 
+#include "GnashSleep.h" // for gnashSleep
+
 
 // Use 4MB of stack.. just to be safe
 __attribute__ ((used)) static const char *stackcookie = "$STACK: 4000000";
@@ -60,7 +62,7 @@
 {
        void throw_exception(std::exception const &e)
        {
-               gnash::log_error (_("Exception: %s"), e.what() );
+               gnash::log_error (_("Exception: %s on file %s line %d"), 
e.what(), __FILE__, __LINE__ );
                //std::abort();
        }
 }
@@ -189,12 +191,12 @@
                if (sigGot & _timerSig)
        {
                // Wait until real time catches up with movie time.
+                       IExec->GetMsg(_port);
 
                        int delay = movie_time - OS4_GetTicks();
                        if (delay > 0)
                        {
-                               printf("delay:%d\n",delay);
-                               usleep(delay);
+                               gnashSleep(delay);
                        }
 
                        movie_time += _interval;        // Time next frame 
should be displayed
@@ -602,11 +604,10 @@
 bool
 AOS4Gui::createWindow(const char *title, int width, int height)
 {
-    GNASH_REPORT_FUNCTION;
     _width = width;
     _height = height;
 
-    //_glue.saveOrigiginalDimension(width,height);
+    _glue.saveOrigiginalDimension(width,height);
        _orig_width  = width;
        _orig_height = height;
 
@@ -640,8 +641,6 @@
 void
 AOS4Gui::renderBuffer()
 {
-    //GNASH_REPORT_FUNCTION;
-
     _glue.render();
 }
 
@@ -654,14 +653,12 @@
 bool
 AOS4Gui::createMenu()
 {
-    GNASH_REPORT_FUNCTION;
-    return false;
+    return true;
 }
 
 bool
 AOS4Gui::setupEvents()
 {
-    GNASH_REPORT_FUNCTION;
     return false;
 }
 

=== modified file 'gui/aos4_agg_glue.cpp'
--- a/gui/aos4_agg_glue.cpp     2009-06-22 22:05:53 +0000
+++ b/gui/aos4_agg_glue.cpp     2009-06-27 15:26:16 +0000
@@ -26,7 +26,7 @@
 #include <cerrno>
 #include <ostream>
 
-/* END OF MENU DEFINITION */
+/* START OF MENU DEFINITION */
 struct NewMenu nm[] =
 {
        /* Type, Label, CommKey, Flags, MutualExclude, UserData */
@@ -70,12 +70,10 @@
 _agg_renderer(NULL),
 _fullscreen(FALSE)
 {
-//    GNASH_REPORT_FUNCTION;
 }
 
 AOS4AggGlue::~AOS4AggGlue()
 {
-//    GNASH_REPORT_FUNCTION;
     delete [] _offscreenbuf;
        if (_window) 
        {
@@ -89,8 +87,6 @@
 bool
 AOS4AggGlue::init(int /*argc*/, char*** /*argv*/)
 {
-//    GNASH_REPORT_FUNCTION;
-
     return true;
 }
 
@@ -98,8 +94,6 @@
 render_handler*
 AOS4AggGlue::createRenderHandler(int bpp)
 {
-//    GNASH_REPORT_FUNCTION;
-
     _bpp = bpp;
 
     switch (_bpp) {
@@ -173,7 +167,10 @@
        
     _fullscreen = false;
 
-    resize(_orig_width, _orig_height);
+       _width  = _orig_width;
+       _height = _orig_height;
+
+    resize(_width, _height);
 }
 
 bool
@@ -225,8 +222,6 @@
                        WA_SmartRefresh,        TRUE,
                        WA_RMBTrap,             FALSE,
                        WA_ReportMouse,         TRUE,
-                       WA_MaxWidth,            ~0,
-                       WA_MaxHeight,           ~0,
                        WA_IDCMP,                       IDCMP_MOUSEBUTTONS|
                                                                IDCMP_RAWKEY|
                                                                IDCMP_MOUSEMOVE|
@@ -279,7 +274,12 @@
        ri.RGBFormat    = _ftype;
 
        if (_window)
-               
IP96->p96WritePixelArray(&ri,0,0,_window->RPort,_window->BorderLeft,_window->BorderTop,_width,_height);
+       {
+               if (!_fullscreen)
+                       
IP96->p96WritePixelArray(&ri,0,0,_window->RPort,_window->BorderLeft,_window->BorderTop,_width,_height);
+               else
+                       
IP96->p96WritePixelArray(&ri,0,0,_window->RPort,0,0,_width,_height);
+       }
 
     _validbounds.setTo(0, 0, width, height);
 
@@ -333,17 +333,27 @@
 void
 AOS4AggGlue::render(int minx, int miny, int maxx, int maxy)
 {
+       if (!_window) return;
+       
        // Update only the invalidated rectangle
        struct RenderInfo ri;
        ri.Memory               = _offscreenbuf;
        ri.BytesPerRow = _stride;
        ri.RGBFormat    = _ftype;
 
-       IP96->p96WritePixelArray(&ri,minx , miny, _window->RPort, 
-                                                       
minx+_window->BorderLeft,
-                                                       miny+_window->BorderTop,
-                                                       maxx - minx ,
-                                                       maxy - miny);
+       if (!_fullscreen)
+               IP96->p96WritePixelArray(&ri,minx , miny, _window->RPort, 
+                                                               
minx+_window->BorderLeft,
+                                                               
miny+_window->BorderTop,
+                                                               maxx - minx ,
+                                                               maxy - miny);
+       else
+               IP96->p96WritePixelArray(&ri,minx , miny, _window->RPort, 
+                                                               minx,
+                                                               miny,
+                                                               maxx - minx ,
+                                                               maxy - miny);
+       
 
 /*
        IGraphics->BltBitMapTags(
@@ -363,7 +373,6 @@
 void
 AOS4AggGlue::resize(int width, int height)
 {
-    GNASH_REPORT_FUNCTION;
     if (!_offscreenbuf) {
       // If initialisation has not taken place yet, we don't want to touch 
this.
       return;

=== modified file 'libsound/aos4/sound_handler_ahi.cpp'
--- a/libsound/aos4/sound_handler_ahi.cpp       2009-06-22 22:05:53 +0000
+++ b/libsound/aos4/sound_handler_ahi.cpp       2009-06-27 15:26:16 +0000
@@ -33,6 +33,7 @@
 
 #include "log.h" // will import boost::format too
 #include "GnashException.h" // for SoundException
+#include "GnashSleep.h" // for gnashSleep
 
 //#include <cmath>
 #include <vector>
@@ -134,8 +135,11 @@
     boost::mutex::scoped_lock lock(_mutex);
 
        // on class destruction we must kill the Audio thread
+       _closing = true;
+       _paused = true;
+       IDOS->Delay(80);
        IExec->Signal((struct Task*)AudioPump,SIGBREAKF_CTRL_C);
-
+       
     lock.unlock();
 
     // we already locked, so we call
@@ -192,46 +196,6 @@
 void
 AOS4_sound_handler::closeAudio()
 {
-       if (_closing == false)
-       {
-               _closing = true;
-               log_debug(_("AOS4: Cleaning Audio Stuff.."));
-
-               if (AHIios[0])
-               {
-                       if (!IExec->CheckIO((struct IORequest *) AHIios[0]))
-                       {
-                               IExec->AbortIO((struct IORequest *) AHIios[0]);
-                               IExec->WaitIO((struct IORequest *) AHIios[0]);
-                       }
-               }
-
-               if(AHIios[1])
-               { // Only if the second request was started
-                       if (!IExec->CheckIO((struct IORequest *) AHIios[1]))
-                       {
-                       IExec->AbortIO((struct IORequest *) AHIios[1]);
-                       IExec->WaitIO((struct IORequest *) AHIios[1]);
-                       }
-               }
-
-
-               if(!AHIDevice)
-                       if (AHIio)      IExec->CloseDevice((struct IORequest 
*)AHIio);
-
-               if (AHIio)              
IExec->FreeSysObject(ASOT_IOREQUEST,(struct IORequest *)AHIio); AHIio = 0;
-               if (AHIiocopy)  IExec->FreeMem(AHIiocopy,sizeof(struct 
AHIRequest)); AHIiocopy = 0;
-
-               if (AHImp)              IExec->FreeSysObject(ASOT_PORT, AHImp); 
AHImp = 0;
-
-               if (IAHI)               IExec->DropInterface((struct 
Interface*) IAHI); IAHI = 0;
-
-               if (PlayBuffer[0]) IExec->FreeMem(PlayBuffer[0],BUFSIZE); 
PlayBuffer[0] = 0;
-               if (PlayBuffer[1]) IExec->FreeMem(PlayBuffer[1],BUFSIZE); 
PlayBuffer[1] = 0;
-
-               log_debug(_("AOS4: Exit Audio Thread.."));
-       }
-
     _audioOpened = false;
 }
 
@@ -374,11 +338,19 @@
 void
 AOS4_sound_handler::fetchSamples(boost::int16_t* to, unsigned int nSamples)
 {
-       if (_closing == false)
+       if (!_closing)
        {
            boost::mutex::scoped_lock lock(_mutex);
-       sound_handler::fetchSamples(to, nSamples);
-
+       if (!_closing) 
+       {
+               if (to)
+                       sound_handler::fetchSamples(to, nSamples);
+               else
+                       return;
+       }
+               
+               if (!_closing) return;
+               
            // TODO: move this to base class !
        if (file_stream)
            {
@@ -407,7 +379,7 @@
 AOS4_sound_handler::mix(boost::int16_t* outSamples, boost::int16_t* inSamples, 
unsigned int nSamples, float volume)
 {
     unsigned int nBytes = nSamples*2;
-       if (_closing == false)
+       if (!_closing)
        {
                memcpy(BufferPointer, inSamples, nBytes);
                BufferPointer += nBytes;
@@ -594,6 +566,7 @@
        unsigned int nSamples = (441*clockAdvance) / 10;
        unsigned int toFetch = nSamples*2;
        boost::int16_t samples[AHI_BUF_SIZE];
+    struct Process *_audioTask = ( struct Process *)IExec->FindTask(0);
 
        _closing = false;
 
@@ -679,29 +652,69 @@
 
                uint32 sigGot = IExec->Wait(sigMask);
 
-           if (sigGot & SIGBREAKF_CTRL_C)
-           {
-                       log_debug(_("AOS4: Closing Audio Thread.."));
-                       break;
-               }
                if (sigGot & _timerSig)
        {
+                       IExec->GetMsg(_port);
                        if (_paused == false)
                        {
-                               while (toFetch)
+                               while (toFetch && !_closing)
                                {
                                        unsigned int n = std::min(toFetch, 
AHI_BUF_SIZE);
-                                       fetchSamples((boost::int16_t*)&samples, 
n);
+                                       if (!_closing) 
fetchSamples((boost::int16_t*)&samples, n);
                                        toFetch -= n;
                                }
                                toFetch = nSamples*2;
                        }
-                       TimerReset(RESET_TIME);
+                       if (!_closing) TimerReset(RESET_TIME);
            }
-       }
+           if (sigGot & SIGBREAKF_CTRL_C)
+           {
+                       _closing = true;
+                       log_debug(_("AOS4: Closing Audio Thread.."));
+                       break;
+               }
+       }
+
+       log_debug(_("AOS4: Cleaning Audio Stuff.."));
+
+       if (AHIios[0])
+       {
+               if (!IExec->CheckIO((struct IORequest *) AHIios[0]))
+               {
+                       IExec->AbortIO((struct IORequest *) AHIios[0]);
+                       IExec->WaitIO((struct IORequest *) AHIios[0]);
+               }
+       }
+
+       if(AHIios[1])
+       { // Only if the second request was started
+               if (!IExec->CheckIO((struct IORequest *) AHIios[1]))
+               {
+               IExec->AbortIO((struct IORequest *) AHIios[1]);
+               IExec->WaitIO((struct IORequest *) AHIios[1]);
+               }
+       }
+
+
+       if(!AHIDevice)
+               if (AHIio)      IExec->CloseDevice((struct IORequest *)AHIio);
+
+       if (AHIio)              IExec->FreeSysObject(ASOT_IOREQUEST,(struct 
IORequest *)AHIio); AHIio = 0;
+       if (AHIiocopy)  IExec->FreeMem(AHIiocopy,sizeof(struct AHIRequest)); 
AHIiocopy = 0;
+
+       if (AHImp)              IExec->FreeSysObject(ASOT_PORT, AHImp); AHImp = 
0;
+
+       if (IAHI)               IExec->DropInterface((struct Interface*) IAHI); 
IAHI = 0;
+
+       if (PlayBuffer[0]) IExec->FreeMem(PlayBuffer[0],BUFSIZE); PlayBuffer[0] 
= 0;
+       if (PlayBuffer[1]) IExec->FreeMem(PlayBuffer[1],BUFSIZE); PlayBuffer[1] 
= 0;
+
+       log_debug(_("AOS4: Exit Audio Thread.."));
+
        log_debug(_("AOS4: audioTask:Close timer.."));
        TimerExit();
-       return(0);
+       IDOS->SetIoErr((int32)_audioTask->pr_ProcessID); 
+    return(RETURN_OK);
 }
 
 } // gnash.sound namespace


reply via email to

[Prev in Thread] Current Thread [Next in Thread]