static GstFlowReturn gst_kate_parse_push_buffer (GstKateParse * parse, GstBuffer * buf, gint64 granulepos) { GST_LOG_OBJECT (parse, "granulepos %16" G_GINT64_MODIFIER "x", granulepos); if (granulepos < 0) { /* packets coming not from Ogg won't have a granpos in the offset end, so we have to synthesize one here - only problem is we don't know the backlink - pretend there's none for now */ GST_INFO_OBJECT (parse, "No granulepos on buffer, synthesizing one"); granulepos = kate_duration_granule (&parse->ki, GST_BUFFER_TIMESTAMP (buf) / (double) GST_SECOND) << kate_granule_shift (&parse->ki); } GST_BUFFER_OFFSET (buf) = kate_granule_time (&parse->ki, granulepos) * GST_SECOND; GST_BUFFER_OFFSET_END (buf) = granulepos; GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_OFFSET (buf); /* Hack to flush each packet on its own page - taken off the CMML encoder element */ /* TODO: this is s***e and needs to go once I find a way to tell Ogg to flush as it messes up Matroska's track duration */ GST_BUFFER_DURATION (buf) = G_MAXINT64; gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad)); return gst_pad_push (parse->srcpad, buf); }
static GstFlowReturn gst_kate_parse_push_buffer (GstKateParse * parse, GstBuffer * buf, gint64 granulepos) { GST_LOG_OBJECT (parse, "granulepos %16" G_GINT64_MODIFIER "x", granulepos); if (granulepos < 0) { /* packets coming not from Ogg won't have a granpos in the offset end, so we have to synthesize one here - only problem is we don't know the backlink - pretend there's none for now */ GST_INFO_OBJECT (parse, "No granulepos on buffer, synthesizing one"); granulepos = kate_duration_granule (&parse->ki, GST_BUFFER_TIMESTAMP (buf) / (double) GST_SECOND) << kate_granule_shift (&parse->ki); } GST_BUFFER_OFFSET (buf) = kate_granule_time (&parse->ki, granulepos) * GST_SECOND; GST_BUFFER_OFFSET_END (buf) = granulepos; GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_OFFSET (buf); return gst_pad_push (parse->srcpad, buf); }