[MPlayer-cvslog] r31952 - in trunk: libass/ass_mp.c mencoder.c stream/open.c subreader.c

reimar subversion at mplayerhq.hu
Tue Aug 10 15:23:05 CEST 2010


Author: reimar
Date: Tue Aug 10 15:23:04 2010
New Revision: 31952

Log:
Simplify code: allow file_format argument to open_stream to be NULL.

Modified:
   trunk/libass/ass_mp.c
   trunk/mencoder.c
   trunk/stream/open.c
   trunk/subreader.c

Modified: trunk/libass/ass_mp.c
==============================================================================
--- trunk/libass/ass_mp.c	Tue Aug 10 02:36:53 2010	(r31951)
+++ trunk/libass/ass_mp.c	Tue Aug 10 15:23:04 2010	(r31952)
@@ -219,14 +219,13 @@ ASS_Track* ass_read_subdata(ASS_Library*
 }
 
 ASS_Track* ass_read_stream(ASS_Library* library, const char *fname, char *charset) {
-	int i;
 	char *buf = NULL;
 	ASS_Track *track;
 	size_t sz = 0;
 	size_t buf_alloc = 0;
 	stream_t *fd;
 
-	fd = open_stream(fname, NULL, &i);
+	fd = open_stream(fname, NULL, NULL);
 	if (!fd) {
 		mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FopenFailed, fname);
 		return NULL;
@@ -235,6 +234,7 @@ ASS_Track* ass_read_stream(ASS_Library* 
 		/* read entire file if size is known */
 		buf_alloc = fd->end_pos;
 	for (;;) {
+		int i;
 		if (buf_alloc >= 100*1024*1024) {
 			mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_RefusingToLoadSubtitlesLargerThan100M, fname);
 			sz = 0;

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	Tue Aug 10 02:36:53 2010	(r31951)
+++ trunk/mencoder.c	Tue Aug 10 15:23:04 2010	(r31952)
@@ -643,7 +643,7 @@ if(!codecs_file || !parse_codec_cfg(code
 
 
 if (frameno_filename) {
-  stream2=open_stream(frameno_filename,0,&i);
+  stream2=open_stream(frameno_filename, NULL, NULL);
   if(stream2){
     demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL);
     if(demuxer2) mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_UsingPass3ControlFile, frameno_filename);

Modified: trunk/stream/open.c
==============================================================================
--- trunk/stream/open.c	Tue Aug 10 02:36:53 2010	(r31951)
+++ trunk/stream/open.c	Tue Aug 10 15:23:04 2010	(r31952)
@@ -48,6 +48,8 @@ int dvd_title=0;
 // Open a new stream  (stdin/file/vcd/url)
 
 stream_t* open_stream(const char* filename,char** options, int* file_format){
+  int dummy = DEMUXER_TYPE_UNKNOWN;
+  if (!file_format) file_format = &dummy;
   // Check if playlist or unknown
   if (*file_format != DEMUXER_TYPE_PLAYLIST){
     *file_format=DEMUXER_TYPE_UNKNOWN;

Modified: trunk/subreader.c
==============================================================================
--- trunk/subreader.c	Tue Aug 10 02:36:53 2010	(r31951)
+++ trunk/subreader.c	Tue Aug 10 15:23:04 2010	(r31952)
@@ -1449,8 +1449,7 @@ sub_data* sub_read_file (char *filename,
     const struct subreader *srp;
 
     if(filename==NULL) return NULL; //qnx segfault
-    i = 0;
-    fd=open_stream (filename, NULL, &i); if (!fd) return NULL;
+    fd=open_stream (filename, NULL, NULL); if (!fd) return NULL;
 
     sub_format = SUB_INVALID;
     for (utf16 = 0; sub_format == SUB_INVALID && utf16 < 3; utf16++) {


More information about the MPlayer-cvslog mailing list