mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-30 19:58:17 +00:00
fftools/thread_queue: add flags parameter to tq_receive()
I want to use this to allow a non-blocking use of this function. Sponsored-by: nxtedition AB Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
@@ -2228,7 +2228,7 @@ int sch_mux_receive(Scheduler *sch, unsigned mux_idx, AVPacket *pkt)
|
||||
av_assert0(mux_idx < sch->nb_mux);
|
||||
mux = &sch->mux[mux_idx];
|
||||
|
||||
ret = tq_receive(mux->queue, &stream_idx, pkt);
|
||||
ret = tq_receive(mux->queue, &stream_idx, pkt, 0);
|
||||
pkt->stream_index = stream_idx;
|
||||
return ret;
|
||||
}
|
||||
@@ -2322,7 +2322,7 @@ int sch_dec_receive(Scheduler *sch, unsigned dec_idx, AVPacket *pkt)
|
||||
dec->expect_end_ts = 0;
|
||||
}
|
||||
|
||||
ret = tq_receive(dec->queue, &dummy, pkt);
|
||||
ret = tq_receive(dec->queue, &dummy, pkt, 0);
|
||||
av_assert0(dummy <= 0);
|
||||
|
||||
// got a flush packet, on the next call to this function the decoder
|
||||
@@ -2463,7 +2463,7 @@ int sch_enc_receive(Scheduler *sch, unsigned enc_idx, AVFrame *frame)
|
||||
av_assert0(enc_idx < sch->nb_enc);
|
||||
enc = &sch->enc[enc_idx];
|
||||
|
||||
ret = tq_receive(enc->queue, &dummy, frame);
|
||||
ret = tq_receive(enc->queue, &dummy, frame, 0);
|
||||
av_assert0(dummy <= 0);
|
||||
|
||||
return ret;
|
||||
@@ -2579,7 +2579,7 @@ int sch_filter_receive(Scheduler *sch, unsigned fg_idx,
|
||||
while (1) {
|
||||
int ret, idx;
|
||||
|
||||
ret = tq_receive(fg->queue, &idx, frame);
|
||||
ret = tq_receive(fg->queue, &idx, frame, 0);
|
||||
if (idx < 0)
|
||||
return AVERROR_EOF;
|
||||
else if (ret >= 0) {
|
||||
|
||||
@@ -194,7 +194,7 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
|
||||
return nb_finished == tq->nb_streams ? AVERROR_EOF : AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
|
||||
int tq_receive(ThreadQueue *tq, int *stream_idx, void *data, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ void tq_choke(ThreadQueue *tq, int choked);
|
||||
* written here
|
||||
* @param data the data item will be written here on success using the
|
||||
* callback provided to tq_alloc()
|
||||
* @param flags currently unused
|
||||
*
|
||||
* @return
|
||||
* - 0 a data item was successfully read; *stream_idx contains a non-negative
|
||||
* stream index
|
||||
@@ -81,7 +83,8 @@ void tq_choke(ThreadQueue *tq, int choked);
|
||||
* side has marked the given stream as finished. This will happen at most once
|
||||
* for each stream. When *stream_idx is -1, all streams are done.
|
||||
*/
|
||||
int tq_receive(ThreadQueue *tq, int *stream_idx, void *data);
|
||||
int tq_receive(ThreadQueue *tq, int *stream_idx, void *data, int flags);
|
||||
|
||||
/**
|
||||
* Mark the given stream finished from the receiving side.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user