Rank: 43892 based on 0 downloads (last 30 days) and 0 file submitted
photo

Chris Kraus

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Chris Kraus
Updated File Comments Rating
12 May 2010 mpgwrite The MPEG converter takes a MATLAB movie matrix and writes the movie to disk as an MPEG file. Author: David Foti

Had the same problem on my 64 bit linux. It matlab crashed when it closed the file. How I fixed it:
- in the file src/mpeg.h:
--- orig/src/mpeg.h 1999-02-15 22:39:16.000000000 +0100
+++ src/mpeg.h 2010-05-12 14:33:42.325128732 +0200
@@ -62,7 +62,7 @@

void SetFramePattern _ANSI_ARGS_((char *pattern));
int32 GenMPEGStream _ANSI_ARGS_((int whichGOP, int frameStart, int frameEnd,
- int numFrames, FILE *ofp,
+ int numFrames, FILE **ofp,
char *outputFileName));
extern void PrintStartStats _ANSI_ARGS_((int firstFrame, int lastFrame));
extern void IncrementTCTime _ANSI_ARGS_((void));

- in src/mpeg.c:
--- orig/src/mpeg.c 1999-02-15 22:39:16.000000000 +0100
+++ src/mpeg.c 2010-05-12 14:34:05.242486919 +0200
@@ -246,7 +246,7 @@
int frameStart;
int frameEnd;
int numFrames;
- FILE *ofp;
+ FILE **ofp;
char *outputFileName;
{
BitBucket *bb;
@@ -344,7 +344,7 @@
*/

if ( frameStart == -1 ) {
- bb = Bitio_New(ofp);
+ bb = Bitio_New(*ofp);
} else {
bb = NULL;
}
@@ -430,8 +430,10 @@

if ( frameStart == -1 ) {
Bitio_Flush(bb);
- fclose(ofp);
-
+ if ( fclose(*ofp) == NULL ) {
+ *ofp = NULL;
+ }
+
time(&timeEnd);
diffTime = (int32)(timeEnd-timeStart);

- and finally in src/mpgwrite.c:
--- orig/src/mpgwrite.c 2009-12-29 17:27:30.000000000 +0100
+++ src/mpgwrite.c 2010-05-12 14:34:10.445128932 +0200
@@ -475,14 +475,14 @@
}

totalTime = GenMPEGStream(whichGOP, frameStart, frameEnd,
- numInputFiles, ofp,
+ numInputFiles, &ofp,
outputFileName);

/* deallocate frame space */
Frame_Exit();

if (ofp != NULL) {
- fclose(ofp);
+ fclose(ofp);
}
}

Contact us