summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/specsfile.c
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-12-13 14:53:02 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-12-13 14:53:02 +0000
commitbfc243a25074f519b994bb34143dc211961ccae0 (patch)
treebd39cbd75e70793b44f12bc43ac6130e7b11ca6f /recordmydesktop/src/specsfile.c
parentdaac9c24a44eac7ba0a7ec292ee05117e06947bb (diff)
doc/recordmydesktop.1: added documentation about -restore option
include/rmdfunc.h: read and write specs file function protorypes include/rmdtypes.h, src/cache_audio.c src/capture_sound.c, src/encode_sound_buffer.c, src/initialize_data.c, src/load_cache.c: framesize moved to pdata struct(used to be initialized separately by every function that used it). src/Makefile.am: added src/rmd_restore.c src/parseargs.c: handle -restore option src/recordmydesktop.c: argument parsing moved before any X calls (restore doesn't need a running X server) src/rmd_restore.c: initialize all needed structs and data, for restore to be performed. Then EncodeCache routine and exit. src/specsfile.c: read and write specs file function bodies git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@474 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src/specsfile.c')
-rw-r--r--recordmydesktop/src/specsfile.c148
1 files changed, 110 insertions, 38 deletions
diff --git a/recordmydesktop/src/specsfile.c b/recordmydesktop/src/specsfile.c
index 09c0f25..89b50d8 100644
--- a/recordmydesktop/src/specsfile.c
+++ b/recordmydesktop/src/specsfile.c
@@ -24,48 +24,17 @@
* For further information contact me at johnvarouhakis@gmail.com *
******************************************************************************/
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+
#include <stdlib.h>
#include <stdio.h>
#include <rmdtypes.h>
-
-int WriteStrOpt(FILE *fp,char *desc,char delim,char *val){
-
-
-
-}
-
-int WriteIntOpt(FILE *fp,char *desc,char delim,int val){
-
-
-
-}
-
-int WriteFloatOpt(FILE *fp,char *desc,char delim,int val){
-
-
-
-}
-
-
-char *ReadStrOpt(FILE *fp,char delim){
-
-
-}
-
-int ReadIntOpt(FILE *fp,char delim){
-
-
-}
-
-float ReadFloatOpt(FILE *fp,char delim){
-
-
-}
-
-
int WriteSpecsFile(ProgData *pdata){
FILE *fp;
@@ -74,8 +43,27 @@ int WriteSpecsFile(ProgData *pdata){
fp=fopen(pdata->cache_data->specsfile,"wb");
if(fp==NULL)
return 1;
-
-
+ else{
+
+ fprintf(fp,"recordMyDesktop = %s\n",VERSION);
+ fprintf(fp,"Width = %d\n",pdata->brwin.rgeom.width);
+ fprintf(fp,"Height = %d\n",pdata->brwin.rgeom.height);
+ fprintf(fp,"Filename = %s\n",pdata->args.filename);
+ fprintf(fp,"FPS = %f\n",pdata->args.fps);
+ fprintf(fp,"NoSound = %d\n",pdata->args.nosound);
+ fprintf(fp,"Frequency = %d\n",pdata->args.frequency);
+ fprintf(fp,"Channels = %d\n",pdata->args.channels);
+ fprintf(fp,"BufferSize = %d\n",pdata->args.buffsize);
+ fprintf(fp,"SoundFrameSize = %d\n",pdata->sound_framesize);
+ fprintf(fp,"PeriodSize = %u\n",pdata->periodsize);
+ fprintf(fp,"UsedJack = %d\n",pdata->args.use_jack);
+ fprintf(fp,"v_bitrate = %d\n",pdata->args.v_bitrate);
+ fprintf(fp,"v_quality = %d\n",pdata->args.v_quality);
+ fprintf(fp,"s_quality = %d\n",pdata->args.s_quality);
+ fprintf(fp,"ZeroCompression = %d\n",pdata->args.zerocompression);
+
+
+ }
fclose(fp);
return 0;
@@ -85,8 +73,92 @@ int WriteSpecsFile(ProgData *pdata){
int ReadSpecsFile(ProgData *pdata){
+ FILE *fp;
+
+ fp=fopen(pdata->cache_data->specsfile,"rb");
+ if(fp==NULL)
+ return 1;
+ else{
+
+ char Cached_Version[256];
+ free(pdata->args.filename);
+ pdata->args.filename=malloc(512);
+
+ //Take that single-point-of-exit advocates !!!
+ //15 points of exit, just for your pleasure.
+ //Also, Vi(m) rules, emacs sucks.
+
+ if(fscanf(fp,"recordMyDesktop = %s\n",Cached_Version)!=1){
+ fprintf(stderr,"Error reading VERSION attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"Width = %d\n",&pdata->brwin.rgeom.width)!=1){
+ fprintf(stderr,"Error reading Width attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"Height = %d\n",&pdata->brwin.rgeom.height)!=1){
+ fprintf(stderr,"Error reading Height attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"Filename = %s\n",pdata->args.filename)!=1){
+ fprintf(stderr,"Error reading Filename attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"FPS = %f\n",&pdata->args.fps)!=1){
+ fprintf(stderr,"Error reading FPS attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"NoSound = %d\n",&pdata->args.nosound)!=1){
+ fprintf(stderr,"Error reading NoSound attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"Frequency = %d\n",&pdata->args.frequency)!=1){
+ fprintf(stderr,"Error reading Frequency attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"Channels = %d\n",&pdata->args.channels)!=1){
+ fprintf(stderr,"Error reading Channels attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"BufferSize = %d\n",&pdata->args.buffsize)!=1){
+ fprintf(stderr,"Error reading BufferSize attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"SoundFrameSize = %d\n",&pdata->sound_framesize)!=1){
+ fprintf(stderr,"Error reading SoundFrameSize attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"PeriodSize = %u\n",&pdata->periodsize)!=1){
+ fprintf(stderr,"Error reading PeriodSize attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"UsedJack = %u\n",&pdata->args.use_jack)!=1){
+ fprintf(stderr,"Error reading UsedJack attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"v_bitrate = %d\n",&pdata->args.v_bitrate)!=1){
+ fprintf(stderr,"Error reading v_bitrate attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"v_quality = %d\n",&pdata->args.v_quality)!=1){
+ fprintf(stderr,"Error reading v_quality attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"s_quality = %d\n",&pdata->args.s_quality)!=1){
+ fprintf(stderr,"Error reading s_quality attribute!!!\n");
+ return 1;
+ }
+ if(fscanf(fp,"ZeroCompression = %d\n",&pdata->args.zerocompression)!=1){
+ fprintf(stderr,"Error reading ZeroCompression attribute!!!\n");
+ return 1;
+ }
+
+
+ }
+ fclose(fp);
+ return 0;
}
© All Rights Reserved