mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
ogg: rationalize serialno type to guint32
It is a 32 bit unsigned number. Sure, the libogg API uses a long, but that's an unfortunate oversight. https://bugzilla.gnome.org/show_bug.cgi?id=656775
This commit is contained in:
parent
684b90ba74
commit
5bbf7109ec
3 changed files with 60 additions and 40 deletions
|
@ -116,7 +116,7 @@ static gboolean gst_ogg_pad_src_query (GstPad * pad, GstQuery * query);
|
||||||
static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event);
|
||||||
static GstCaps *gst_ogg_pad_getcaps (GstPad * pad);
|
static GstCaps *gst_ogg_pad_getcaps (GstPad * pad);
|
||||||
static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
|
static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
|
||||||
glong serialno);
|
guint32 serialno);
|
||||||
|
|
||||||
static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg,
|
static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg,
|
||||||
GstOggPad * pad, GstFlowReturn ret);
|
GstOggPad * pad, GstFlowReturn ret);
|
||||||
|
@ -427,8 +427,8 @@ gst_ogg_demux_queue_data (GstOggPad * pad, ogg_packet * packet)
|
||||||
GstOggDemux *ogg = pad->ogg;
|
GstOggDemux *ogg = pad->ogg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08lx", pad,
|
GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08" G_GINT32_MODIFIER "x",
|
||||||
pad->map.serialno);
|
pad, pad->map.serialno);
|
||||||
|
|
||||||
pad->map.queued = g_list_append (pad->map.queued, _ogg_packet_copy (packet));
|
pad->map.queued = g_list_append (pad->map.queued, _ogg_packet_copy (packet));
|
||||||
|
|
||||||
|
@ -455,7 +455,8 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
|
||||||
cret = GST_FLOW_OK;
|
cret = GST_FLOW_OK;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ogg,
|
GST_DEBUG_OBJECT (ogg,
|
||||||
"%p streaming to peer serial %08lx", pad, pad->map.serialno);
|
"%p streaming to peer serial %08" G_GINT32_MODIFIER "x", pad,
|
||||||
|
pad->map.serialno);
|
||||||
|
|
||||||
if (pad->map.is_ogm) {
|
if (pad->map.is_ogm) {
|
||||||
const guint8 *data;
|
const guint8 *data;
|
||||||
|
@ -705,8 +706,8 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
|
||||||
|
|
||||||
GstOggDemux *ogg = pad->ogg;
|
GstOggDemux *ogg = pad->ogg;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08lx", pad,
|
GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08" G_GINT32_MODIFIER "x",
|
||||||
pad->map.serialno);
|
pad, pad->map.serialno);
|
||||||
|
|
||||||
if (!pad->have_type) {
|
if (!pad->have_type) {
|
||||||
pad->have_type = gst_ogg_stream_setup_map (&pad->map, packet);
|
pad->have_type = gst_ogg_stream_setup_map (&pad->map, packet);
|
||||||
|
@ -979,8 +980,8 @@ gst_ogg_pad_stream_out (GstOggPad * pad, gint npackets)
|
||||||
could_not_submit:
|
could_not_submit:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (ogg,
|
GST_WARNING_OBJECT (ogg,
|
||||||
"could not submit packet for stream %08lx, error: %d",
|
"could not submit packet for stream %08" G_GINT32_MODIFIER
|
||||||
pad->map.serialno, result);
|
"x, error: %d", pad->map.serialno, result);
|
||||||
gst_ogg_pad_reset (pad);
|
gst_ogg_pad_reset (pad);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1072,8 +1073,8 @@ done:
|
||||||
choked:
|
choked:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (ogg,
|
GST_WARNING_OBJECT (ogg,
|
||||||
"ogg stream choked on page (serial %08lx), resetting stream",
|
"ogg stream choked on page (serial %08" G_GINT32_MODIFIER
|
||||||
pad->map.serialno);
|
"x), resetting stream", pad->map.serialno);
|
||||||
gst_ogg_pad_reset (pad);
|
gst_ogg_pad_reset (pad);
|
||||||
/* we continue to recover */
|
/* we continue to recover */
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
@ -1146,14 +1147,15 @@ gst_ogg_chain_reset (GstOggChain * chain)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstOggPad *
|
static GstOggPad *
|
||||||
gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
|
gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
|
||||||
{
|
{
|
||||||
GstOggPad *ret;
|
GstOggPad *ret;
|
||||||
GstTagList *list;
|
GstTagList *list;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (chain->ogg, "creating new stream %08lx in chain %p",
|
GST_DEBUG_OBJECT (chain->ogg,
|
||||||
serialno, chain);
|
"creating new stream %08" G_GINT32_MODIFIER "x in chain %p", serialno,
|
||||||
|
chain);
|
||||||
|
|
||||||
ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
|
ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
|
||||||
/* we own this one */
|
/* we own this one */
|
||||||
|
@ -1170,7 +1172,7 @@ gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
|
||||||
if (ogg_stream_init (&ret->map.stream, serialno) != 0)
|
if (ogg_stream_init (&ret->map.stream, serialno) != 0)
|
||||||
goto init_failed;
|
goto init_failed;
|
||||||
|
|
||||||
name = g_strdup_printf ("serial_%08lx", serialno);
|
name = g_strdup_printf ("serial_%08" G_GINT32_MODIFIER "x", serialno);
|
||||||
gst_object_set_name (GST_OBJECT (ret), name);
|
gst_object_set_name (GST_OBJECT (ret), name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
|
@ -1181,7 +1183,8 @@ gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (chain->ogg,
|
GST_DEBUG_OBJECT (chain->ogg,
|
||||||
"created new ogg src %p for stream with serial %08lx", ret, serialno);
|
"created new ogg src %p for stream with serial %08" G_GINT32_MODIFIER "x",
|
||||||
|
ret, serialno);
|
||||||
|
|
||||||
g_array_append_val (chain->streams, ret);
|
g_array_append_val (chain->streams, ret);
|
||||||
|
|
||||||
|
@ -1190,15 +1193,15 @@ gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
init_failed:
|
init_failed:
|
||||||
{
|
{
|
||||||
GST_ERROR ("Could not initialize ogg_stream struct for serial %08lx.",
|
GST_ERROR ("Could not initialize ogg_stream struct for serial %08"
|
||||||
serialno);
|
G_GINT32_MODIFIER "x.", serialno);
|
||||||
gst_object_unref (ret);
|
gst_object_unref (ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstOggPad *
|
static GstOggPad *
|
||||||
gst_ogg_chain_get_stream (GstOggChain * chain, glong serialno)
|
gst_ogg_chain_get_stream (GstOggChain * chain, guint32 serialno)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
@ -1212,7 +1215,7 @@ gst_ogg_chain_get_stream (GstOggChain * chain, glong serialno)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_ogg_chain_has_stream (GstOggChain * chain, glong serialno)
|
gst_ogg_chain_has_stream (GstOggChain * chain, guint32 serialno)
|
||||||
{
|
{
|
||||||
return gst_ogg_chain_get_stream (chain, serialno) != NULL;
|
return gst_ogg_chain_get_stream (chain, serialno) != NULL;
|
||||||
}
|
}
|
||||||
|
@ -2165,7 +2168,8 @@ gst_ogg_demux_do_seek (GstOggDemux * ogg, GstSegment * segment,
|
||||||
/* get time of the keyframe */
|
/* get time of the keyframe */
|
||||||
keyframe_time =
|
keyframe_time =
|
||||||
gst_ogg_stream_granule_to_time (&pad->map, pad->keyframe_granule);
|
gst_ogg_stream_granule_to_time (&pad->map, pad->keyframe_granule);
|
||||||
GST_LOG_OBJECT (ogg, "stream %08lx granule time %" GST_TIME_FORMAT,
|
GST_LOG_OBJECT (ogg,
|
||||||
|
"stream %08" G_GINT32_MODIFIER "x granule time %" GST_TIME_FORMAT,
|
||||||
pad->map.serialno, GST_TIME_ARGS (keyframe_time));
|
pad->map.serialno, GST_TIME_ARGS (keyframe_time));
|
||||||
|
|
||||||
/* collect smallest value */
|
/* collect smallest value */
|
||||||
|
@ -2586,7 +2590,7 @@ gst_ogg_demux_bisect_forward_serialno (GstOggDemux * ogg,
|
||||||
if (ret == GST_FLOW_UNEXPECTED) {
|
if (ret == GST_FLOW_UNEXPECTED) {
|
||||||
endsearched = bisect;
|
endsearched = bisect;
|
||||||
} else if (ret == GST_FLOW_OK) {
|
} else if (ret == GST_FLOW_OK) {
|
||||||
glong serial = ogg_page_serialno (&og);
|
guint32 serial = ogg_page_serialno (&og);
|
||||||
|
|
||||||
if (!gst_ogg_chain_has_stream (chain, serial)) {
|
if (!gst_ogg_chain_has_stream (chain, serial)) {
|
||||||
endsearched = bisect;
|
endsearched = bisect;
|
||||||
|
@ -2655,7 +2659,7 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
||||||
* the decoders, send data to the decoders. */
|
* the decoders, send data to the decoders. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
GstOggPad *pad;
|
GstOggPad *pad;
|
||||||
glong serial;
|
guint32 serial;
|
||||||
|
|
||||||
ret = gst_ogg_demux_get_next_page (ogg, &op, -1, NULL);
|
ret = gst_ogg_demux_get_next_page (ogg, &op, -1, NULL);
|
||||||
if (ret != GST_FLOW_OK) {
|
if (ret != GST_FLOW_OK) {
|
||||||
|
@ -2678,7 +2682,8 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
||||||
|
|
||||||
serial = ogg_page_serialno (&op);
|
serial = ogg_page_serialno (&op);
|
||||||
if (gst_ogg_chain_get_stream (chain, serial) != NULL) {
|
if (gst_ogg_chain_get_stream (chain, serial) != NULL) {
|
||||||
GST_WARNING_OBJECT (ogg, "found serial %08lx BOS page twice, ignoring",
|
GST_WARNING_OBJECT (ogg,
|
||||||
|
"found serial %08" G_GINT32_MODIFIER "x BOS page twice, ignoring",
|
||||||
serial);
|
serial);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2719,7 +2724,7 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
||||||
|
|
||||||
done = FALSE;
|
done = FALSE;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
glong serial;
|
guint32 serial;
|
||||||
gboolean known_serial = FALSE;
|
gboolean known_serial = FALSE;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
@ -2728,7 +2733,8 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
||||||
for (i = 0; i < chain->streams->len; i++) {
|
for (i = 0; i < chain->streams->len; i++) {
|
||||||
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "serial %08lx time %" GST_TIME_FORMAT,
|
GST_LOG_OBJECT (ogg,
|
||||||
|
"serial %08" G_GINT32_MODIFIER "x time %" GST_TIME_FORMAT,
|
||||||
pad->map.serialno, GST_TIME_ARGS (pad->start_time));
|
pad->map.serialno, GST_TIME_ARGS (pad->start_time));
|
||||||
|
|
||||||
if (pad->map.serialno == serial) {
|
if (pad->map.serialno == serial) {
|
||||||
|
@ -2752,14 +2758,15 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
||||||
if (!pad->map.is_sparse)
|
if (!pad->map.is_sparse)
|
||||||
done &= (pad->start_time != GST_CLOCK_TIME_NONE);
|
done &= (pad->start_time != GST_CLOCK_TIME_NONE);
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "done %08lx now %d", pad->map.serialno, done);
|
GST_LOG_OBJECT (ogg, "done %08" G_GINT32_MODIFIER "x now %d",
|
||||||
|
pad->map.serialno, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we read a page not belonging to the current chain: seek back to the
|
/* we read a page not belonging to the current chain: seek back to the
|
||||||
* beginning of the chain
|
* beginning of the chain
|
||||||
*/
|
*/
|
||||||
if (!known_serial) {
|
if (!known_serial) {
|
||||||
GST_LOG_OBJECT (ogg, "unknown serial %08lx", serial);
|
GST_LOG_OBJECT (ogg, "unknown serial %08" G_GINT32_MODIFIER "x", serial);
|
||||||
gst_ogg_demux_seek (ogg, offset);
|
gst_ogg_demux_seek (ogg, offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2856,7 +2863,7 @@ gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain)
|
||||||
/* find a pad with a given serial number
|
/* find a pad with a given serial number
|
||||||
*/
|
*/
|
||||||
static GstOggPad *
|
static GstOggPad *
|
||||||
gst_ogg_demux_find_pad (GstOggDemux * ogg, glong serialno)
|
gst_ogg_demux_find_pad (GstOggDemux * ogg, guint32 serialno)
|
||||||
{
|
{
|
||||||
GstOggPad *pad;
|
GstOggPad *pad;
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -2888,7 +2895,7 @@ gst_ogg_demux_find_pad (GstOggDemux * ogg, glong serialno)
|
||||||
/* find a chain with a given serial number
|
/* find a chain with a given serial number
|
||||||
*/
|
*/
|
||||||
static GstOggChain *
|
static GstOggChain *
|
||||||
gst_ogg_demux_find_chain (GstOggDemux * ogg, glong serialno)
|
gst_ogg_demux_find_chain (GstOggDemux * ogg, guint32 serialno)
|
||||||
{
|
{
|
||||||
GstOggPad *pad;
|
GstOggPad *pad;
|
||||||
|
|
||||||
|
@ -2957,7 +2964,7 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg)
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
gulong serialno;
|
guint32 serialno;
|
||||||
GstOggChain *chain;
|
GstOggChain *chain;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
@ -3046,16 +3053,16 @@ gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
|
||||||
{
|
{
|
||||||
GstOggPad *pad;
|
GstOggPad *pad;
|
||||||
gint64 granule;
|
gint64 granule;
|
||||||
glong serialno;
|
guint32 serialno;
|
||||||
GstFlowReturn result = GST_FLOW_OK;
|
GstFlowReturn result = GST_FLOW_OK;
|
||||||
|
|
||||||
serialno = ogg_page_serialno (page);
|
serialno = ogg_page_serialno (page);
|
||||||
granule = ogg_page_granulepos (page);
|
granule = ogg_page_granulepos (page);
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg,
|
GST_LOG_OBJECT (ogg,
|
||||||
"processing ogg page (serial %08lx, pageno %ld, granulepos %"
|
"processing ogg page (serial %08" G_GINT32_MODIFIER
|
||||||
G_GINT64_FORMAT ", bos %d)",
|
"x, pageno %ld, granulepos %" G_GINT64_FORMAT ", bos %d)", serialno,
|
||||||
serialno, ogg_page_pageno (page), granule, ogg_page_bos (page));
|
ogg_page_pageno (page), granule, ogg_page_bos (page));
|
||||||
|
|
||||||
if (ogg_page_bos (page)) {
|
if (ogg_page_bos (page)) {
|
||||||
GstOggChain *chain;
|
GstOggChain *chain;
|
||||||
|
@ -3122,7 +3129,9 @@ gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
|
||||||
/* no pad. This means an ogg page without bos has been seen for this
|
/* no pad. This means an ogg page without bos has been seen for this
|
||||||
* serialno. we just ignore it but post a warning... */
|
* serialno. we just ignore it but post a warning... */
|
||||||
GST_ELEMENT_WARNING (ogg, STREAM, DECODE,
|
GST_ELEMENT_WARNING (ogg, STREAM, DECODE,
|
||||||
(NULL), ("unknown ogg pad for serial %08lx detected", serialno));
|
(NULL),
|
||||||
|
("unknown ogg pad for serial %08" G_GINT32_MODIFIER "x detected",
|
||||||
|
serialno));
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -3131,7 +3140,9 @@ gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
|
||||||
unknown_chain:
|
unknown_chain:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
|
||||||
(NULL), ("unknown ogg chain for serial %08lx detected", serialno));
|
(NULL),
|
||||||
|
("unknown ogg chain for serial %08" G_GINT32_MODIFIER "x detected",
|
||||||
|
serialno));
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3674,7 +3685,8 @@ gst_ogg_print (GstOggDemux * ogg)
|
||||||
for (j = 0; j < chain->streams->len; j++) {
|
for (j = 0; j < chain->streams->len; j++) {
|
||||||
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, j);
|
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, j);
|
||||||
|
|
||||||
GST_INFO_OBJECT (ogg, " stream %08lx:", stream->map.serialno);
|
GST_INFO_OBJECT (ogg, " stream %08" G_GINT32_MODIFIER "x:",
|
||||||
|
stream->map.serialno);
|
||||||
GST_INFO_OBJECT (ogg, " start time: %" GST_TIME_FORMAT,
|
GST_INFO_OBJECT (ogg, " start time: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (stream->start_time));
|
GST_TIME_ARGS (stream->start_time));
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,7 +414,7 @@ gst_ogg_mux_request_new_pad (GstElement * element,
|
||||||
goto wrong_template;
|
goto wrong_template;
|
||||||
|
|
||||||
{
|
{
|
||||||
gint serial;
|
guint32 serial;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
if (req_name == NULL || strlen (req_name) < 6) {
|
if (req_name == NULL || strlen (req_name) < 6) {
|
||||||
|
@ -422,7 +422,15 @@ gst_ogg_mux_request_new_pad (GstElement * element,
|
||||||
serial = gst_ogg_mux_generate_serialno (ogg_mux);
|
serial = gst_ogg_mux_generate_serialno (ogg_mux);
|
||||||
} else {
|
} else {
|
||||||
/* parse serial number from requested padname */
|
/* parse serial number from requested padname */
|
||||||
serial = atoi (&req_name[5]);
|
unsigned long long_serial;
|
||||||
|
char *endptr = NULL;
|
||||||
|
long_serial = strtoul (&req_name[5], &endptr, 10);
|
||||||
|
if ((endptr && *endptr) || (long_serial & ~0xffffffff)) {
|
||||||
|
GST_WARNING_OBJECT (ogg_mux, "Invalid serial number specification: %s",
|
||||||
|
req_name + 5);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
serial = (guint32) long_serial;
|
||||||
}
|
}
|
||||||
/* create new pad with the name */
|
/* create new pad with the name */
|
||||||
GST_DEBUG_OBJECT (ogg_mux, "Creating new pad for serial %d", serial);
|
GST_DEBUG_OBJECT (ogg_mux, "Creating new pad for serial %d", serial);
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct _GstOggStream
|
||||||
{
|
{
|
||||||
ogg_stream_state stream;
|
ogg_stream_state stream;
|
||||||
|
|
||||||
glong serialno;
|
guint32 serialno;
|
||||||
GList *headers;
|
GList *headers;
|
||||||
gboolean have_headers;
|
gboolean have_headers;
|
||||||
GList *queued;
|
GList *queued;
|
||||||
|
|
Loading…
Reference in a new issue