summaryrefslogtreecommitdiff
path: root/fftools/sync_queue.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-03-29 11:04:41 +0200
committerAnton Khirnov <anton@khirnov.net>2022-07-23 11:53:19 +0200
commit587081a1794a1f95c80c9967df135d3eb08fd17f (patch)
treeecbdecff582a3e85ab40fc07d4d49cd1f94b3136 /fftools/sync_queue.h
parent919638ff5c99e33d91974506b19d42dcee04690b (diff)
fftools/ffmpeg: use the sync queues to handle -frames
Same issues apply to it as to -shortest. Changes the results of the following tests: - matroska-flac-extradata-update The test reencodes two input FLAC streams into three output FLAC streams. The last output stream is limited to 8 frames. The current code results in the first two output streams having 12 frames, after this commit all three streams have 8 frames and are the same length. This new result is better, since it is predictable. - mkv-1242 The test streamcopies one video and one audio stream, video is limited to 11 frames. The new result shortens the audio stream so that it is not longer than the video.
Diffstat (limited to 'fftools/sync_queue.h')
-rw-r--r--fftools/sync_queue.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/fftools/sync_queue.h b/fftools/sync_queue.h
index e08780b7bf..3f823ff0d9 100644
--- a/fftools/sync_queue.h
+++ b/fftools/sync_queue.h
@@ -51,11 +51,13 @@ void sq_free(SyncQueue **sq);
/**
* Add a new stream to the sync queue.
*
+ * @param limiting whether the stream is limiting, i.e. no other stream can be
+ * longer than this one
* @return
* - a non-negative stream index on success
* - a negative error code on error
*/
-int sq_add_stream(SyncQueue *sq);
+int sq_add_stream(SyncQueue *sq, int limiting);
/**
* Set the timebase for the stream with index stream_idx. Should be called
@@ -64,6 +66,13 @@ int sq_add_stream(SyncQueue *sq);
void sq_set_tb(SyncQueue *sq, unsigned int stream_idx, AVRational tb);
/**
+ * Limit the number of output frames for stream with index stream_idx
+ * to max_frames.
+ */
+void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx,
+ uint64_t max_frames);
+
+/**
* Submit a frame for the stream with index stream_idx.
*
* On success, the sync queue takes ownership of the frame and will reset the