| 1308 | } |
| 1309 | |
| 1310 | static void stream_close(VideoState *is) |
| 1311 | { |
| 1312 | /* XXX: use a special url_shutdown call to abort parse cleanly */ |
| 1313 | is->abort_request = 1; |
| 1314 | SDL_WaitThread(is->read_tid, NULL); |
| 1315 | |
| 1316 | /* close each stream */ |
| 1317 | if (is->audio_stream >= 0) |
| 1318 | stream_component_close(is, is->audio_stream); |
| 1319 | if (is->video_stream >= 0) |
| 1320 | stream_component_close(is, is->video_stream); |
| 1321 | if (is->subtitle_stream >= 0) |
| 1322 | stream_component_close(is, is->subtitle_stream); |
| 1323 | |
| 1324 | avformat_close_input(&is->ic); |
| 1325 | |
| 1326 | packet_queue_destroy(&is->videoq); |
| 1327 | packet_queue_destroy(&is->audioq); |
| 1328 | packet_queue_destroy(&is->subtitleq); |
| 1329 | |
| 1330 | /* free all pictures */ |
| 1331 | frame_queue_destroy(&is->pictq); |
| 1332 | frame_queue_destroy(&is->sampq); |
| 1333 | frame_queue_destroy(&is->subpq); |
| 1334 | SDL_DestroyCond(is->continue_read_thread); |
| 1335 | sws_freeContext(is->sub_convert_ctx); |
| 1336 | av_free(is->filename); |
| 1337 | if (is->vis_texture) |
| 1338 | SDL_DestroyTexture(is->vis_texture); |
| 1339 | if (is->vid_texture) |
| 1340 | SDL_DestroyTexture(is->vid_texture); |
| 1341 | if (is->sub_texture) |
| 1342 | SDL_DestroyTexture(is->sub_texture); |
| 1343 | av_free(is); |
| 1344 | } |
| 1345 | |
| 1346 | static void do_exit(VideoState *is) |
| 1347 | { |
no test coverage detected