SOURCES: transcode-ac.patch (NEW), transcode-bigdir.patch (NEW), t...
arekm
arekm at pld-linux.org
Sun Aug 20 17:36:41 CEST 2006
Author: arekm Date: Sun Aug 20 15:36:41 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- new
---- Files affected:
SOURCES:
transcode-ac.patch (NONE -> 1.1) (NEW), transcode-bigdir.patch (NONE -> 1.1) (NEW), transcode-lzo2.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/transcode-ac.patch
diff -u /dev/null SOURCES/transcode-ac.patch:1.1
--- /dev/null Sun Aug 20 17:36:41 2006
+++ SOURCES/transcode-ac.patch Sun Aug 20 17:36:36 2006
@@ -0,0 +1,14 @@
+Index: transcode-1.0.2/acinclude.m4
+===================================================================
+--- transcode-1.0.2.orig/acinclude.m4
++++ transcode-1.0.2/acinclude.m4
+@@ -92,7 +92,8 @@ buffer.memory = V4L2_MEMORY_MMAP
+ ], [AC_DEFINE([HAVE_STRUCT_V4L2_BUFFER], 1,
+ [define if your videodev2 header has struct v4l2_buffer])
+ AC_MSG_RESULT([yes])],
+- [v4l2=no AC_MSG_RESULT([no])])
++ [v4l2=no
++ AC_MSG_RESULT([no])])
+ fi
+
+ if test x"$v4l" = x"yes" -o x"$v4l2" = x"yes" ; then
================================================================
Index: SOURCES/transcode-bigdir.patch
diff -u /dev/null SOURCES/transcode-bigdir.patch:1.1
--- /dev/null Sun Aug 20 17:36:41 2006
+++ SOURCES/transcode-bigdir.patch Sun Aug 20 17:36:36 2006
@@ -0,0 +1,428 @@
+This patch is needed to allow transcode to work when using big directory
+paths. Backport from upstream's directly.
+
+See Gentoo Bug #112995.
+
+--- import/iodump.c.old 2005-07-04 09:09:34.000000000 +0200
++++ import/iodump.c 2005-11-20 23:35:22.000000000 +0100
+@@ -52,139 +52,217 @@
+
+ static int verbose_flag=TC_QUIET;
+
+-static DIR *dir=NULL;
++typedef struct tcdirlist_ TCDirList;
++struct tcdirlist_ {
++ DIR *dir; /* for internal use */
++
++ const char *dir_name; /* saved base path */
++ const char *path_sep; /* optional *nix path separator */
++
++ char filename[PATH_MAX + 2];
++ /*
++ * full path of file actually under focus + optional separator +
++ * final string terminator
++ */
++ char **entries;
++ /* array of full PATHs of files in scanned dirlist */
++
++ int nfiles; /* (current) number of files in dirlist */
++ int findex; /* index of file under focus */
++ int buffered;
++ /* boolean flag: above array of file in directory is valid? */
++};
+
+-static char filename[PATH_MAX+2];
+
+-static char **rbuf_ptr;
+-
+-static int nfiles=0, findex=0, buffered=0;
+-
+-int open_directory(char *dir_name)
++static int compare_name(const void *file1_ptr, const void *file2_ptr)
+ {
+- if((dir = opendir(dir_name))==NULL) return(-1);
+- return(0);
++ return strcoll(*(const char **)file1_ptr, *(const char **)file2_ptr);
+ }
+
+-static char *scan_directory(char *dir_name)
+-{
+- struct dirent *dent;
+- char *end_of_dir;
+- int len;
+-
+- if (dir_name == 0) return NULL;
+- if (dir == 0) return NULL;
+-
+- len = strlen( dir_name );
+- end_of_dir = &dir_name[ len - 1 ];
+-
+- if ( *end_of_dir != '/' ) {
+- end_of_dir++;
+- *end_of_dir = '/';
+- end_of_dir++;
+- *end_of_dir = 0;
+- }
+-
+- switch(buffered) {
+-
+- case 0:
+-
+- while((dent = readdir( dir ))!=NULL) {
+-
+- if((strncmp(dent->d_name, ".", 1)==0) || (strcmp(dent->d_name, "..")==0))
+- continue;
+-
+- snprintf(filename, sizeof(filename), "%s%s", dir_name, dent->d_name);
++static int tc_dirlist_next(TCDirList *tcdir)
++{
++ struct dirent *dent = NULL;
++ int have_file = 0;
+
+- //counter
+- ++nfiles;
+-
+- return(filename);
+- }
+-
+- break;
+-
+- case 1:
+-
+- if (findex < nfiles) {
+- return(rbuf_ptr[findex++]);
+- } else {
+- return(NULL);
+- }
++ if (tcdir == NULL) {
++ return -1;
++ }
+
+- break;
+- }
+-
+- return(NULL);
++ do {
++ dent = readdir(tcdir->dir);
++ if (dent == NULL) {
++ break; /* all entries in dirlist have been processed */
++ }
++
++ if ((strncmp(dent->d_name, ".", 1) != 0)
++ && (strcmp(dent->d_name, "..") != 0)) {
++ /* discard special files */
++ have_file = 1;
++ }
++
++ } while (!have_file);
++
++ if (have_file) {
++ int res = snprintf(tcdir->filename, sizeof(tcdir->filename),
++ "%s%s%s", tcdir->dir_name, tcdir->path_sep,
++ dent->d_name);
++ /* enforce string terminator */
++ tcdir->filename[sizeof(tcdir->filename)] = '\0';
++ tc_test_string(__FILE__, __LINE__,
++ sizeof(tcdir->filename), res, errno);
++ return 0;
++ }
++ return 1;
+ }
+
+-
+-static int compare_name(char **file1_ptr, char **file2_ptr)
++static int tc_dirlist_sortbuf(TCDirList *tcdir)
+ {
+- return strcoll(*file1_ptr, *file2_ptr);
+-}
++ int n = 0;
+
++ if (tcdir == NULL) {
++ return -1;
++ }
+
+-int sortbuf_directory(char *dir_name)
+-{
+- struct dirent *dent;
+- char *end_of_dir;
+- int n, len;
++ tcdir->entries = malloc(tcdir->nfiles * sizeof(char *));
++ if (tcdir->entries == NULL) {
++ fprintf(stderr, "(%s) can't allocate memory for "
++ "directory entries\n", __FILE__);
++ return -1;
++ }
+
+- int (*func) ();
+-
+- if (dir_name == 0) return(-1);
+- if (dir == 0) return(-1);
+- if(nfiles == 0) return(-1);
+-
+- len = strlen( dir_name );
+- end_of_dir = &dir_name[ len - 1 ];
+-
+- if ( *end_of_dir != '/' ) {
+- end_of_dir++;
+- *end_of_dir = '/';
+- end_of_dir++;
+- *end_of_dir = 0;
+- }
+-
+- if((rbuf_ptr = (char **) calloc(nfiles, sizeof(char *)))==NULL) {
+- perror("out of memory");
+- return(-1);
+- }
+-
+- n=0;
++ while (tc_dirlist_next(tcdir) == 0) {
++ tcdir->entries[n] = strdup(tcdir->filename);
++ if (tcdir->entries[n] == NULL) {
++ fprintf(stderr, "(%s) can't memorize dirlist entry "
++ "for '%s'\n", __FILE__,
++ tcdir->filename);
++ }
++ n++;
++ }
+
+- while((dent = readdir( dir ))!=NULL) {
+-
+- if((strncmp(dent->d_name, ".", 1)==0) || (strcmp(dent->d_name, "..")==0))
+- continue;
+-
+- snprintf(filename, sizeof(filename), "%s%s", dir_name, dent->d_name);
+- rbuf_ptr[n++] = strdup(filename);
+- }
+-
+- // sorting
++ qsort(tcdir->entries, tcdir->nfiles, sizeof(char *), compare_name);
+
+- func = compare_name;
++ tcdir->buffered = 1;
++ tcdir->findex = 0;
+
+- qsort(rbuf_ptr, nfiles, sizeof(char *), func);
++ return 0;
++}
++
++static int tc_dirlist_set_path_sep(TCDirList *tcdir)
++{
++ size_t len = 0;
++ char end_of_dir;
+
+- buffered=1;
+- findex=0;
++ len = strlen(tcdir->dir_name);
++ if (len == 0) {
++ return -1;
++ }
+
+- return(0);
++ end_of_dir = tcdir->dir_name[len - 1];
++ if (end_of_dir == '/') {
++ tcdir->path_sep = "";
++ } else {
++ tcdir->path_sep = "/";
++ }
++
++ return 0;
++}
++
++static int tc_dirlist_file_count(TCDirList *tcdir)
++{
++ if (tcdir == NULL) {
++ return -1;
++ }
++ return tcdir->nfiles;
+ }
+
+
+-void close_directory()
++static int tc_dirlist_open(TCDirList *tcdir, const char *dirname)
++{
++ int ret;
++
++ if (tcdir == NULL) {
++ return -1;
++ }
++
++ tcdir->filename[0] = '\0';
++ tcdir->entries = NULL;
++ tcdir->nfiles = 0;
++ tcdir->findex = 0;
++ tcdir->buffered = 0;
++ tcdir->dir_name = dirname;
++
++ ret = tc_dirlist_set_path_sep(tcdir);
++ if (ret != 0) {
++ return ret;
++ }
++
++ tcdir->dir = opendir(dirname);
++ if (tcdir->dir == NULL) {
++ return -1;
++ }
++
++ rewinddir(tcdir->dir);
++ while (tc_dirlist_next(tcdir) == 0) {
++ tcdir->nfiles++;
++ }
++ rewinddir(tcdir->dir);
++
++ return 0;
++}
++
++static void tc_dirlist_close(TCDirList *tcdir)
+ {
+- if(dir!=NULL) closedir(dir);
+- dir=NULL;
++ if (tcdir != NULL) {
++ if (tcdir->buffered == 1) {
++ int i = 0;
++ for (i = 0; i < tcdir->nfiles; i++) {
++ if (tcdir->entries[i] != NULL) {
++ /* should be always true */
++ free(tcdir->entries[i]);
++ tcdir->nfiles--;
++ }
++ }
++
++ if (tcdir->entries != NULL) {
++ /* should be always true */
++ free(tcdir->entries);
++ }
++
++ if (tcdir->nfiles > 0) {
++ /* should never happen */
++ fprintf(stderr, "(%s) left out %i directory entries",
++ __FILE__, tcdir->nfiles);
++ }
++ }
++
++ if (tcdir->dir != NULL) {
++ closedir(tcdir->dir);
++ tcdir->dir = NULL;
++ }
++ }
+ }
+
+-void freebuf_directory()
++static char *tc_dirlist_scan(TCDirList *tcdir)
+ {
+- free(rbuf_ptr);
++ char *ret = NULL;
++
++ if (tcdir == NULL) {
++ return NULL;
++ }
++
++ if (tcdir->buffered == 0) {
++ if (tc_dirlist_next(tcdir) == 0) {
++ ret = tcdir->filename;
++ }
++ } else { /* tcdir->buffered == 0 */
++ /* buffered */
++ if (tcdir->findex < tcdir->nfiles) {
++ ret = tcdir->entries[tcdir->findex++];
++ }
++ }
++
++ return ret;
+ }
+
+ /* ------------------------------------------------------------
+@@ -203,6 +281,7 @@
+
+ info_t ipipe_avi;
+
++ TCDirList tcdir;
+ #ifdef NET_STREAM
+ struct sockaddr_in sin;
+ struct hostent *hp;
+@@ -326,13 +405,13 @@
+
+ //PASS 1: check file type - file order not important
+
+- if((open_directory(ipipe->name))<0) {
++ if(tc_dirlist_open(&tcdir, ipipe->name)<0) {
+ fprintf(stderr, "(%s) unable to open directory \"%s\"\n", __FILE__, ipipe->name);
+ exit(1);
+ } else if(verbose_flag & TC_DEBUG)
+ fprintf(stderr, "(%s) scanning directory \"%s\"\n", __FILE__, ipipe->name);
+
+- while((name=scan_directory(ipipe->name))!=NULL) {
++ while((name=tc_dirlist_scan(&tcdir))!=NULL) {
+
+ if((ipipe->fd_in = open(name, O_RDONLY))<0) {
+ perror("file open");
+@@ -386,7 +465,7 @@
+ } // check itype
+ } // process files
+
+- close_directory();
++ tc_dirlist_close(&tcdir);
+
+ if(!found) {
+ fprintf(stderr,"\nerror: no valid files found in %s\n", name);
+@@ -398,17 +477,17 @@
+
+ //PASS 2: dump files in correct order
+
+- if((open_directory(ipipe->name))<0) {
++ if(tc_dirlist_open(&tcdir, ipipe->name)<0) {
+ fprintf(stderr, "(%s) unable to sort directory entries\"%s\"\n", __FILE__, name);
+ exit(1);
+ }
+
+- if((sortbuf_directory(ipipe->name))<0) {
++ if(tc_dirlist_sortbuf(&tcdir)<0) {
+ fprintf(stderr, "(%s) unable to sort directory entries\"%s\"\n", __FILE__, name);
+ exit(1);
+ }
+
+- while((name=scan_directory(ipipe->name))!=NULL) {
++ while((name=tc_dirlist_scan(&tcdir))!=NULL) {
+
+ if((ipipe->fd_in = open(name, O_RDONLY))<0) {
+ perror("file open");
+@@ -480,9 +559,8 @@
+ close(ipipe->fd_in);
+
+ }//process files
+-
+- close_directory();
+- freebuf_directory();
++
++ tc_dirlist_close(&tcdir);
+
+ break;
+ }
+@@ -492,24 +570,25 @@
+ int fileinfo_dir(char *dname, int *fd, long *magic)
+ {
+ char *name=NULL;
++ TCDirList tcdir;
+
+ //check file type - file order not important
+
+- if((open_directory(dname))<0) {
++ if(tc_dirlist_open(&tcdir, dname)<0) {
+ fprintf(stderr, "(%s) unable to open directory \"%s\"\n", __FILE__, dname);
+ exit(1);
+ } else if(verbose_flag & TC_DEBUG)
+
+ fprintf(stderr, "(%s) scanning directory \"%s\"\n", __FILE__, dname);
+
+- if((name=scan_directory(dname))==NULL) return(-1);
++ if((name=tc_dirlist_scan(&tcdir))==NULL) return(-1);
+
+ if((*fd= open(name, O_RDONLY))<0) {
+ perror("open file");
+ return(-1);
+ }
+
+- close_directory();
++ tc_dirlist_close(&tcdir);
+
+ //first valid magic must be the same for all
+ //files to follow, but is not checked here
================================================================
Index: SOURCES/transcode-lzo2.patch
diff -u /dev/null SOURCES/transcode-lzo2.patch:1.1
--- /dev/null Sun Aug 20 17:36:41 2006
+++ SOURCES/transcode-lzo2.patch Sun Aug 20 17:36:36 2006
@@ -0,0 +1,83 @@
+Patch to make transcode use =lzo-2* instead of old lzo-1*.
+Contributed by Daniel Black <dragonheart at gentoo.org>
+
+See Gentoo Bug #112382
+
+diff -ru transcode-1.0.2.orig/configure.in transcode-1.0.2/configure.in
+--- transcode-1.0.2.orig/configure.in 2005-10-30 15:57:45.000000000 +1100
++++ transcode-1.0.2/configure.in 2005-11-13 20:13:26.000000000 +1100
+@@ -1018,7 +1018,7 @@
+ dnl
+ dnl LZO
+ dnl
+-TC_PKG_CHECK(lzo, no, LZO, no, [lzo1x.h], lzo, lzo_version, lzo,
++TC_PKG_CHECK(lzo, no, LZO, no, [lzo1x.h], lzo2, lzo_version, lzo2,
+ [http://www.oberhumer.com/opensource/lzo/])
+ TC_PKG_HAVE(lzo, LZO)
+
+diff -ru transcode-1.0.2.orig/export/export_lzo.c transcode-1.0.2/export/export_lzo.c
+--- transcode-1.0.2.orig/export/export_lzo.c 2005-07-04 17:09:31.000000000 +1000
++++ transcode-1.0.2/export/export_lzo.c 2005-11-13 20:09:26.000000000 +1100
+@@ -84,8 +84,8 @@
+ return(TC_EXPORT_ERROR);
+ }
+
+- wrkmem = (lzo_bytep) lzo_malloc(LZO1X_1_MEM_COMPRESS);
+- out = (lzo_bytep) lzo_malloc(vob->ex_v_height*vob->ex_v_width*3*2);
++ wrkmem = (lzo_bytep) malloc(LZO1X_1_MEM_COMPRESS);
++ out = (lzo_bytep) malloc(vob->ex_v_height*vob->ex_v_width*3*2);
+
+ if (wrkmem == NULL || out == NULL) {
+ printf("[%s] out of memory\n", MOD_NAME);
+@@ -270,8 +270,8 @@
+
+ if(param->flag == TC_VIDEO) {
+
+- lzo_free(wrkmem);
+- lzo_free(out);
++ free(wrkmem);
++ free(out);
+
+ return(0);
+ }
+diff -ru transcode-1.0.2.orig/import/decode_lzo.c transcode-1.0.2/import/decode_lzo.c
+--- transcode-1.0.2.orig/import/decode_lzo.c 2005-07-04 17:09:33.000000000 +1000
++++ transcode-1.0.2/import/decode_lzo.c 2005-11-13 20:09:26.000000000 +1100
+@@ -65,9 +65,9 @@
+ goto decoder_error;
+ }
+
+- wrkmem = (lzo_bytep) lzo_malloc(LZO1X_1_MEM_COMPRESS);
+- out = (lzo_bytep) lzo_malloc(BUFFER_SIZE);
+- inbuf = (lzo_bytep) lzo_malloc(BUFFER_SIZE);
++ wrkmem = (lzo_bytep) malloc(LZO1X_1_MEM_COMPRESS);
++ out = (lzo_bytep) malloc(BUFFER_SIZE);
++ inbuf = (lzo_bytep) malloc(BUFFER_SIZE);
+
+ if (wrkmem == NULL || out == NULL) {
+ fprintf(stderr, "[%s] out of memory\n", MOD_NAME);
+diff -ru transcode-1.0.2.orig/import/import_lzo.c transcode-1.0.2/import/import_lzo.c
+--- transcode-1.0.2.orig/import/import_lzo.c 2005-07-04 17:09:33.000000000 +1000
++++ transcode-1.0.2/import/import_lzo.c 2005-11-13 20:09:26.000000000 +1100
+@@ -117,8 +117,8 @@
+ return(TC_IMPORT_ERROR);
+ }
+
+- wrkmem = (lzo_bytep) lzo_malloc(LZO1X_1_MEM_COMPRESS);
+- out = (lzo_bytep) lzo_malloc(BUFFER_SIZE);
++ wrkmem = (lzo_bytep) malloc(LZO1X_1_MEM_COMPRESS);
++ out = (lzo_bytep) malloc(BUFFER_SIZE);
+
+ if (wrkmem == NULL || out == NULL) {
+ printf("[%s] out of memory\n", MOD_NAME);
+@@ -236,8 +236,8 @@
+
+ if(param->flag == TC_VIDEO) {
+
+- lzo_free(wrkmem);
+- lzo_free(out);
++ free(wrkmem);
++ free(out);
+
+ if(avifile2!=NULL) {
+ AVI_close(avifile2);
================================================================
More information about the pld-cvs-commit
mailing list