comparison libmpcodecs/dec_video.c @ 5171:7145d6aba6cd

init_video() changed - now it handles codec selection
author arpi
date Mon, 18 Mar 2002 01:47:14 +0000
parents ff8d788ecfde
children 7e77d7344208
comparison
equal deleted inserted replaced
5170:5d54fdcf066d 5171:7145d6aba6cd
114 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver); 114 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver);
115 mpvdec->uninit(sh_video); 115 mpvdec->uninit(sh_video);
116 sh_video->inited=0; 116 sh_video->inited=0;
117 } 117 }
118 118
119 int init_video(sh_video_t *sh_video,int *pitches) 119 int init_video(sh_video_t *sh_video,char* codecname,int vfm,int status){
120 { 120 sh_video->codec=NULL;
121 //unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; 121 while((sh_video->codec=find_codec(sh_video->format,
122 int i; 122 sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,
123 //pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */ 123 sh_video->codec,0) )){
124 124 // ok we found one codec
125 //sh_video->our_out_buffer=NULL; 125 int i;
126 //sh_video->our_out_buffer_size=0U; 126 if(codecname && strcmp(sh_video->codec->name,codecname)) continue; // -vc
127 127 if(vfm>=0 && sh_video->codec->driver!=vfm) continue; // vfm doesn't match
128 for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) 128 if(sh_video->codec->status<status) continue; // too unstable
129 if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver){ 129 // ok, it matches all rules, let's find the driver!
130 mpvdec=mpcodecs_vd_drivers[i]; break; 130 for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
131 if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver) break;
132 mpvdec=mpcodecs_vd_drivers[i];
133 if(!mpvdec){ // driver not available (==compiled in)
134 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Requested video codec family [%s] (vfm=%d) not available (enable it at compile time!)\n",
135 sh_video->codec->name, sh_video->codec->driver);
136 continue;
137 }
138 // it's available, let's try to init!
139 printf("Opening Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name);
140 if(!mpvdec->init(sh_video)){
141 printf("VDecoder init failed :(\n");
142 continue; // try next...
143 }
144 // Yeah! We got it!
145 sh_video->inited=1;
146 return 1;
131 } 147 }
132 if(!mpvdec){ 148 return 0;
133 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Requested video codec family [%s] (vfm=%d) not available (enable it at compile time!)\n",
134 sh_video->codec->name, sh_video->codec->driver);
135 return 0; // no such driver
136 }
137
138 printf("Selecting Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name);
139
140 if(!mpvdec->init(sh_video)){
141 printf("VDecoder init failed :(\n");
142 return 0;
143 }
144
145 sh_video->inited=1;
146 return 1;
147 } 149 }
148 150
149 extern int vaa_use_dr; 151 extern int vaa_use_dr;
150 152
151 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ 153 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){