[FFmpeg-devel] [PATCH v2 1/2] avcodec/cuvid: add cuvid decoder
Andrey Turkin
andrey.turkin at gmail.com
Tue Jun 7 04:16:52 CEST 2016
2016-06-07 1:08 GMT+03:00 Timo Rothenpieler <timo at rothenpieler.org>:
> + if (ctx->cudecoder) {
> + av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not
> supported\n");
> + ctx->internal_error = AVERROR(EINVAL);
> + return 0;
> + }
> +
> + if (hwframe_ctx->pool) {
> + av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already
> initialized\n");
> + ctx->internal_error = AVERROR(EINVAL);
> + return 0;
> + }
>
Good enough for initial implementation but eventually should be revisited -
on-the-fly video parameter changes can occur in the wild.
Rest of ffmpeg might not be ready for changing hw_frames_ctx though.
+ if (avpkt->size && filtered_packet.size) {
> + cupkt.payload_size = filtered_packet.size;
> + cupkt.payload = filtered_packet.data;
> +
> + if (filtered_packet.pts != AV_NOPTS_VALUE) {
> + cupkt.flags = CUVID_PKT_TIMESTAMP;
> + cupkt.timestamp = av_rescale_q(filtered_packet.pts,
> avctx->time_base, (AVRational){1, 10000000});
> + }
> + } else {
> + cupkt.flags = CUVID_PKT_ENDOFSTREAM;
> + }
>
This works for this particular bsf but it is still a wrong logic.
filtered_packet has nothing to do with EOS signalling. If filtered_packet
is ever empty and avpkt isn't - that just means BSF didn't output anything
for that particular packet and there is nothing to do.
More information about the ffmpeg-devel
mailing list