2016-06-05 21:58 GMT+03:00 Timo Rothenpieler <t...@rothenpieler.org>:
> + /* check if the decoder supports CUVID and the output only goes to > this stream */ > + if (ist->nb_filters || ist->hwaccel_id != HWACCEL_CUVID || !ist->dec > || !ist->dec->pix_fmts) > + goto cancel; > + for (pix_fmt = ist->dec->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; > pix_fmt++) > + if (*pix_fmt == AV_PIX_FMT_CUDA) > + break; > + if (*pix_fmt == AV_PIX_FMT_NONE) > + goto cancel; > + > + for (i = 0; i < nb_output_streams; i++) > + if (output_streams[i] != ost && output_streams[i]->source_index > == ost->source_index) > + goto cancel; > Is it possible to enhance this to support 1-to-N transcoding (usecase solved by NVidia's patch with nvresize)? One can do the same with complex filtergraph with several scale_npp instances. This seems like a bit of over-restriction. + err = cuInit(0); > + if (err != CUDA_SUCCESS) { > + av_log(NULL, AV_LOG_ERROR, "Could not initialize the CUDA driver > API\n"); > + ret = AVERROR_UNKNOWN; > + goto error; > + } > + > + err = cuDeviceGet(&device, 0); ///TODO: Make device index configurable > + if (err != CUDA_SUCCESS) { > + av_log(NULL, AV_LOG_ERROR, "Could not get the device number > %d\n", 0); > + ret = AVERROR_UNKNOWN; > + goto error; > + } > + > + err = cuCtxCreate(&cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, device); > + if (err != CUDA_SUCCESS) { > + av_log(NULL, AV_LOG_ERROR, "Error creating a CUDA context\n"); > + ret = AVERROR_UNKNOWN; > + goto error; > + } > + > + device_ctx = (AVHWDeviceContext*)hw_device_ctx->data; > + device_ctx->free = cuvid_ctx_free; > + > + device_hwctx = device_ctx->hwctx; > + device_hwctx->cuda_ctx = cuda_ctx; > + > + err = cuCtxPopCurrent(&dummy); > + if (err != CUDA_SUCCESS) { > + av_log(NULL, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); > + ret = AVERROR_UNKNOWN; > + goto error; > + } > + It begs to merge in device_create functionality from libav _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel