summaryrefslogtreecommitdiff
path: root/rMD-exp
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-30 06:50:09 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-30 06:50:09 +0000
commitc3c54ad55c3ab00b2ce9b4f640e51b1603c41f97 (patch)
tree4b2b2ded41f41eaa1a2b35aa938cf63038a7d1c4 /rMD-exp
parent165b32c9bb99baca19dfe9540fc5276bd41f2df0 (diff)
incremental file naming
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@133 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp')
-rw-r--r--rMD-exp/ChangeLog3
-rw-r--r--rMD-exp/src/init_encoder.c43
-rw-r--r--rMD-exp/src/recordmydesktop.c3
3 files changed, 41 insertions, 8 deletions
diff --git a/rMD-exp/ChangeLog b/rMD-exp/ChangeLog
index e159686..9c15773 100644
--- a/rMD-exp/ChangeLog
+++ b/rMD-exp/ChangeLog
@@ -68,6 +68,9 @@ libogg calls.
*Implemented cache functionality
(Encoding by default happens right after the recording)
*Corrected damage event handling. Now Xv windows are recorded, too.
+*Saving under the same file-name,no longer deletes the previous one,
+instead it saves under a number postfixed file.
+*Opening the sound device doesn't block anymore.
*A few new options were added related to caching.
*Removed uneeded bitmap screenshot function.
diff --git a/rMD-exp/src/init_encoder.c b/rMD-exp/src/init_encoder.c
index 34db2a7..4edfef1 100644
--- a/rMD-exp/src/init_encoder.c
+++ b/rMD-exp/src/init_encoder.c
@@ -27,6 +27,34 @@
#include <recordmydesktop.h>
+int IncrementalNaming(char **name){
+ struct stat buff;
+ char *base_name;
+ int i=0;
+ base_name=malloc(strlen(*name));
+ strcpy(base_name,*name);
+
+ //this will go on an endless loop if you have 65536? files with the same name
+ //or it will crash and die.anyone interested in trying ?
+ while (stat(*name,&buff)==0){
+ //create new name
+ char *tname=malloc(strlen(*name)+10);
+ char numbuf[8];
+
+ strcpy(tname,base_name);
+ strcat(tname,".");
+ I16TOA((++i),numbuf)
+ strcat(tname,numbuf);
+ //save new name
+ free(*name);
+ *name=malloc(strlen(tname)+1);
+ strcpy(*name,tname);
+ free(tname);
+ }
+ free(base_name);
+ return 0;
+}
+
void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){
int y1,y2;
(pdata)->enc_data=enc_data_t;
@@ -38,12 +66,13 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){
ogg_stream_init(&(enc_data_t)->m_ogg_ts,y1);
if(!pdata->args.nosound)
ogg_stream_init(&(enc_data_t)->m_ogg_vs,y2);
-
+
+ IncrementalNaming(&(pdata)->args.filename);
(enc_data_t)->fp=fopen((pdata)->args.filename,"w");
if((enc_data_t)->fp==NULL){
fprintf(stderr,"Cannot open file %s for writting!\n",(pdata)->args.filename);
exit(13);
- }
+ }
theora_info_init(&(enc_data_t)->m_th_inf);
(enc_data_t)->m_th_inf.frame_width=(pdata)->brwin.rgeom.width;
(enc_data_t)->m_th_inf.frame_height=(pdata)->brwin.rgeom.height;
@@ -87,7 +116,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){
vorbis_block_init(&(enc_data_t)->m_vo_dsp,&(enc_data_t)->m_vo_block);
}
-
+
theora_encode_header(&(enc_data_t)->m_th_st,&(enc_data_t)->m_ogg_pckt1);
ogg_stream_packetin(&(enc_data_t)->m_ogg_ts,&(enc_data_t)->m_ogg_pckt1);
if(ogg_stream_pageout(&(enc_data_t)->m_ogg_ts,&(enc_data_t)->m_ogg_pg)!=1){
@@ -109,16 +138,16 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){
ogg_packet header;
ogg_packet header_comm;
ogg_packet header_code;
-
+
vorbis_analysis_headerout(&(enc_data_t)->m_vo_dsp,&(enc_data_t)->m_vo_cmmnt,&header,&header_comm,&header_code);
- ogg_stream_packetin(&(enc_data_t)->m_ogg_vs,&header);
+ ogg_stream_packetin(&(enc_data_t)->m_ogg_vs,&header);
if(ogg_stream_pageout(&(enc_data_t)->m_ogg_vs,&(enc_data_t)->m_ogg_pg)!=1){
fprintf(stderr,"Internal Ogg library error.\n");
exit(2);
}
fwrite((enc_data_t)->m_ogg_pg.header,1,(enc_data_t)->m_ogg_pg.header_len,(enc_data_t)->fp);
fwrite((enc_data_t)->m_ogg_pg.body,1,(enc_data_t)->m_ogg_pg.body_len,(enc_data_t)->fp);
-
+
ogg_stream_packetin(&(enc_data_t)->m_ogg_vs,&header_comm);
ogg_stream_packetin(&(enc_data_t)->m_ogg_vs,&header_code);
}
@@ -167,7 +196,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){
theora_info_clear(&(enc_data_t)->m_th_inf);
}
-
+
diff --git a/rMD-exp/src/recordmydesktop.c b/rMD-exp/src/recordmydesktop.c
index 68d498d..52c33fa 100644
--- a/rMD-exp/src/recordmydesktop.c
+++ b/rMD-exp/src/recordmydesktop.c
@@ -267,7 +267,8 @@ int main(int argc,char **argv){
if(!pdata.args.encOnTheFly){
if(!Aborted){
fprintf(stderr,"Encoding started!\nThis may take several minutes.\n"
- "Pressing Ctrl-C will cancel the procedure (files we be permanetly deleted).\n"
+ "Pressing Ctrl-C will cancel the procedure (resuming will not be possible, but\n"
+ "any portion of the video, which is already encoded won't be deleted).\n"
"Please wait...\n");
pdata.running=1;
InitEncoder(&pdata,&enc_data,1);
© All Rights Reserved