mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 08:08:22 +00:00
matroskamux: Add context flag for WebM
WebM has a couple of specific requirements we need to handle. Idea is to set this flag once and just rely on mux->is_webm at run time instead of repeatedly figuring this out from GST_MATROSKA_DOCTYPE_WEBM (which requires a strcmp()).
This commit is contained in:
parent
edeed575ae
commit
1cb31eeacc
3 changed files with 6 additions and 7 deletions
|
@ -2481,7 +2481,6 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
||||||
};
|
};
|
||||||
const gchar *media_type;
|
const gchar *media_type;
|
||||||
gboolean audio_only;
|
gboolean audio_only;
|
||||||
gboolean is_webm = FALSE;
|
|
||||||
guint64 master, child;
|
guint64 master, child;
|
||||||
GSList *collected;
|
GSList *collected;
|
||||||
int i;
|
int i;
|
||||||
|
@ -2522,13 +2521,9 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
||||||
g_snprintf (s_id, sizeof (s_id), "matroskamux-%08x", g_random_int ());
|
g_snprintf (s_id, sizeof (s_id), "matroskamux-%08x", g_random_int ());
|
||||||
gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id));
|
gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id));
|
||||||
|
|
||||||
/* Are we muxing a WebM stream? */
|
|
||||||
if (!strcmp (mux->doctype, GST_MATROSKA_DOCTYPE_WEBM)) {
|
|
||||||
is_webm = TRUE;
|
|
||||||
}
|
|
||||||
/* output caps */
|
/* output caps */
|
||||||
audio_only = mux->num_v_streams == 0 && mux->num_a_streams > 0;
|
audio_only = mux->num_v_streams == 0 && mux->num_a_streams > 0;
|
||||||
if (is_webm) {
|
if (mux->is_webm) {
|
||||||
media_type = (audio_only) ? "audio/webm" : "video/webm";
|
media_type = (audio_only) ? "audio/webm" : "video/webm";
|
||||||
} else {
|
} else {
|
||||||
media_type = (audio_only) ? "audio/x-matroska" : "video/x-matroska";
|
media_type = (audio_only) ? "audio/x-matroska" : "video/x-matroska";
|
||||||
|
@ -2588,7 +2583,7 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
||||||
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEGMENTINFO);
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEGMENTINFO);
|
||||||
|
|
||||||
/* WebM does not support SegmentUID field on SegmentInfo */
|
/* WebM does not support SegmentUID field on SegmentInfo */
|
||||||
if (!is_webm) {
|
if (!mux->is_webm) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
segment_uid[i] = g_random_int ();
|
segment_uid[i] = g_random_int ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,9 @@ typedef struct _GstMatroskaMux {
|
||||||
|
|
||||||
/* GstForceKeyUnit event */
|
/* GstForceKeyUnit event */
|
||||||
GstEvent *force_key_unit_event;
|
GstEvent *force_key_unit_event;
|
||||||
|
|
||||||
|
/* Flag to ease handling of WebM specifics */
|
||||||
|
gboolean is_webm;
|
||||||
} GstMatroskaMux;
|
} GstMatroskaMux;
|
||||||
|
|
||||||
typedef struct _GstMatroskaMuxClass {
|
typedef struct _GstMatroskaMuxClass {
|
||||||
|
|
|
@ -97,4 +97,5 @@ static void
|
||||||
gst_webm_mux_init (GstWebMMux * mux)
|
gst_webm_mux_init (GstWebMMux * mux)
|
||||||
{
|
{
|
||||||
GST_MATROSKA_MUX (mux)->doctype = GST_MATROSKA_DOCTYPE_WEBM;
|
GST_MATROSKA_MUX (mux)->doctype = GST_MATROSKA_DOCTYPE_WEBM;
|
||||||
|
GST_MATROSKA_MUX (mux)->is_webm = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue