jpegparse: Generate timestamp if framerate is known

This change allow setting timestamp on streams that would otherwise have
no timestamp. This is useful to make a video from bunch of JPEG files. An
example of such pipeline would be:

gst-launch-1.0 multifilesrc location=%05d.jpeg caps=image/jpeg,framerate=30/1 \
               ! jpegparse ! fakesink silent=0 -v
This commit is contained in:
Nicolas Dufresne 2018-07-27 23:00:53 -04:00
parent cc746e336a
commit 5c52f866ad

View file

@ -719,6 +719,9 @@ gst_jpeg_parse_pre_push_frame (GstBaseParse * bparse, GstBaseParseFrame * frame)
GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse); GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse);
GstBuffer *outbuf = frame->buffer; GstBuffer *outbuf = frame->buffer;
if (parse->has_fps && !GST_CLOCK_TIME_IS_VALID (parse->next_ts))
parse->next_ts = bparse->segment.start;
GST_BUFFER_TIMESTAMP (outbuf) = parse->next_ts; GST_BUFFER_TIMESTAMP (outbuf) = parse->next_ts;
if (parse->has_fps && GST_CLOCK_TIME_IS_VALID (parse->next_ts) if (parse->has_fps && GST_CLOCK_TIME_IS_VALID (parse->next_ts)