Mercurial > mplayer.hg
annotate osdep/glob-win.c @ 28992:947ef23ba798
Test if create_vdp_decoder() might succeed by calling it from config()
with a small value for max_reference_frames.
This does not make automatic recovery by using software decoder possible,
but lets MPlayer fail more graciously on - actually existing - buggy
hardware that does not support certain H264 widths when using
hardware accelerated decoding (784, 864, 944, 1024, 1808, 1888 pixels on
NVIDIA G98) and if the user tries to hardware-decode more samples at
the same time than supported.
Might break playback of H264 Intra-Only samples on hardware with very
little video memory.
author | cehoyos |
---|---|
date | Sat, 21 Mar 2009 20:11:05 +0000 |
parents | 5cfef41a1771 |
children | 0f1b5b68af32 |
rev | line source |
---|---|
28744 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
18 | |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
19 #include <sys/types.h> |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
20 #include <stdio.h> |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
21 |
16985 | 22 #include "config.h" |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
23 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
24 #include <windows.h> |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
25 #include "glob.h" |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
26 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
27 int glob(const char *pattern, int flags, |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
28 int (*errfunc)(const char *epath, int eerrno), glob_t *pglob) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
29 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
30 HANDLE searchhndl; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
31 WIN32_FIND_DATA found_file; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
32 if(errfunc)printf("glob():ERROR:Sorry errfunc not supported by this implementation\n"); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
33 if(flags)printf("glob():ERROR:Sorry no flags supported by this globimplementation\n"); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
34 //printf("PATTERN \"%s\"\n",pattern); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
35 pglob->gl_pathc = 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
36 searchhndl = FindFirstFile( pattern,&found_file); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
37 if(searchhndl == INVALID_HANDLE_VALUE) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
38 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
39 if(GetLastError() == ERROR_FILE_NOT_FOUND) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
40 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
41 pglob->gl_pathc = 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
42 //printf("could not find a file matching your search criteria\n"); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
43 return 1; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
44 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
45 else |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
46 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
47 //printf("glob():ERROR:FindFirstFile: %i\n",GetLastError()); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
48 return 1; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
49 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
50 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
51 pglob->gl_pathv = malloc(sizeof(char*)); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
52 pglob->gl_pathv[0] = strdup(found_file.cFileName); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
53 pglob->gl_pathc++; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
54 while(1) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
55 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
56 if(!FindNextFile(searchhndl,&found_file)) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
57 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
58 if(GetLastError()==ERROR_NO_MORE_FILES) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
59 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
60 //printf("glob(): no more files found\n"); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
61 break; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
62 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
63 else |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
64 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
65 //printf("glob():ERROR:FindNextFile:%i\n",GetLastError()); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
66 return 1; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
67 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
68 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
69 else |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
70 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
71 //printf("glob: found file %s\n",found_file.cFileName); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
72 pglob->gl_pathc++; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
73 pglob->gl_pathv = realloc(pglob->gl_pathv,pglob->gl_pathc * sizeof(char*)); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
74 pglob->gl_pathv[pglob->gl_pathc-1] = strdup(found_file.cFileName); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
75 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
76 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
77 FindClose(searchhndl); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
78 return 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
79 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
80 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
81 void globfree(glob_t *pglob) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
82 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
83 int i; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
84 for(i=0; i <pglob->gl_pathc ;i++) |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
85 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
86 free(pglob->gl_pathv[i]); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
87 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
88 free(pglob->gl_pathv); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
89 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
90 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
91 #if 0 |
25100 | 92 int main(void){ |
9983
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
93 glob_t gg; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
94 printf("globtest\n"); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
95 glob( "*.jpeg",0,NULL,&gg ); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
96 { |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
97 int i; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
98 for(i=0;i<gg.gl_pathc;i++)printf("GLOBED:%i %s\n",i,gg.gl_pathv[i]); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
99 } |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
100 globfree(&gg); |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
101 |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
102 return 0; |
14c92818ab75
alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff
changeset
|
103 } |
21865 | 104 #endif |