| 1250 | } |
| 1251 | |
| 1252 | static void stream_component_close(VideoState *is, int stream_index) |
| 1253 | { |
| 1254 | AVFormatContext *ic = is->ic; |
| 1255 | AVCodecParameters *codecpar; |
| 1256 | |
| 1257 | if (stream_index < 0 || stream_index >= ic->nb_streams) |
| 1258 | return; |
| 1259 | codecpar = ic->streams[stream_index]->codecpar; |
| 1260 | |
| 1261 | switch (codecpar->codec_type) { |
| 1262 | case AVMEDIA_TYPE_AUDIO: |
| 1263 | decoder_abort(&is->auddec, &is->sampq); |
| 1264 | SDL_CloseAudioDevice(audio_dev); |
| 1265 | decoder_destroy(&is->auddec); |
| 1266 | swr_free(&is->swr_ctx); |
| 1267 | av_freep(&is->audio_buf1); |
| 1268 | is->audio_buf1_size = 0; |
| 1269 | is->audio_buf = NULL; |
| 1270 | |
| 1271 | if (is->rdft) { |
| 1272 | av_tx_uninit(&is->rdft); |
| 1273 | av_freep(&is->real_data); |
| 1274 | av_freep(&is->rdft_data); |
| 1275 | is->rdft = NULL; |
| 1276 | is->rdft_bits = 0; |
| 1277 | } |
| 1278 | break; |
| 1279 | case AVMEDIA_TYPE_VIDEO: |
| 1280 | decoder_abort(&is->viddec, &is->pictq); |
| 1281 | decoder_destroy(&is->viddec); |
| 1282 | break; |
| 1283 | case AVMEDIA_TYPE_SUBTITLE: |
| 1284 | decoder_abort(&is->subdec, &is->subpq); |
| 1285 | decoder_destroy(&is->subdec); |
| 1286 | break; |
| 1287 | default: |
| 1288 | break; |
| 1289 | } |
| 1290 | |
| 1291 | ic->streams[stream_index]->discard = AVDISCARD_ALL; |
| 1292 | switch (codecpar->codec_type) { |
| 1293 | case AVMEDIA_TYPE_AUDIO: |
| 1294 | is->audio_st = NULL; |
| 1295 | is->audio_stream = -1; |
| 1296 | break; |
| 1297 | case AVMEDIA_TYPE_VIDEO: |
| 1298 | is->video_st = NULL; |
| 1299 | is->video_stream = -1; |
| 1300 | break; |
| 1301 | case AVMEDIA_TYPE_SUBTITLE: |
| 1302 | is->subtitle_st = NULL; |
| 1303 | is->subtitle_stream = -1; |
| 1304 | break; |
| 1305 | default: |
| 1306 | break; |
| 1307 | } |
| 1308 | } |
| 1309 |
no test coverage detected