mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
qtmux: add streamable property to avoid building fragmented mfra index
This commit is contained in:
parent
26a281bdab
commit
61964eb109
2 changed files with 23 additions and 2 deletions
|
@ -110,7 +110,8 @@ enum
|
|||
PROP_FAST_START,
|
||||
PROP_FAST_START_TEMP_FILE,
|
||||
PROP_MOOV_RECOV_FILE,
|
||||
PROP_FRAGMENT_DURATION
|
||||
PROP_FRAGMENT_DURATION,
|
||||
PROP_STREAMABLE
|
||||
};
|
||||
|
||||
/* some spare for header size as well */
|
||||
|
@ -124,6 +125,7 @@ enum
|
|||
#define DEFAULT_FAST_START_TEMP_FILE NULL
|
||||
#define DEFAULT_MOOV_RECOV_FILE NULL
|
||||
#define DEFAULT_FRAGMENT_DURATION 0
|
||||
#define DEFAULT_STREAMABLE FALSE
|
||||
|
||||
|
||||
static void gst_qt_mux_finalize (GObject * object);
|
||||
|
@ -251,6 +253,12 @@ gst_qt_mux_class_init (GstQTMuxClass * klass)
|
|||
"Fragment durations in ms (produce a fragmented file if > 0)",
|
||||
0, G_MAXUINT32, DEFAULT_FRAGMENT_DURATION,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_STREAMABLE,
|
||||
g_param_spec_boolean ("streamable", "Streamable",
|
||||
"If set to true, the output should be as if it is to be streamed "
|
||||
"and hence no indexes written or duration written.",
|
||||
DEFAULT_STREAMABLE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gstelement_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_qt_mux_request_new_pad);
|
||||
|
@ -1548,7 +1556,8 @@ gst_qt_mux_start_file (GstQTMux * qtmux)
|
|||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
/* prepare index */
|
||||
qtmux->mfra = atom_mfra_new (qtmux->context);
|
||||
if (!qtmux->streamable)
|
||||
qtmux->mfra = atom_mfra_new (qtmux->context);
|
||||
} else {
|
||||
/* extended to ensure some spare space */
|
||||
ret = gst_qt_mux_send_mdat_header (qtmux, &qtmux->header_size, 0, TRUE);
|
||||
|
@ -1617,8 +1626,13 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
|
|||
ret = gst_qt_mux_send_buffer (qtmux, buf, NULL, FALSE);
|
||||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
} else {
|
||||
/* must have been streamable; no need to write duration */
|
||||
GST_DEBUG_OBJECT (qtmux, "streamable file; nothing to stop");
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
||||
timescale = qtmux->timescale;
|
||||
/* only mvex duration is updated,
|
||||
* mvhd should be consistent with empty moov
|
||||
|
@ -3022,6 +3036,9 @@ gst_qt_mux_get_property (GObject * object,
|
|||
case PROP_FRAGMENT_DURATION:
|
||||
g_value_set_uint (value, qtmux->fragment_duration);
|
||||
break;
|
||||
case PROP_STREAMABLE:
|
||||
g_value_set_boolean (value, qtmux->streamable);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -3077,6 +3094,9 @@ gst_qt_mux_set_property (GObject * object,
|
|||
case PROP_FRAGMENT_DURATION:
|
||||
qtmux->fragment_duration = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_STREAMABLE:
|
||||
qtmux->streamable = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -177,6 +177,7 @@ struct _GstQTMux
|
|||
gchar *fast_start_file_path;
|
||||
gchar *moov_recov_file_path;
|
||||
guint32 fragment_duration;
|
||||
gboolean streamable;
|
||||
|
||||
/* for collect pads event handling function */
|
||||
GstPadEventFunction collect_event;
|
||||
|
|
Loading…
Reference in a new issue