comparison dvdnav.c @ 82:033f011d8152 src

Improve some debug messages. Add some comments about dvdnav_open memory leaks.
author jcdutton
date Sat, 31 Aug 2002 02:50:27 +0000
parents 0e2abe7083de
children ba1121a07120
comparison
equal deleted inserted replaced
81:740552dd7668 82:033f011d8152
175 175
176 dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path) { 176 dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path) {
177 dvdnav_t *this; 177 dvdnav_t *this;
178 178
179 /* Create a new structure */ 179 /* Create a new structure */
180 fprintf(MSG_OUT, "libdvdnav: Using dvdnav version from http://dvd.sf.net\n");
181
182 /* FIXME: We malloc() here, but if an error occurs inside dvdnav_open(),
183 * we return but never free() it.
184 */
180 (*dest) = NULL; 185 (*dest) = NULL;
181 this = (dvdnav_t*)malloc(sizeof(dvdnav_t)); 186 this = (dvdnav_t*)malloc(sizeof(dvdnav_t));
182 if(!this) 187 if(!this)
183 return S_ERR; 188 return S_ERR;
184 memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */ 189 memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */
190 (*dest) = this;
185 191
186 pthread_mutex_init(&this->vm_lock, NULL); 192 pthread_mutex_init(&this->vm_lock, NULL);
187 /* Initialise the error string */ 193 /* Initialise the error string */
188 printerr(""); 194 printerr("");
189 195
206 /* Pre-open and close a file so that the CSS-keys are cached. */ 212 /* Pre-open and close a file so that the CSS-keys are cached. */
207 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), 0, DVD_READ_MENU_VOBS); 213 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), 0, DVD_READ_MENU_VOBS);
208 if (this->file) DVDCloseFile(this->file); 214 if (this->file) DVDCloseFile(this->file);
209 this->file = NULL; 215 this->file = NULL;
210 216
211 //if(!this->started) {
212 // /* Start the VM */
213 // vm_start(this->vm);
214 // this->started = 1;
215 //}
216
217 /* Start the read-ahead cache. */ 217 /* Start the read-ahead cache. */
218 this->cache = dvdnav_read_cache_new(this); 218 this->cache = dvdnav_read_cache_new(this);
219 219
220 (*dest) = this;
221 return S_OK; 220 return S_OK;
222 } 221 }
223 222
224 dvdnav_status_t dvdnav_close(dvdnav_t *this) { 223 dvdnav_status_t dvdnav_close(dvdnav_t *this) {
225 if(!this) { 224 if(!this) {
285 } 284 }
286 #ifdef LOG_DEBUG 285 #ifdef LOG_DEBUG
287 fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n"); 286 fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n");
288 #endif 287 #endif
289 result=dvdnav_clear(this); 288 result=dvdnav_clear(this);
290 #ifdef LOG_DEBUG
291 fprintf(MSG_OUT, "libdvdnav: starting vm\n");
292 #endif
293 // if(!this->started) {
294 // /* Start the VM */
295 // vm_start(this->vm);
296 // this->started = 1;
297 // }
298 #ifdef LOG_DEBUG 289 #ifdef LOG_DEBUG
299 fprintf(MSG_OUT, "libdvdnav: unlocking\n"); 290 fprintf(MSG_OUT, "libdvdnav: unlocking\n");
300 #endif 291 #endif
301 pthread_mutex_unlock(&this->vm_lock); 292 pthread_mutex_unlock(&this->vm_lock);
302 return result; 293 return result;
997 return this->position_next.still; 988 return this->position_next.still;
998 } 989 }
999 990
1000 /* 991 /*
1001 * $Log$ 992 * $Log$
993 * Revision 1.32 2002/08/31 02:50:27 jcdutton
994 * Improve some debug messages.
995 * Add some comments about dvdnav_open memory leaks.
996 *
1002 * Revision 1.31 2002/08/27 19:15:08 mroi 997 * Revision 1.31 2002/08/27 19:15:08 mroi
1003 * more consistent console output 998 * more consistent console output
1004 * 999 *
1005 * Revision 1.30 2002/08/09 21:34:27 mroi 1000 * Revision 1.30 2002/08/09 21:34:27 mroi
1006 * update spu clut, spu channel and audio channel more often 1001 * update spu clut, spu channel and audio channel more often