| 2214 | } |
| 2215 | |
| 2216 | static int video_thread(void *arg) |
| 2217 | { |
| 2218 | VideoState *is = arg; |
| 2219 | AVFrame *frame = av_frame_alloc(); |
| 2220 | double pts; |
| 2221 | double duration; |
| 2222 | int ret; |
| 2223 | AVRational tb = is->video_st->time_base; |
| 2224 | AVRational frame_rate = av_guess_frame_rate(is->ic, is->video_st, NULL); |
| 2225 | |
| 2226 | AVFilterGraph *graph = NULL; |
| 2227 | AVFilterContext *filt_out = NULL, *filt_in = NULL; |
| 2228 | int last_w = 0; |
| 2229 | int last_h = 0; |
| 2230 | enum AVPixelFormat last_format = -2; |
| 2231 | int last_serial = -1; |
| 2232 | int last_vfilter_idx = 0; |
| 2233 | |
| 2234 | if (!frame) |
| 2235 | return AVERROR(ENOMEM); |
| 2236 | |
| 2237 | for (;;) { |
| 2238 | ret = get_video_frame(is, frame); |
| 2239 | if (ret < 0) |
| 2240 | goto the_end; |
| 2241 | if (!ret) |
| 2242 | continue; |
| 2243 | |
| 2244 | if ( last_w != frame->width |
| 2245 | || last_h != frame->height |
| 2246 | || last_format != frame->format |
| 2247 | || last_serial != is->viddec.pkt_serial |
| 2248 | || last_vfilter_idx != is->vfilter_idx) { |
| 2249 | av_log(NULL, AV_LOG_DEBUG, |
| 2250 | "Video frame changed from size:%dx%d format:%s serial:%d to size:%dx%d format:%s serial:%d\n", |
| 2251 | last_w, last_h, |
| 2252 | (const char *)av_x_if_null(av_get_pix_fmt_name(last_format), "none"), last_serial, |
| 2253 | frame->width, frame->height, |
| 2254 | (const char *)av_x_if_null(av_get_pix_fmt_name(frame->format), "none"), is->viddec.pkt_serial); |
| 2255 | avfilter_graph_free(&graph); |
| 2256 | graph = avfilter_graph_alloc(); |
| 2257 | if (!graph) { |
| 2258 | ret = AVERROR(ENOMEM); |
| 2259 | goto the_end; |
| 2260 | } |
| 2261 | graph->nb_threads = filter_nbthreads; |
| 2262 | if ((ret = configure_video_filters(graph, is, vfilters_list ? vfilters_list[is->vfilter_idx] : NULL, frame)) < 0) { |
| 2263 | SDL_Event event; |
| 2264 | event.type = FF_QUIT_EVENT; |
| 2265 | event.user.data1 = is; |
| 2266 | SDL_PushEvent(&event); |
| 2267 | goto the_end; |
| 2268 | } |
| 2269 | filt_in = is->in_video_filter; |
| 2270 | filt_out = is->out_video_filter; |
| 2271 | last_w = frame->width; |
| 2272 | last_h = frame->height; |
| 2273 | last_format = frame->format; |
nothing calls this directly
no test coverage detected