diff --git a/src/guacenc/video.c b/src/guacenc/video.c index d0915af9..569a7053 100644 --- a/src/guacenc/video.c +++ b/src/guacenc/video.c @@ -102,7 +102,7 @@ guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name, /* No frames have been written or prepared yet */ video->last_timestamp = 0; - video->current_time = 0; + video->next_pts = 0; video->next_frame = NULL; return video; @@ -146,12 +146,11 @@ static int guacenc_video_flush_frame(guacenc_video* video) { packet.data = NULL; packet.size = 0; - /* STUB: Write frame to video */ - guacenc_log(GUAC_LOG_DEBUG, "Writing frame @ %" PRId64 "ms", - video->current_time); + /* TODO: Write frame to video */ + guacenc_log(GUAC_LOG_DEBUG, "Encoding frame #%08" PRId64, video->next_pts); - /* Update internal timestamp */ - video->current_time += video->frame_duration; + /* Update presentation timestamp for next frame */ + video->next_pts++; return 0; diff --git a/src/guacenc/video.h b/src/guacenc/video.h index 23879186..630cfa79 100644 --- a/src/guacenc/video.h +++ b/src/guacenc/video.h @@ -29,6 +29,8 @@ #include #include +#include + /** * A video which is actively being encoded. Frames can be added to the video * as they are generated, along with their associated timestamps, and the @@ -75,19 +77,18 @@ typedef struct guacenc_video { */ guacenc_buffer* next_frame; + /** + * The presentation timestamp that should be used for the next frame. This + * is equivalent to the frame number. + */ + int64_t next_pts; + /** * The timestamp associated with the last frame, or 0 if no frames have yet * been added. */ guac_timestamp last_timestamp; - /** - * The relative position within the current video timeline, where 0 is the - * first frame of video, in milliseconds. This value will be incremented as - * frames are output. - */ - guac_timestamp current_time; - } guacenc_video; /**