bool PrivateDecoderCrystalHD::Reset(void) { if (m_fetcher_thread) { m_fetcher_pause = true; int tries = 0; while (!m_fetcher_paused && (tries++ < 50)) usleep(10000); if (!m_fetcher_paused) LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to pause fetcher thread"); } QMutexLocker lock(&m_decoded_frames_lock); free_frame(m_frame); m_frame = NULL; for (int i = 0; i < m_decoded_frames.size(); i++) free_frame(m_decoded_frames[i]); m_decoded_frames.clear(); for (int i = 0; i < m_packet_buffers.size(); i++) free_buffer(m_packet_buffers[i]); m_packet_buffers.clear(); if (!m_device) return true; if (m_device_type != BC_70015) { INIT_ST; st = DtsFlushInput(m_device, 2); CHECK_ST; } return true;; }
static void flush(AVCodecContext *avctx) { CHDContext *priv = avctx->priv_data; avctx->has_b_frames = 0; priv->last_picture = -1; priv->output_ready = 0; priv->need_second_field = 0; priv->skip_next_output = 0; priv->decode_wait = BASE_WAIT; if (priv->pic.data[0]) avctx->release_buffer(avctx, &priv->pic); /* Flush mode 4 flushes all software and hardware buffers. */ DtsFlushInput(priv->dev, 4); }