libcvd-members
[Top][All Lists]
Advanced

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

Re: [libcvd-members] libcvd cvd/OSX/qtbuffer.h cvd_src/OSX/qtbuffer.cpp


From: Gerhard Reitmayr
Subject: Re: [libcvd-members] libcvd cvd/OSX/qtbuffer.h cvd_src/OSX/qtbuffer.cpp
Date: Mon, 14 Jan 2008 23:23:54 +0000

I know the problem, here is the solution. You have to tell OSX that the application uses the Carbon API. This is done by adding an entry into resource fork of the binary. Finally I found some explanation for that here:
http://developer.apple.com/technotes/tn/tn2013.html (very end)

create a text file with the following contents:

data 'carb' (0) {};

then call Rez to write the resource to your binary:

/Developer/Tools/Rez resourcefile.r -o binary

/Developer/Tools/DeRez binary
will show you the results.

Now the dialog behaves like a real window and you even get an empty menu bar for your app and it appears in task switching etc. (but the main window will be an X window (if you use X) and belong to the X11 app :)

Gerhard


On 14 Jan 2008, at 17:47, Georg Klein wrote:

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Georg Klein <georgklein>  08/01/14 17:47:15

Modified files:
        cvd/OSX        : qtbuffer.h
        cvd_src/OSX    : qtbuffer.cpp

Log message:
Added a settingsdialog option to QTBuffer, so that a settings dialog appears before video capture starts. This lets you choose video input, sharpness etc. Since I have no idea how to program OSX, this a bit broken, in that the supposedly modal dialog appears behind other windows, and cannot be
        moved or raised. Sweet!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/OSX/qtbuffer.h? cvsroot=libcvd&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/OSX/qtbuffer.cpp? cvsroot=libcvd&r1=1.2&r2=1.3

Patches:
Index: cvd/OSX/qtbuffer.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/OSX/qtbuffer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cvd/OSX/qtbuffer.h  7 Dec 2007 15:02:08 -0000       1.2
+++ cvd/OSX/qtbuffer.h  14 Jan 2008 17:47:15 -0000      1.3
@@ -95,7 +95,7 @@
                * @param mode color palette to use (not supported yet)
                * @param which camera to open (not supported yet)
                */
- RawQT(const ImageRef & size, unsigned int mode, unsigned int num = 0); + RawQT(const ImageRef & size, unsigned int mode, unsigned int num = 0, bool showSettingsDialog=false);
         virtual ~RawQT();

                /** Get the width in pixels of the captured frames. */
@@ -135,7 +135,7 @@
 public:
     /// Construct a video buffer
     /// @param dev file name of the device to use
- QTBuffer(const ImageRef & size, unsigned int number = 0 ) : RawQT( size, 0, number ) {} + QTBuffer(const ImageRef & size, unsigned int number = 0, bool showSettingsDialog=false ) : RawQT( size, 0, number, showSettingsDialog ) {}
        
     virtual ImageRef size()
     {

Index: cvd_src/OSX/qtbuffer.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/OSX/qtbuffer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cvd_src/OSX/qtbuffer.cpp    7 Dec 2007 15:02:08 -0000       1.2
+++ cvd_src/OSX/qtbuffer.cpp    14 Jan 2008 17:47:15 -0000      1.3
@@ -85,7 +85,7 @@
        return err;
 }

-RawQT::RawQT(const ImageRef & size, unsigned int mode, unsigned int num) : pimpl(NULL) +RawQT::RawQT(const ImageRef & size, unsigned int mode, unsigned int num, bool showSettingsDialog) : pimpl(NULL)
 {
        if( !RawQTPimpl::isInitialized ){
                EnterMovies();
@@ -129,6 +129,14 @@
        if(err != noErr){
throw Exceptions::QTBUFFER::DeviceOpen("SGNewChannel returned error");
        }
+       
+       if(showSettingsDialog)
+         {
+ err = SGSettingsDialog(pimpl->seqGrab, pimpl->chanVideo, 0, NULL, 0L, NULL, 0);
+           if(err != noErr)
+ throw Exceptions::QTBUFFER::DeviceOpen("SGSettingsDialog returned an error");
+         }
+
     try {
            err = SGSetChannelBounds(pimpl->chanVideo, &pimpl->bounds);
            if (err != noErr) {


_______________________________________________
libcvd-members mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/libcvd-members

--
Gerhard Reitmayr
MIL, Engineering Department, Cambridge University
http://mi.eng.cam.ac.uk/~gr281/






reply via email to

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