diff options
author | Jan Schmidt <jan@centricular.com> | 2015-04-01 23:46:13 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2015-04-03 23:07:04 +1100 |
commit | 3d59b5f814aebbd8297f08826722ba5c00dd3c30 (patch) | |
tree | df9784a2b528d22894975f7858bc6c95b2cf02a7 /gst | |
parent | cf54d4cc67e687605aba05e5d184cf381d768593 (diff) |
isomp4: Make non-seekable downstream an error in normal mode
When not in fast-start or fragmented mode, we need to be able
to rewrite the size of the mdat atom, or else the output just
won't be playable - the mdat placeholder with size == 0 will
cover the rest of the file, including any moov atom we write out.
https://bugzilla.gnome.org/show_bug.cgi?id=708808
Diffstat (limited to 'gst')
-rw-r--r-- | gst/isomp4/gstqtmux.c | 48 | ||||
-rw-r--r-- | gst/isomp4/gstqtmux.h | 3 |
2 files changed, 29 insertions, 22 deletions
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index e61ec6ce0..80d6baa2b 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -1691,10 +1691,29 @@ serialize_error: } } +static gboolean +gst_qt_mux_downstream_is_seekable (GstQTMux * qtmux) +{ + gboolean seekable = FALSE; + GstQuery *query = gst_query_new_seeking (GST_FORMAT_BYTES); + + if (gst_pad_peer_query (qtmux->srcpad, query)) { + gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL); + GST_INFO_OBJECT (qtmux, "downstream is %sseekable", seekable ? "" : "not "); + } else { + /* have to assume seeking is not supported if query not handled downstream */ + GST_WARNING_OBJECT (qtmux, "downstream did not handle seeking query"); + seekable = FALSE; + } + gst_query_unref (query); + + return seekable; +} + + static GstFlowReturn gst_qt_mux_start_file (GstQTMux * qtmux) { - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); GstFlowReturn ret = GST_FLOW_OK; GstCaps *caps; GstSegment segment; @@ -1713,30 +1732,15 @@ gst_qt_mux_start_file (GstQTMux * qtmux) gst_pad_set_caps (qtmux->srcpad, caps); gst_caps_unref (caps); - /* if not streaming, check if downstream is seekable */ + /* if not streaming or doing fast-start, check if downstream is seekable */ if (!qtmux->streamable) { - gboolean seekable; - GstQuery *query; - - query = gst_query_new_seeking (GST_FORMAT_BYTES); - if (gst_pad_peer_query (qtmux->srcpad, query)) { - gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL); - GST_INFO_OBJECT (qtmux, "downstream is %sseekable", - seekable ? "" : "not "); - } else { - /* have to assume seeking is supported if query not handled downstream */ - GST_WARNING_OBJECT (qtmux, "downstream did not handle seeking query"); - seekable = FALSE; - } - gst_query_unref (query); - if (!seekable) { - if (qtmux_klass->format != GST_QT_MUX_FORMAT_ISML) { + if (!gst_qt_mux_downstream_is_seekable (qtmux)) { + if (qtmux->fragment_duration == 0) { if (!qtmux->fast_start) { - GST_ELEMENT_WARNING (qtmux, STREAM, FAILED, - ("Downstream is not seekable and headers can't be rewritten"), + GST_ELEMENT_ERROR (qtmux, STREAM, MUX, + ("Downstream is not seekable - will not be able to create a playable file"), (NULL)); - /* FIXME: Is there something better we can do? */ - qtmux->streamable = TRUE; + return GST_FLOW_ERROR; } } else { GST_WARNING_OBJECT (qtmux, "downstream is not seekable, but " diff --git a/gst/isomp4/gstqtmux.h b/gst/isomp4/gstqtmux.h index a9ea362a5..19467dc88 100644 --- a/gst/isomp4/gstqtmux.h +++ b/gst/isomp4/gstqtmux.h @@ -196,6 +196,9 @@ struct _GstQTMux gchar *fast_start_file_path; gchar *moov_recov_file_path; guint32 fragment_duration; + /* Whether or not to work in 'streamable' mode and not + * seek to rewrite headers - only valid for fragmented + * mode. */ gboolean streamable; /* for request pad naming */ |