kate: some minor clean-ups

Print flow return as string in log message; if we check the return
value of gst_buffer_new_and_alloc() we should use the _try() function
that might actually return NULL. Post error message when returning
GST_FLOW_ERROR. Use portable GLib macros to print 64-bit integers.
Don't use 0LL, that's also not portable (and unneeded here).
This commit is contained in:
Tim-Philipp Müller 2009-08-08 12:20:55 +01:00
parent 282479b443
commit 24217ee31a
2 changed files with 13 additions and 10 deletions

View file

@ -397,7 +397,7 @@ gst_kate_enc_create_buffer (GstKateEnc * ke, kate_packet * kp,
{
GstBuffer *buffer;
buffer = gst_buffer_new_and_alloc (kp->nbytes);
buffer = gst_buffer_try_new_and_alloc (kp->nbytes);
if (G_UNLIKELY (!buffer)) {
GST_WARNING_OBJECT (ke, "Failed to allocate buffer for %u bytes",
kp->nbytes);
@ -425,7 +425,7 @@ gst_kate_enc_create_buffer (GstKateEnc * ke, kate_packet * kp,
static GstFlowReturn
gst_kate_enc_push_buffer (GstKateEnc * ke, GstBuffer * buffer)
{
GstFlowReturn rflow;
GstFlowReturn flow;
ke->last_timestamp = GST_BUFFER_TIMESTAMP (buffer);
if (GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer) >
@ -437,12 +437,12 @@ gst_kate_enc_push_buffer (GstKateEnc * ke, GstBuffer * buffer)
/* Hack to flush each packet on its own page - taken off the CMML encoder element */
GST_BUFFER_DURATION (buffer) = G_MAXINT64;
rflow = gst_pad_push (ke->srcpad, buffer);
if (G_UNLIKELY (rflow != GST_FLOW_OK)) {
GST_ERROR_OBJECT (ke, "Failed to push buffer: %d", rflow);
flow = gst_pad_push (ke->srcpad, buffer);
if (G_UNLIKELY (flow != GST_FLOW_OK)) {
GST_WARNING_OBJECT (ke->srcpad, "push flow: %s", gst_flow_get_name (flow));
}
return rflow;
return flow;
}
static GstFlowReturn
@ -548,9 +548,12 @@ gst_kate_enc_send_headers (GstKateEnc * ke)
kate_packet kp;
int ret = kate_encode_headers (&ke->k, &ke->kc, &kp);
if (ret == 0) {
GstBuffer *buffer =
gst_kate_enc_create_buffer (ke, &kp, 0ll, 0ll, 0ll, TRUE);
GstBuffer *buffer;
buffer = gst_kate_enc_create_buffer (ke, &kp, 0, 0, 0, TRUE);
if (!buffer) {
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
("Failed to create buffer, %u bytes", kp.nbytes));
rflow = GST_FLOW_ERROR;
break;
}

View file

@ -242,7 +242,7 @@ static GstFlowReturn
gst_kate_parse_push_buffer (GstKateParse * parse, GstBuffer * buf,
gint64 granulepos)
{
GST_LOG_OBJECT (parse, "granulepos %16llx", 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
@ -330,7 +330,7 @@ gst_kate_parse_queue_buffer (GstKateParse * parse, GstBuffer * buf)
/* oggdemux stores the granule pos in the offset end */
granpos = GST_BUFFER_OFFSET_END (buf);
GST_LOG_OBJECT (parse, "granpos %16llx", granpos);
GST_LOG_OBJECT (parse, "granpos %16" G_GINT64_MODIFIER "x", granpos);
g_queue_push_tail (parse->buffer_queue, buf);
#if 1