Add -write-first-frame-ts switch

Add -write-first-frame-ts switch that creates a .ts file next to the output
file with values from CLOCK_MONOTONIC and CLOCK_REALTIME corresponding to the
first frame to be able to synchronize video with other timestamped data.
This commit is contained in:
Victor Nova
2026-01-27 10:27:36 -05:00
committed by dec05eba
parent f4ee71a094
commit 144b481526
6 changed files with 100 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ typedef struct {
AVStream *stream;
int64_t start_pts;
bool has_received_keyframe;
char *first_frame_ts_filepath;
bool first_frame_ts_written;
} gsr_encoder_recording_destination;
typedef struct {
@@ -43,5 +45,6 @@ void gsr_encoder_receive_packets(gsr_encoder *self, AVCodecContext *codec_contex
/* Returns the id to the recording destination, or -1 on error */
size_t gsr_encoder_add_recording_destination(gsr_encoder *self, AVCodecContext *codec_context, AVFormatContext *format_context, AVStream *stream, int64_t start_pts);
bool gsr_encoder_remove_recording_destination(gsr_encoder *self, size_t id);
bool gsr_encoder_set_recording_destination_first_frame_ts_filepath(gsr_encoder *self, size_t id, const char *filepath);
#endif /* GSR_ENCODER_H */