mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
flvmux: Push sticky events in the right order
This commit is contained in:
parent
511fb95ef8
commit
9ac456bd43
1 changed files with 12 additions and 16 deletions
|
@ -1141,6 +1141,8 @@ gst_flv_mux_write_header (GstFlvMux * mux)
|
||||||
GValue streamheader = { 0 };
|
GValue streamheader = { 0 };
|
||||||
GSList *l;
|
GSList *l;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
GstSegment segment;
|
||||||
|
gchar s_id[32];
|
||||||
|
|
||||||
/* if not streaming, check if downstream is seekable */
|
/* if not streaming, check if downstream is seekable */
|
||||||
if (!mux->streamable) {
|
if (!mux->streamable) {
|
||||||
|
@ -1216,17 +1218,24 @@ gst_flv_mux_write_header (GstFlvMux * mux)
|
||||||
if (audio_codec_data != NULL)
|
if (audio_codec_data != NULL)
|
||||||
gst_flv_mux_put_buffer_in_streamheader (&streamheader, audio_codec_data);
|
gst_flv_mux_put_buffer_in_streamheader (&streamheader, audio_codec_data);
|
||||||
|
|
||||||
|
/* stream-start (FIXME: create id based on input ids) */
|
||||||
|
g_snprintf (s_id, sizeof (s_id), "flvmux-%08x", g_random_int ());
|
||||||
|
gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id));
|
||||||
|
|
||||||
/* create the caps and put the streamheader in them */
|
/* create the caps and put the streamheader in them */
|
||||||
caps = gst_caps_new_empty_simple ("video/x-flv");
|
caps = gst_caps_new_empty_simple ("video/x-flv");
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
gst_structure_set_value (structure, "streamheader", &streamheader);
|
gst_structure_set_value (structure, "streamheader", &streamheader);
|
||||||
g_value_unset (&streamheader);
|
g_value_unset (&streamheader);
|
||||||
|
|
||||||
if (!gst_pad_has_current_caps (mux->srcpad))
|
gst_pad_set_caps (mux->srcpad, caps);
|
||||||
gst_pad_set_caps (mux->srcpad, caps);
|
|
||||||
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
/* segment */
|
||||||
|
gst_segment_init (&segment, GST_FORMAT_BYTES);
|
||||||
|
gst_pad_push_event (mux->srcpad, gst_event_new_segment (&segment));
|
||||||
|
|
||||||
/* push the header buffer, the metadata and the codec info, if any */
|
/* push the header buffer, the metadata and the codec info, if any */
|
||||||
ret = gst_flv_mux_push (mux, header);
|
ret = gst_flv_mux_push (mux, header);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
|
@ -1463,26 +1472,13 @@ gst_flv_mux_handle_buffer (GstCollectPads * pads, GstCollectData * cdata,
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
if (mux->state == GST_FLV_MUX_STATE_HEADER) {
|
if (mux->state == GST_FLV_MUX_STATE_HEADER) {
|
||||||
GstSegment segment;
|
|
||||||
gchar s_id[32];
|
|
||||||
|
|
||||||
if (mux->collect->data == NULL) {
|
if (mux->collect->data == NULL) {
|
||||||
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
||||||
("No input streams configured"));
|
("No input streams configured"));
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stream-start (FIXME: create id based on input ids) */
|
ret = gst_flv_mux_write_header (mux);
|
||||||
g_snprintf (s_id, sizeof (s_id), "flvmux-%08x", g_random_int ());
|
|
||||||
gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id));
|
|
||||||
|
|
||||||
/* segment */
|
|
||||||
gst_segment_init (&segment, GST_FORMAT_BYTES);
|
|
||||||
if (gst_pad_push_event (mux->srcpad, gst_event_new_segment (&segment)))
|
|
||||||
ret = gst_flv_mux_write_header (mux);
|
|
||||||
else
|
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
return ret;
|
return ret;
|
||||||
mux->state = GST_FLV_MUX_STATE_DATA;
|
mux->state = GST_FLV_MUX_STATE_DATA;
|
||||||
|
|
Loading…
Reference in a new issue