oggmux: add more logging and fix the object param for some logging

Use data->pad instead of pad for 'object'. Reduce indentation depth in a helper
with an early return.
This commit is contained in:
Stefan Sauer 2013-04-17 07:51:38 +02:00
parent 74f6376c53
commit cdfc05ec4d

View file

@ -573,6 +573,9 @@ gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
mux->last_ts = run_time;
}
GST_LOG_OBJECT (mux->srcpad, "pushing %p, last_ts=%" GST_TIME_FORMAT,
buffer, GST_TIME_ARGS (mux->last_ts));
return gst_pad_push (mux->srcpad, buffer);
}
@ -877,6 +880,11 @@ resync:
gst_ogg_stream_granule_to_granulepos (&pad->map, granule,
pad->keyframe_granule);
GST_LOG_OBJECT (pad->collect.pad,
GST_GP_FORMAT " decorated buffer %p (granulepos time %" GST_TIME_FORMAT
")", GST_BUFFER_OFFSET_END (buf), buf,
GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
return buf;
/* ERRORS */
@ -958,6 +966,9 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
* at least) do not send headers packets, as other muxers don't
* expect/need them. */
caps = gst_pad_get_current_caps (GST_PAD_CAST (data->pad));
GST_DEBUG_OBJECT (data->pad, "checking caps: %" GST_PTR_FORMAT,
caps);
pad->have_type =
gst_ogg_stream_setup_map_from_caps_headers (&pad->map, caps);
@ -966,21 +977,22 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
pad->have_type = gst_ogg_stream_setup_map (&pad->map, &packet);
}
if (!pad->have_type) {
GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream "
"(pad caps: %" GST_PTR_FORMAT ")", caps);
GST_ERROR_OBJECT (data->pad,
"mapper didn't recognise input stream " "(pad caps: %"
GST_PTR_FORMAT ")", caps);
} else {
GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT,
GST_DEBUG_OBJECT (data->pad, "caps detected: %" GST_PTR_FORMAT,
pad->map.caps);
if (pad->map.is_sparse) {
GST_DEBUG_OBJECT (pad, "Pad is sparse, marking as such");
GST_DEBUG_OBJECT (data->pad, "Pad is sparse, marking as such");
gst_collect_pads_set_waiting (ogg_mux->collect,
(GstCollectData *) pad, FALSE);
}
if (pad->map.is_video && ogg_mux->delta_pad == NULL) {
ogg_mux->delta_pad = pad;
GST_INFO_OBJECT (pad, "selected delta pad");
GST_INFO_OBJECT (data->pad, "selected delta pad");
}
}
if (caps)
@ -1051,6 +1063,7 @@ gst_ogg_mux_get_headers (GstOggPadData * pad)
GList *res = NULL;
GstStructure *structure;
GstCaps *caps;
const GValue *streamheader;
GstPad *thepad;
thepad = pad->collect.pad;
@ -1058,46 +1071,46 @@ gst_ogg_mux_get_headers (GstOggPadData * pad)
GST_LOG_OBJECT (thepad, "getting headers");
caps = gst_pad_get_current_caps (thepad);
if (caps != NULL) {
const GValue *streamheader;
structure = gst_caps_get_structure (caps, 0);
streamheader = gst_structure_get_value (structure, "streamheader");
if (streamheader != NULL) {
GST_LOG_OBJECT (thepad, "got header");
if (G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY) {
GArray *bufarr = g_value_peek_pointer (streamheader);
gint i;
GST_LOG_OBJECT (thepad, "got fixed list");
for (i = 0; i < bufarr->len; i++) {
GValue *bufval = &g_array_index (bufarr, GValue, i);
GST_LOG_OBJECT (thepad, "item %d", i);
if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) {
GstBuffer *buf = g_value_peek_pointer (bufval);
GST_LOG_OBJECT (thepad, "adding item %d to header list", i);
gst_buffer_ref (buf);
res = g_list_append (res, buf);
}
}
} else {
GST_LOG_OBJECT (thepad, "streamheader is not fixed list");
}
} else if (gst_structure_has_name (structure, "video/x-dirac")) {
res = g_list_append (res, pad->buffer);
pad->buffer = NULL;
} else {
GST_LOG_OBJECT (thepad, "caps don't have streamheader");
}
gst_caps_unref (caps);
} else {
GST_LOG_OBJECT (thepad, "got empty caps as negotiated format");
if (caps == NULL) {
GST_INFO_OBJECT (thepad, "got empty caps as negotiated format");
return NULL;
}
structure = gst_caps_get_structure (caps, 0);
streamheader = gst_structure_get_value (structure, "streamheader");
if (streamheader != NULL) {
GST_LOG_OBJECT (thepad, "got header");
if (G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY) {
GArray *bufarr = g_value_peek_pointer (streamheader);
gint i;
GST_LOG_OBJECT (thepad, "got fixed list");
for (i = 0; i < bufarr->len; i++) {
GValue *bufval = &g_array_index (bufarr, GValue, i);
GST_LOG_OBJECT (thepad, "item %d", i);
if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) {
GstBuffer *buf = g_value_peek_pointer (bufval);
GST_LOG_OBJECT (thepad, "adding item %d to header list", i);
gst_buffer_ref (buf);
res = g_list_append (res, buf);
}
}
} else {
GST_LOG_OBJECT (thepad, "streamheader is not fixed list");
}
} else if (gst_structure_has_name (structure, "video/x-dirac")) {
res = g_list_append (res, pad->buffer);
pad->buffer = NULL;
} else {
GST_LOG_OBJECT (thepad, "caps don't have streamheader");
}
gst_caps_unref (caps);
return res;
}
@ -1389,6 +1402,8 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
if ((caps = gst_pad_get_current_caps (thepad))) {
GstStructure *structure = gst_caps_get_structure (caps, 0);
mime_type = gst_structure_get_name (structure);
} else {
GST_INFO_OBJECT (thepad, "got empty caps as negotiated format");
}
/* create a packet from the buffer */
@ -1410,7 +1425,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
GST_LOG_OBJECT (mux, "swapped out page with mime type %s", mime_type);
GST_LOG_OBJECT (mux, "swapped out page with mime type '%s'", mime_type);
/* quick hack: put video pages at the front.
* Ideally, we would have a settable enum for which Ogg
@ -1653,6 +1668,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "updated times, next ts %"
GST_TIME_FORMAT, GST_TIME_ARGS (ogg_mux->next_ts));
} else {
GST_LOG_OBJECT (ogg_mux->srcpad, "sending EOS");
/* no pad to pull on, send EOS */
gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
return GST_FLOW_FLUSHING;
@ -1967,6 +1983,7 @@ gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux)
ret = gst_ogg_mux_process_best_pad (ogg_mux, best);
if (best->eos && all_pads_eos (pads)) {
GST_LOG_OBJECT (ogg_mux->srcpad, "sending EOS");
gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
return GST_FLOW_EOS;
}
@ -2069,6 +2086,7 @@ gst_ogg_mux_clear_collectpads (GstCollectPads * collect)
ogg_stream_clear (&oggpad->map.stream);
while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
GST_LOG ("flushing buffer : %p", buf);
gst_buffer_unref (buf);
}
g_queue_free (oggpad->pagebuffers);