resindvd: Start with a larger subpicture queue for preroll.

Shrink the queue once we're prerolled. Fixes the Fringe S1
DVD. Also, ensure we only fire no_more_pads once.
This commit is contained in:
Jan Schmidt 2012-09-09 16:29:52 -07:00
parent c5e0bc6464
commit 16f5120d96
2 changed files with 24 additions and 5 deletions

View file

@ -99,6 +99,7 @@ static void rsn_dvdbin_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstStateChangeReturn rsn_dvdbin_change_state (GstElement * element, static GstStateChangeReturn rsn_dvdbin_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static void rsn_dvdbin_no_more_pads (RsnDvdBin * dvdbin);
static void static void
rsn_dvdbin_class_init (RsnDvdBinClass * klass) rsn_dvdbin_class_init (RsnDvdBinClass * klass)
@ -272,6 +273,21 @@ rsn_dvdbin_uri_handler_init (gpointer g_iface, gpointer iface_data)
iface->set_uri = rsn_dvdbin_uri_set_uri; iface->set_uri = rsn_dvdbin_uri_set_uri;
} }
static void
rsn_dvdbin_no_more_pads (RsnDvdBin * dvdbin)
{
if (dvdbin->did_no_more_pads)
return;
dvdbin->did_no_more_pads = TRUE;
GST_DEBUG_OBJECT (dvdbin, "Firing no more pads");
/* Shrink subpicture queue to smaller size */
g_object_set (dvdbin->pieces[DVD_ELEM_SPUQ],
"max-size-time", G_GUINT64_CONSTANT (0), "max-size-bytes", 0,
"max-size-buffers", 1, NULL);
gst_element_no_more_pads (GST_ELEMENT (dvdbin));
}
static gboolean static gboolean
try_create_piece (RsnDvdBin * dvdbin, gint index, try_create_piece (RsnDvdBin * dvdbin, gint index,
const gchar * factory, GType type, const gchar * name, const gchar * descr) const gchar * factory, GType type, const gchar * name, const gchar * descr)
@ -462,9 +478,10 @@ create_elements (RsnDvdBin * dvdbin)
if (!try_create_piece (dvdbin, DVD_ELEM_SPUQ, "queue", 0, "spu_q", if (!try_create_piece (dvdbin, DVD_ELEM_SPUQ, "queue", 0, "spu_q",
"subpicture decoder buffer")) "subpicture decoder buffer"))
return FALSE; return FALSE;
/* Allow a lot more while pre-rolling */
g_object_set (dvdbin->pieces[DVD_ELEM_SPUQ], g_object_set (dvdbin->pieces[DVD_ELEM_SPUQ],
"max-size-time", G_GUINT64_CONSTANT (0), "max-size-bytes", 0, "max-size-time", G_GUINT64_CONSTANT (0), "max-size-bytes", 0,
"max-size-buffers", 1, NULL); "max-size-buffers", 100, NULL);
src = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_SPU_SELECT], "src"); src = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_SPU_SELECT], "src");
sink = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_SPUQ], "sink"); sink = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_SPUQ], "sink");
@ -538,8 +555,7 @@ create_elements (RsnDvdBin * dvdbin)
if (dvdbin->video_added && (dvdbin->audio_added || dvdbin->audio_broken) if (dvdbin->video_added && (dvdbin->audio_added || dvdbin->audio_broken)
&& dvdbin->subpicture_added) { && dvdbin->subpicture_added) {
GST_DEBUG_OBJECT (dvdbin, "Firing no more pads"); rsn_dvdbin_no_more_pads (dvdbin);
gst_element_no_more_pads (GST_ELEMENT (dvdbin));
} }
return TRUE; return TRUE;
@ -634,6 +650,7 @@ remove_elements (RsnDvdBin * dvdbin)
dvdbin->video_added = dvdbin->audio_added = dvdbin->subpicture_added = FALSE; dvdbin->video_added = dvdbin->audio_added = dvdbin->subpicture_added = FALSE;
dvdbin->audio_broken = FALSE; dvdbin->audio_broken = FALSE;
dvdbin->video_pad = dvdbin->audio_pad = dvdbin->subpicture_pad = NULL; dvdbin->video_pad = dvdbin->audio_pad = dvdbin->subpicture_pad = NULL;
dvdbin->did_no_more_pads = FALSE;
} }
static GstPad * static GstPad *
@ -802,7 +819,7 @@ demux_no_more_pads (GstElement * element, RsnDvdBin * dvdbin)
if (no_more_pads) { if (no_more_pads) {
GST_DEBUG_OBJECT (dvdbin, GST_DEBUG_OBJECT (dvdbin,
"Firing no more pads from demuxer no-more-pads cb"); "Firing no more pads from demuxer no-more-pads cb");
gst_element_no_more_pads (GST_ELEMENT (dvdbin)); rsn_dvdbin_no_more_pads (dvdbin);
} }
} }
@ -867,7 +884,7 @@ dvdbin_pad_blocked_cb (GstPad * opad,
if (added_last_pad) { if (added_last_pad) {
GST_DEBUG_OBJECT (dvdbin, "Firing no more pads from pad-blocked cb"); GST_DEBUG_OBJECT (dvdbin, "Firing no more pads from pad-blocked cb");
gst_element_no_more_pads (GST_ELEMENT (dvdbin)); rsn_dvdbin_no_more_pads (dvdbin);
} }
return GST_PAD_PROBE_OK; return GST_PAD_PROBE_OK;

View file

@ -74,6 +74,8 @@ struct _RsnDvdBin
gboolean audio_broken; gboolean audio_broken;
gboolean subpicture_added; gboolean subpicture_added;
gboolean did_no_more_pads;
GList *mq_req_pads; GList *mq_req_pads;
}; };