[xiph-cvs] cvs commit: ogg-tools/oggsplit AUTHORS ChangeLog README common.c common.h oggsplit.1 oggsplit.c output.c output.h stream.c stream.h
Ralph Giles
giles at xiph.org
Fri Aug 8 10:50:56 PDT 2003
giles 03/08/08 13:50:56
Modified: oggsplit AUTHORS ChangeLog README common.c common.h
oggsplit.1 oggsplit.c output.c output.h stream.c
stream.h
Log:
Update from Philip Jägenstedt. See ChangeLog for details.
Revision Changes Path
1.2 +1 -1 ogg-tools/oggsplit/AUTHORS
Index: AUTHORS
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/AUTHORS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AUTHORS 6 Aug 2003 11:08:11 -0000 1.1
+++ AUTHORS 8 Aug 2003 17:50:55 -0000 1.2
@@ -1 +1 @@
-Philip Jägenstedt <philipj at telia.com>
+Philip Jägenstedt <philipj at telia.com>
<p><p>1.2 +9 -3 ogg-tools/oggsplit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLog 6 Aug 2003 11:08:11 -0000 1.1
+++ ChangeLog 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,4 +1,10 @@
-2003-08-05 Philip Jägenstedt <philipj at telia.com>
-
- * oggsplit: initial version 0.1.0.
+oggsplit (0.1.1)
+ * changed how the output filenames are calculated. Now any suffix of
+ length 4 or less is stripped out and used (might be good for .spx).
+ * output files are now placed in CWD by default, instead of the same dir
+ as input files.
+ * changed source files and docs (not the man page) to use UTF-8 encoding.
+ * removed use of autoproject's system.h and xmalloc.c
+oggsplit (0.1.0)
+ * initial version.
<p><p>1.2 +3 -1 ogg-tools/oggsplit/README
Index: README
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- README 6 Aug 2003 11:08:11 -0000 1.1
+++ README 8 Aug 2003 17:50:55 -0000 1.2
@@ -7,8 +7,10 @@
grouped, for example the video and audio streams in a theora+vorbis
file.
+ For build and install instructions, see INSTALL.
+
See the manfile (man oggsplit) for usage information.
Comments and bugfixes are welcome.
- - Philip Jägenstedt <philipj at telia.com>
+ - Philip Jägenstedt <philipj at telia.com>
<p><p>1.2 +2 -11 ogg-tools/oggsplit/common.c
Index: common.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- common.c 7 Aug 2003 08:45:39 -0000 1.1
+++ common.c 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,22 +1,13 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#include <stdlib.h>
#include <stdio.h>
<p><p>1.2 +2 -11 ogg-tools/oggsplit/common.h
Index: common.h
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/common.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- common.h 7 Aug 2003 08:45:39 -0000 1.1
+++ common.h 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,22 +1,13 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef _XMALLOC_H
#define _XMALLOC_H
<p><p>1.2 +6 -13 ogg-tools/oggsplit/oggsplit.1
Index: oggsplit.1
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/oggsplit.1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- oggsplit.1 7 Aug 2003 08:45:39 -0000 1.1
+++ oggsplit.1 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,19 +1,11 @@
-.\" hey, Emacs: -*- nroff -*-
+.\" -*- nroff -*-
+
.\" oggsplit is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
-.\"
-.\" This program is distributed in the hope that it will be useful,
-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.\" GNU General Public License for more details.
-.\"
-.\" You should have received a copy of the GNU General Public License
-.\" along with this program; see the file COPYING. If not, write to
-.\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-.\"
-.TH oggsplit 1 "August 4, 2003"
+
+.TH oggsplit 1 "August 7, 2003"
.\" Please update the above date whenever this man page is modified.
.SH NAME
@@ -56,7 +48,8 @@
processed, and the names of the output files will be slightly simpler.
.TP
.BI "-o, --outdir " "<directory>"
-Create all output files in the specified directory.
+Create all output files in the specified directory. The default is to create
+all output files in the current directory.
.TP
.B \-V, \-\-version
Show oggsplit version.
<p><p>1.3 +21 -33 ogg-tools/oggsplit/oggsplit.c
Index: oggsplit.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/oggsplit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- oggsplit.c 7 Aug 2003 08:45:39 -0000 1.2
+++ oggsplit.c 8 Aug 2003 17:50:55 -0000 1.3
@@ -1,7 +1,7 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#include <stdio.h>
#include <getopt.h>
@@ -57,8 +57,6 @@
static void usage(void)
{
fprintf(stderr,
- "OggSplit %s\n"
- "(c) 2003 Philip Jägenstedt <philipj at telia.com>\n\n"
"Usage: oggsplit [options] input_files [...]\n"
"Supported options:\n"
" -c --unchain Only split chained streams. The default is to\n"
@@ -82,8 +80,8 @@
static int process_file(const char *pathname)
{
- char *dirname, *filename, *slash;
- int dirname_len;
+ int i;
+ char *filename;
FILE *infile;
@@ -109,24 +107,25 @@
return 0;
}
- /* split out dirname and basename */
- slash=strrchr(pathname, '/');
- if(slash==NULL)
- slash=(char *)(pathname-1);
- dirname_len=slash-pathname+1;
+ /* take out the path section from pathname */
+ for(i=strlen(pathname)-1; i>=0; i--){
+ if(pathname[i]=='/'){
+ i++;
+ break;
+ }
+ }
+
if(outdir!=NULL){
- dirname=xstrdup(outdir);
+ filename=xmalloc(strlen(outdir)+strlen(&pathname[i])+2);
+ strcpy(filename, outdir);
+ filename[strlen(outdir)]='/';
+ strcpy(&filename[strlen(outdir)+1], &pathname[i]);
}else{
- dirname=xmalloc(dirname_len+1);
- if(dirname_len)
- strncpy(dirname, pathname, dirname_len);
- dirname[dirname_len]='\0';
+ filename=xstrdup(&pathname[i]);
}
- filename=xmalloc(strlen(pathname)-dirname_len+1);
- strcpy(filename, slash+1);
stream_ctrl_init(&sc);
- output_ctrl_init(&oc, dirname, filename);
+ output_ctrl_init(&oc, filename);
ogg_sync_init(&oy);
@@ -232,7 +231,6 @@
" transfer or an aborted encoding process.\n\n%s",
sc.streams_used, filename, broken_ogg);
- free(dirname);
free(filename);
output_ctrl_free(&oc);
@@ -246,8 +244,8 @@
int main(int argc, char **argv)
{
DIR *test;
- int c, outdir_len;
+ int c;
while((c=getopt_long(argc,argv,optstring,options,NULL))!=EOF){
switch(c){
case 'c':
@@ -264,16 +262,8 @@
}
closedir(test);
- outdir_len=strlen(optarg)+2;
- if(outdir==NULL)
- outdir=xmalloc(outdir_len);
- else
- outdir=xrealloc(outdir, outdir_len);
- strcpy(outdir, optarg);
- if(outdir[outdir_len-3]!='/'){
- outdir[outdir_len-2]='/';
- outdir[outdir_len-1]='\0';
- }
+ if(outdir!=NULL)free(outdir);
+ outdir=xstrdup(optarg);
break;
case 'V':
printf("OggSplit %s\n", VERSION);
@@ -305,8 +295,6 @@
printf("\n");
}
- printf("Done\n");
-
if(outdir!=NULL)free(outdir);
return 0;
<p><p>1.3 +30 -32 ogg-tools/oggsplit/output.c
Index: output.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/output.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- output.c 7 Aug 2003 08:45:39 -0000 1.2
+++ output.c 8 Aug 2003 17:50:55 -0000 1.3
@@ -1,32 +1,25 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#include <stdio.h>
#include <errno.h>
+#include <string.h>
#include "output.h"
#include "common.h"
-int output_ctrl_init(output_ctrl_t *oc,
- char *dirname, char *filename)
+int output_ctrl_init(output_ctrl_t *oc, char *filename)
{
+ int fnlen, i;
+
/* Begin with 8 (output_t *):s
* We are using an array of (output_t *) instead of just output_t since the
* address of the output_t objects musn't change (they are referenced
@@ -34,19 +27,25 @@
*/
oc->outputs=xmalloc(sizeof(output_t *)*8);
- oc->dirname=xstrdup(dirname);
+ oc->idcount=0;
+ oc->outputs_size=8;
+ oc->outputs_used=0;
- oc->basename=xstrdup(filename);
+ oc->basename=NULL;
+ oc->suffix=NULL;
- /* FIXME: come up with a more portable solution */
- /* strip .ogg extension if it's there */
- if(strcasecmp((oc->basename+strlen(oc->basename)-4), ".ogg")==0){
- oc->basename[strlen(oc->basename)-4]='\0';
+ fnlen=strlen(filename);
+ for(i=fnlen-1; i>fnlen-6; i--){
+ if(filename[i]=='.'){
+ oc->basename=xmalloc(i+1);
+ strncpy(oc->basename, filename, i+1);
+ oc->basename[i]='\0';
+ oc->suffix=xstrdup(&filename[i]);
+ }
}
- oc->idcount=0;
- oc->outputs_size=8;
- oc->outputs_used=0;
+ if(oc->basename==NULL)oc->basename=xstrdup(filename);
+ if(oc->suffix==NULL)oc->suffix=xstrdup(".ogg");
return 1;
}
@@ -61,7 +60,6 @@
}
free(oc->outputs);
- free(oc->dirname);
free(oc->basename);
return 1;
@@ -80,24 +78,24 @@
op=xmalloc(sizeof(output_t));
- fnlen=strlen(oc->dirname)+strlen(oc->basename)+16;
+ fnlen=strlen(oc->basename)+strlen(oc->suffix)+16;
op->filename=xmalloc(fnlen);
while(1){
if(chain_c)
if(group_c)
- fnret=snprintf(op->filename, fnlen, "%s%s.c%02d.g%02d.ogg",
- oc->dirname, oc->basename, chain_c, group_c);
+ fnret=snprintf(op->filename, fnlen, "%s.c%02d.g%02d%s",
+ oc->basename, chain_c, group_c, oc->suffix);
else
- fnret=snprintf(op->filename, fnlen, "%s%s.c%02d.ogg",
- oc->dirname, oc->basename, chain_c);
+ fnret=snprintf(op->filename, fnlen, "%s.c%02d%s",
+ oc->basename, chain_c, oc->suffix);
else
if(group_c)
- fnret=snprintf(op->filename, fnlen, "%s%s.g%02d.ogg",
- oc->dirname, oc->basename, group_c);
+ fnret=snprintf(op->filename, fnlen, "%s.g%02d%s",
+ oc->basename, group_c, oc->suffix);
else
- fnret=snprintf(op->filename, fnlen, "%s%s.junk",
- oc->dirname, oc->basename);
+ fnret=snprintf(op->filename, fnlen, "%s.junk%s",
+ oc->basename, oc->suffix);
if(fnret>=fnlen){
/* try again and get it right this time */
<p><p>1.2 +4 -14 ogg-tools/oggsplit/output.h
Index: output.h
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/output.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- output.h 6 Aug 2003 11:08:11 -0000 1.1
+++ output.h 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,22 +1,13 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef _OUTPUT_H
#define _OUTPUT_H
@@ -38,13 +29,12 @@
int outputs_used;
int idcount;
- char *dirname;
char *basename;
+ char *suffix;
} output_ctrl_t;
-int output_ctrl_init(output_ctrl_t *oc,
- char *dirname, char *filename);
+int output_ctrl_init(output_ctrl_t *oc, char *filename);
int output_ctrl_free(output_ctrl_t *oc);
output_t *output_ctrl_output_new(output_ctrl_t *oc, int chain_c, int group_c);
int output_ctrl_output_free(output_ctrl_t *oc, int id);
<p><p>1.3 +2 -11 ogg-tools/oggsplit/stream.c
Index: stream.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/stream.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- stream.c 7 Aug 2003 08:45:39 -0000 1.2
+++ stream.c 8 Aug 2003 17:50:55 -0000 1.3
@@ -1,22 +1,13 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#include <stdio.h>
<p><p>1.2 +2 -11 ogg-tools/oggsplit/stream.h
Index: stream.h
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggsplit/stream.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- stream.h 6 Aug 2003 11:08:11 -0000 1.1
+++ stream.h 8 Aug 2003 17:50:55 -0000 1.2
@@ -1,22 +1,13 @@
/*
* oggsplit - splits multiplexed Ogg files into separate files
*
- * Copyright (C) 2003 Philip Jägenstedt
+ * Copyright (C) 2003 Philip Jägenstedt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef _STREAM_H
#define _STREAM_H
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list