added a labelbutton that displays the selected avi/quicktime codec.
authorRob Haarsma <phaseIV@zonnet.nl>
Fri, 9 May 2003 11:24:55 +0000 (11:24 +0000)
committerRob Haarsma <phaseIV@zonnet.nl>
Fri, 9 May 2003 11:24:55 +0000 (11:24 +0000)
source/blender/include/BIF_interface.h
source/blender/include/BIF_writeavicodec.h
source/blender/quicktime/apple/quicktime_export.c
source/blender/quicktime/quicktime_export.h
source/blender/src/buttons.c
source/blender/src/usiblender.c
source/blender/src/writeavicodec.c

index 0b57955be79fff437438acd34a64f435394d4473..1ca049bb8ce4312620845a38936dfe0bba6a4c2a 100644 (file)
@@ -83,6 +83,13 @@ uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, short x1, s
 uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  char *tip);
 uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  char *tip);
 
+uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  char *tip);
+
+uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  char *tip);
+uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  char *tip);
+uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  char *tip);
+uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  char *tip);
+
 typedef void           (*uiIDPoinFuncFP)       (char *str, struct ID **idpp);
 void uiDefIDPoinBut(struct uiBlock *block,
                                                uiIDPoinFuncFP func, int retval, char *str,
@@ -93,6 +100,8 @@ void uiDefIDPoinBut(struct uiBlock *block,
 typedef uiBlock* (*uiBlockFuncFP)      (void *arg1);
 void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
 
+void uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, int icon, short x1, short y1, short x2, short y2, char *tip);
+
 void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
 
 void uiAutoBlock(struct uiBlock *block, 
index ff347fe494cc537e8871d7643ce4c3f93aee9632..98f7281644f4ee5a0f5b2ce3f3fbae121dea21ea 100644 (file)
@@ -40,5 +40,7 @@ void append_avi_codec(int frame);
 void end_avi_codec(void);
 int get_avicodec_settings(void);
 
+extern int have_avicodec;
+extern char avicdname[128];
 #endif
 
index 5863a5339005fde0f9786e2cf6dd48f2d1f1f98c..29734ae13da85f37c16d6b9860397a047fcd20c1 100644 (file)
@@ -88,6 +88,7 @@ DONE:
 #include <TextUtils.h> 
 #include <Movies.h>
 #include <QuicktimeComponents.h>
+#include <MoviesFormat.h>
 #endif /* _WIN32 */
 
 #ifdef __APPLE__
@@ -169,7 +170,8 @@ struct _QuicktimeCodecDataExt *qcdx;
 
 static int sframe;
 
-int have_qtcodec;
+int            have_qtcodec;
+char   qtcdname[64];
 
 /************************************************************
 *                                                           *
@@ -566,15 +568,16 @@ static void check_renderbutton_framerate(void) {
 int get_qtcodec_settings(void) 
 {
        OSErr   err = noErr;
-//     Component c = 0;
-//     ComponentDescription cd;
+       Component c = 0;
+       ComponentDescription cd;
+       CodecInfo ci;
+
+       cd.componentType = StandardCompressionType;
+       cd.componentSubType = StandardCompressionSubType;
+       cd.componentManufacturer = 0;
+       cd.componentFlags = 0;
+       cd.componentFlagsMask = 0;
 
-//     cd.componentType = StandardCompressionType;
-//     cd.componentSubType = StandardCompressionSubType;
-//     cd.componentManufacturer = 0;
-//     cd.componentFlags = 0;
-//     cd.componentFlagsMask = 0;
-Handle                     *theText;
 
        if(qcdx == NULL) {
                qcdx = MEM_callocN(sizeof(QuicktimeCodecDataExt), "QuicktimeCodecDataExt");
@@ -584,18 +587,18 @@ Handle                     *theText;
        // configure the standard image compression dialog box
 
        if (qcdx->theComponent == NULL) {
-               qcdx->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
-//             c = FindNextComponent(c, &cd);
-//             qcdx->theComponent = OpenComponent(c);
+//             qcdx->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
+               c = FindNextComponent(c, &cd);
+               qcdx->theComponent = OpenComponent(c);
 
-               qcdx->gSpatialSettings.codecType = nil;     
+//             qcdx->gSpatialSettings.codecType = nil;     
                qcdx->gSpatialSettings.codec = anyCodec;         
 //             qcdx->gSpatialSettings.depth;         
                qcdx->gSpatialSettings.spatialQuality = codecMaxQuality;
 
                qcdx->gTemporalSettings.temporalQuality = codecMaxQuality;
 //             qcdx->gTemporalSettings.frameRate;      
-               qcdx->gTemporalSettings.keyFrameRate = 24;   
+               qcdx->gTemporalSettings.keyFrameRate = 25;   
 
                qcdx->aDataRateSetting.dataRate = 90 * 1024;          
 //             qcdx->aDataRateSetting.frameDuration;     
@@ -612,12 +615,13 @@ Handle                     *theText;
        }
 
        check_renderbutton_framerate();
-
        // put up the dialog box
 
        err = SCRequestSequenceSettings(qcdx->theComponent);
 
-       if (err == scUserCancelled) {
+   if (err == scUserCancelled) {
                G.afbreek = 1;
                return 0;
        }
@@ -630,9 +634,8 @@ Handle                     *theText;
        SCGetInfo(qcdx->theComponent, scSpatialSettingsType,    &qcdx->gSpatialSettings);
        SCGetInfo(qcdx->theComponent, scDataRateSettingsType,   &qcdx->aDataRateSetting);
 
-//GraphicsExportGetSettingsAsText (qcdx->theComponent,theText );
-
-//printf("%s\n", theText);
+       GetCodecInfo (&ci, qcdx->gSpatialSettings.codecType, 0);
+       sprintf(qtcdname,"Codec: %s", p2cstr(ci.typeName));
 
        // framerate jugglin'
 
index fd2bfbfd577273e7ee2d85a546de9036a56a5612..8d9d4a835d6b09f702582bdf475aa4d7dd6367aa 100644 (file)
@@ -46,6 +46,7 @@ void free_qtcodecdataExt(void);                       //usiblender.c
 void makeqtstring (char *string);              //for playanim.c
 
 extern int have_qtcodec;
+extern char qtcdname[64];
 
 #endif //(_WIN32) || (__APPLE__)
 
index 5c467a8dcd4c3d3a6b2e5b5975d24f848a3a287a..88ebcbff84153d60dcbd5a84654fff9e6d4016af 100644 (file)
@@ -6577,7 +6577,11 @@ void renderbuts(void)
                if(G.scene->r.imtype == R_QUICKTIME) {
 #ifdef WITH_QUICKTIME
 #if defined (_WIN32) || defined (__APPLE__)
-                       uiDefBut(block, BUT,B_SELECTCODEC, "Codec settings",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime Codec");
+                       if(!have_qtcodec)
+                               uiDefBut(block, LABEL, 0, "Codec: undefined",  892,yofs+42,225,20, 0, 0, 0, 0, 0, "");
+                       else
+                               uiDefBut(block, LABEL, 0, qtcdname,  892,yofs+42,225,20, 0, 0, 0, 0, 0, "");
+                       uiDefBut(block, BUT,B_SELECTCODEC, "Set codec",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime");
 #else /* libquicktime */
                        if (!G.scene->r.qtcodecdata) G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), "QtCodecData");
                        uiDefButI(block, MENU, B_SELECTCODEC, qtcodecs_pup(), 892,yofs, 112, 20, &qtcodec_idx, 0, 0, 0, 0, "Codec");
@@ -6595,7 +6599,11 @@ void renderbuts(void)
 #endif /* libquicktime */
 #endif /* WITH_QUICKTIME */
                } else {
-                       uiDefBut(block, BUT,B_SELECTCODEC, "Codec settings",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI Codec");
+                       if(!have_avicodec)
+                               uiDefBut(block, LABEL, 0, "Codec: not set.",  892,yofs+42,225,20, 0, 0, 0, 0, 0, "");
+                       else
+                               uiDefBut(block, LABEL, 0, avicdname,  892,yofs+42,225,20, 0, 0, 0, 0, 0, "");
+                       uiDefBut(block, BUT,B_SELECTCODEC, "Set codec",  892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI");
                }
        } else {
                uiDefButS(block, NUM,0, "Quality:",           892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies");
index 8b3254c346b06dd2eff8fdfe9e6f509d3458f7ac..c366af6992dd3364d578aaa3d1b0ae434236b55f 100644 (file)
@@ -227,16 +227,8 @@ int BIF_read_homefile(void)
                        U.fontsize= 12;
                        U.encoding= 0;
                        sprintf(U.fontname, ".bfont.ttf");
-                       if( FTF_SetFont(".bfont.ttf", 12) ) {
-                               FTF_SetLanguage("en");
-                               FTF_SetEncoding("ASCII");
-                               G.ui_international = TRUE;
-                       } else {
-                               G.ui_international = FALSE;
-                       }
                }
 */
-
                if(U.transopts & TR_ALL)
                        set_ML_interface_font();
                else
index cb3e98746be4f4192210fa845a5582cb1cad42b5..95d69daaafb65c3488418658c9e7f8696d284f70 100644 (file)
@@ -64,6 +64,8 @@
 // the output video stream
 
 AVICOMPRESSOPTIONS opts;
+char avicdname[128];
+int have_avicodec= 0;
 
 static int sframe;
 static PAVIFILE pfile = NULL;
@@ -345,7 +347,7 @@ HRESULT STDMETHODCALLTYPE AVIBallReadFormat   (PAVISTREAM ps, LONG lPos,LPVOID l
        */
        
     *lpcbFormat = sizeof(BITMAPINFOHEADER);
-       
+
     return AVIERR_OK;
 }
 
@@ -767,6 +769,8 @@ int get_avicodec_settings(void)
        AVICOMPRESSOPTIONS *aopts[1] = {&opts};
        AviCodecData *acd = G.scene->r.avicodecdata;
        static PAVISTREAM psdummy;
+       HIC hic;
+       ICINFO icinfo;
 
        acd_to_opts(G.scene->r.avicodecdata);
 
@@ -777,12 +781,27 @@ int get_avicodec_settings(void)
        } else {
                if (!AVISaveOptions(NULL,
                                ICMF_CHOOSE_KEYFRAME | ICMF_CHOOSE_DATARATE,
+//                             ICMF_CHOOSE_ALLCOMPRESSORS,
                                1,
                                &psdummy,
                                (LPAVICOMPRESSOPTIONS *) &aopts))
                {
                        ret_val = 1;
                } else {
+                       have_avicodec = 1;
+
+                       if ((hic=ICOpen(ICTYPE_VIDEO,opts.fccHandler,ICMODE_QUERY))!=NULL) {
+                               icinfo.dwSize=sizeof(ICINFO);
+                               if (ICGetInfo(hic,&icinfo,sizeof(ICINFO))) {
+                                       WideCharToMultiByte(CP_ACP,0,icinfo.szDescription,-1,avicdname,128,NULL,NULL);
+                               } else
+                                       sprintf(avicdname, "undefined");
+                               if (ICClose(hic)!=ICERR_OK)
+                                       return 0;
+                       } else {
+                               sprintf(avicdname, "Full Frames (Uncompressed)");       //heh, nasty
+                       }
+       
                        if (acd) {
                                free_avicodecdata(acd);
                        } else {