public void Close() { if (state_ != StateKind.NotOpened) { if (avcodec_manager_.HasVideo) { drawing_thread_.Close(); } if (avcodec_manager_.HasAudio) { waveout_.Close(); } thread_end_event_.Reset(); lock (command_queue_) { command_queue_.Add(new Command(Command.Kind.EndThread)); } if (!thread_end_event_.WaitOne(3000, false)) // 3秒待って終了しなければ { main_thread_.Abort(); // 強制終了 } avcodec_manager_.Close(); Clear(); } state_ = StateKind.NotOpened; }