Mercurial > mplayer.hg
annotate libmpdemux/mf.c @ 9819:9aa9715af708
Shift vhq values and set vhq=1 to MODEDECISION.
Higher values seems to loose PSNR atm.
author | rguyom |
---|---|
date | Fri, 04 Apr 2003 05:47:27 +0000 |
parents | 27fff718ede6 |
children | 9cdbcd86c176 |
rev | line source |
---|---|
4549 | 1 |
2 #include <ctype.h> | |
3 #include <stdio.h> | |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <unistd.h> | |
7 #include <fcntl.h> | |
8 #include <glob.h> | |
9 #include <errno.h> | |
10 #include <sys/types.h> | |
11 #include <sys/stat.h> | |
12 | |
13 #include "config.h" | |
14 | |
15 #include "mp_msg.h" | |
16 #include "help_mp.h" | |
17 #include "stream.h" | |
18 | |
19 #include "mf.h" | |
20 | |
9149 | 21 int mf_w = 0; //352; // let codecs to detect it |
22 int mf_h = 0; //288; | |
5352
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
23 float mf_fps = 25.0; |
9149 | 24 char * mf_type = NULL; //"jpg"; |
4549 | 25 |
7407 | 26 mf_t* open_mf(char * filename){ |
4549 | 27 glob_t gg; |
28 struct stat fs; | |
29 int i; | |
30 char * fname; | |
31 mf_t * mf; | |
4565 | 32 int error_count = 0; |
33 int count = 0; | |
4549 | 34 |
5352
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
35 mf=calloc( 1,sizeof( mf_t ) ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
36 |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
37 if( strchr( filename,',') ) |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
38 { |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
39 fname=malloc( 255 ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
40 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] filelist: %s\n",filename ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
41 |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
42 while ( ( fname=strsep( &filename,"," ) ) ) |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
43 { |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
44 if ( stat( fname,&fs ) ) |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
45 { |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
46 mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
47 } |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
48 else |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
49 { |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
50 mf->names=realloc( mf->names,( mf->nr_of_files + 1 ) * sizeof( char* ) ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
51 mf->names[mf->nr_of_files]=strdup( fname ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
52 // mp_msg( MSGT_STREAM,MSGL_V,"[mf] added file %d.: %s\n",mf->nr_of_files,mf->names[mf->nr_of_files] ); |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
53 mf->nr_of_files++; |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
54 } |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
55 } |
5354 | 56 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d\n",mf->nr_of_files ); |
57 | |
5352
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
58 goto exit_mf; |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
59 } |
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
60 |
4565 | 61 fname=malloc( strlen( filename ) + 32 ); |
5352
cf2882606e72
Fileslist support for mf demuxer, delemited by ',' and change mf fps to float.
atmos4
parents:
4565
diff
changeset
|
62 |
4565 | 63 if ( !strchr( filename,'%' ) ) |
64 { | |
65 strcpy( fname,filename ); | |
66 if ( !strchr( filename,'*' ) ) strcat( fname,"*" ); | |
4549 | 67 |
4565 | 68 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] search expr: %s\n",fname ); |
69 | |
70 if ( glob( fname,0,NULL,&gg ) ) | |
7407 | 71 { free( mf ); free( fname ); return NULL; } |
4565 | 72 |
73 mf->nr_of_files=gg.gl_pathc; | |
74 mf->names=malloc( gg.gl_pathc * sizeof( char* ) ); | |
75 | |
76 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d (%d)\n",mf->nr_of_files, gg.gl_pathc * sizeof( char* ) ); | |
4549 | 77 |
4565 | 78 for( i=0;i < gg.gl_pathc;i++ ) |
79 { | |
80 stat( gg.gl_pathv[i],&fs ); | |
81 if( S_ISDIR( fs.st_mode ) ) continue; | |
82 mf->names[i]=strdup( gg.gl_pathv[i] ); | |
83 // mp_msg( MSGT_STREAM,MSGL_DBG2,"[mf] added file %d.: %s\n",i,mf->names[i] ); | |
84 } | |
85 globfree( &gg ); | |
86 goto exit_mf; | |
87 } | |
4549 | 88 |
4565 | 89 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] search expr: %s\n",filename ); |
90 | |
91 while ( error_count < 5 ) | |
4549 | 92 { |
4565 | 93 sprintf( fname,filename,count++ ); |
94 if ( stat( fname,&fs ) ) | |
95 { | |
96 error_count++; | |
97 mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname ); | |
98 } | |
99 else | |
100 { | |
101 mf->names=realloc( mf->names,( mf->nr_of_files + 1 ) * sizeof( char* ) ); | |
102 mf->names[mf->nr_of_files]=strdup( fname ); | |
103 // mp_msg( MSGT_STREAM,MSGL_V,"[mf] added file %d.: %s\n",mf->nr_of_files,mf->names[mf->nr_of_files] ); | |
104 mf->nr_of_files++; | |
105 } | |
4549 | 106 } |
107 | |
4565 | 108 mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d\n",mf->nr_of_files ); |
109 | |
110 exit_mf: | |
4549 | 111 free( fname ); |
7407 | 112 return mf; |
4549 | 113 } |
114 |