static void vda_close(struct media_codec *mc) { vda_decoder_t *vdad = mc->opaque; VDADecoderFlush(vdad->vdad_decoder, 0); VDADecoderDestroy(vdad->vdad_decoder); destroy_frames(vdad); }
void CDVDVideoCodecVDA::Reset(void) { CCocoaAutoPool pool; VDADecoderFlush((VDADecoder)m_vda_decoder, 0); while (m_queue_depth) DisplayQueuePop(); m_sort_time = 0; }
nsresult AppleVDADecoder::Drain() { mTaskQueue->AwaitIdle(); OSStatus rv = VDADecoderFlush(mDecoder, kVDADecoderFlush_EmitFrames); if (rv != noErr) { LOG("AppleVDADecoder::Drain failed waiting for platform decoder " "with error:%d.", rv); } DrainReorderedFrames(); mCallback->DrainComplete(); return NS_OK; }
nsresult AppleVDADecoder::Flush() { mTaskQueue->Flush(); OSStatus rv = VDADecoderFlush(mDecoder, 0 /*dont emit*/); if (rv != noErr) { LOG("AppleVDADecoder::Flush failed waiting for platform decoder " "with error:%d.", rv); } ClearReorderedFrames(); return NS_OK; }
void AppleVDADecoder::ProcessDrain() { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); OSStatus rv = VDADecoderFlush(mDecoder, kVDADecoderFlush_EmitFrames); if (rv != noErr) { LOG("AppleVDADecoder::Drain failed waiting for platform decoder " "with error:%d.", rv); } DrainReorderedFrames(); mCallback->DrainComplete(); }
static void vda_flush(struct media_codec *mc, struct video_decoder *vd) { vda_decoder_t *vdad = mc->opaque; VDADecoderFlush(vdad->vdad_decoder, 1); hts_mutex_lock(&vdad->vdad_mutex); destroy_frames(vdad); vdad->vdad_max_ts = PTS_UNSET; vdad->vdad_flush_to = PTS_UNSET; vdad->vdad_last_pts = PTS_UNSET; hts_mutex_unlock(&vdad->vdad_mutex); }
void AppleVDADecoder::ProcessFlush() { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); OSStatus rv = VDADecoderFlush(mDecoder, 0 /*dont emit*/); if (rv != noErr) { LOG("AppleVDADecoder::Flush failed waiting for platform decoder " "with error:%d.", rv); } ClearReorderedFrames(); MonitorAutoLock mon(mMonitor); mIsFlushing = false; mon.NotifyAll(); }
static int vda_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; VDAContext *vda = avctx->internal->hwaccel_priv_data; AVVDAContext *vda_ctx = avctx->hwaccel_context; AVFrame *frame = h->cur_pic_ptr->f; uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames CFDataRef coded_frame; OSStatus status; if (!vda->bitstream_size) return AVERROR_INVALIDDATA; coded_frame = CFDataCreate(kCFAllocatorDefault, vda->bitstream, vda->bitstream_size); status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL); if (status == kVDADecoderNoErr) status = VDADecoderFlush(vda_ctx->decoder, flush_flags); CFRelease(coded_frame); if (!vda->frame) return AVERROR_UNKNOWN; if (status != kVDADecoderNoErr) { av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status); return AVERROR_UNKNOWN; } av_buffer_unref(&frame->buf[0]); frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, sizeof(vda->frame), release_buffer, NULL, AV_BUFFER_FLAG_READONLY); if (!frame->buf[0]) return AVERROR(ENOMEM); frame->data[3] = (uint8_t*)vda->frame; vda->frame = NULL; return 0; }
static int vda_sync_decode(struct vda_context *vda_ctx) { OSStatus status; CFDataRef coded_frame; uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames coded_frame = CFDataCreate(kCFAllocatorDefault, vda_ctx->priv_bitstream, vda_ctx->priv_bitstream_size); status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL); if (kVDADecoderNoErr == status) status = VDADecoderFlush(vda_ctx->decoder, flush_flags); CFRelease(coded_frame); return status; }
int CDVDVideoCodecVDA::Decode(uint8_t* pData, int iSize, double dts, double pts) { CCocoaAutoPool pool; // if (pData) { m_bitstream->Convert(pData, iSize); CFDataRef avc_demux = CFDataCreate(kCFAllocatorDefault, m_bitstream->GetConvertBuffer(), m_bitstream->GetConvertSize()); CFDictionaryRef avc_time = CreateDictionaryWithDisplayTime(m_sort_time++, dts, pts); uint32_t avc_flags = 0; if (m_DropPictures) avc_flags = kVDADecoderDecodeFlags_DontEmitFrame; OSStatus status = VDADecoderDecode((VDADecoder)m_vda_decoder, avc_flags, avc_demux, avc_time); CFRelease(avc_time); CFRelease(avc_demux); if (status != kVDADecoderNoErr) { CLog::Log(LOGNOTICE, "%s - VDADecoderDecode failed, status(%d)", __FUNCTION__, (int)status); return VC_ERROR; } } if (!m_decode_async) { // force synchronous decode to fix issues with ATI GPUs, // we still have to sort returned frames by pts to handle out-of-order demuxer packets. VDADecoderFlush((VDADecoder)m_vda_decoder, kVDADecoderFlush_EmitFrames); } if (m_queue_depth < m_max_ref_frames) return VC_BUFFER; return VC_PICTURE; }
void MoonVDADecoder::CleanState () { VDADecoderFlush (decoder, 0); }