ogg: move the "always flush page" to oggstream

It avoids checking for specific media types in the muxer.

https://bugzilla.gnome.org/show_bug.cgi?id=656775
This commit is contained in:
Vincent Penquerc'h 2011-08-17 18:48:54 +01:00 committed by Sebastian Dröge
parent fd8434fc74
commit 8304b7b40d
4 changed files with 7 additions and 10 deletions

View file

@ -1069,13 +1069,9 @@ gst_ogg_mux_get_headers (GstOggPadData * pad)
GST_LOG_OBJECT (thepad, "streamheader is not fixed list"); GST_LOG_OBJECT (thepad, "streamheader is not fixed list");
} }
/* Start a new page for every CMML buffer */
if (gst_structure_has_name (structure, "text/x-cmml"))
pad->always_flush_page = TRUE;
} else if (gst_structure_has_name (structure, "video/x-dirac")) { } else if (gst_structure_has_name (structure, "video/x-dirac")) {
res = g_list_append (res, pad->buffer); res = g_list_append (res, pad->buffer);
pad->buffer = NULL; pad->buffer = NULL;
pad->always_flush_page = TRUE;
} else { } else {
GST_LOG_OBJECT (thepad, "caps don't have streamheader"); GST_LOG_OBJECT (thepad, "caps don't have streamheader");
} }
@ -1246,9 +1242,6 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
hbufs = g_list_append (hbufs, hbuf); hbufs = g_list_append (hbufs, hbuf);
} }
if (gst_structure_has_name (structure, "video/x-dirac")) {
pad->always_flush_page = TRUE;
}
gst_caps_unref (caps); gst_caps_unref (caps);
} }
@ -1494,7 +1487,8 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
tmpbuf = NULL; tmpbuf = NULL;
/* we flush when we see a new keyframe */ /* we flush when we see a new keyframe */
force_flush = (pad->prev_delta && !delta_unit) || pad->always_flush_page; force_flush = (pad->prev_delta && !delta_unit)
|| pad->map.always_flush_page;
if (duration != -1) { if (duration != -1) {
pad->duration += duration; pad->duration += duration;
/* if page duration exceeds max, flush page */ /* if page duration exceeds max, flush page */

View file

@ -83,8 +83,6 @@ typedef struct
gint64 keyframe_granule; /* granule of last preceding keyframe */ gint64 keyframe_granule; /* granule of last preceding keyframe */
GstPadEventFunction collect_event; GstPadEventFunction collect_event;
gboolean always_flush_page;
} }
GstOggPadData; GstOggPadData;

View file

@ -474,6 +474,7 @@ setup_dirac_mapper (GstOggStream * pad, ogg_packet * packet)
} }
pad->is_video = TRUE; pad->is_video = TRUE;
pad->always_flush_page = TRUE;
pad->granulerate_n = header.frame_rate_numerator * 2; pad->granulerate_n = header.frame_rate_numerator * 2;
pad->granulerate_d = header.frame_rate_denominator; pad->granulerate_d = header.frame_rate_denominator;
pad->granuleshift = 22; pad->granuleshift = 22;
@ -1668,6 +1669,7 @@ setup_cmml_mapper (GstOggStream * pad, ogg_packet * packet)
GST_DEBUG ("blocksize1: %u", 1 << (data[0] & 0x0F)); GST_DEBUG ("blocksize1: %u", 1 << (data[0] & 0x0F));
pad->caps = gst_caps_new_simple ("text/x-cmml", NULL); pad->caps = gst_caps_new_simple ("text/x-cmml", NULL);
pad->always_flush_page = TRUE;
pad->is_sparse = TRUE; pad->is_sparse = TRUE;
return TRUE; return TRUE;
@ -1729,6 +1731,7 @@ setup_kate_mapper (GstOggStream * pad, ogg_packet * packet)
} }
pad->is_sparse = TRUE; pad->is_sparse = TRUE;
pad->always_flush_page = TRUE;
return TRUE; return TRUE;
} }

View file

@ -73,6 +73,8 @@ struct _GstOggStream
GstCaps *caps; GstCaps *caps;
gboolean is_video; gboolean is_video;
gboolean always_flush_page;
/* vorbis stuff */ /* vorbis stuff */
int nln_increments[4]; int nln_increments[4];
int nsn_increment; int nsn_increment;