qtdemux: Put framerate into the closedcaption caps if it can be calculated from the stream

Using the same calculation used for video streams.
This commit is contained in:
Sebastian Dröge 2018-12-05 19:37:13 +02:00 committed by Sebastian Dröge
parent 830e7dc14b
commit c50be8f146

View File

@ -8330,9 +8330,8 @@ gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
}
static gboolean
gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
gst_qtdemux_guess_framerate (GstQTDemux * qtdemux, QtDemuxStream * stream)
{
if (stream->subtype == FOURCC_vide) {
/* fps is calculated base on the duration of the average framerate since
* qt does not have a fixed framerate. */
gboolean fps_available = TRUE;
@ -8391,6 +8390,15 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
}
}
return fps_available;
}
static gboolean
gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
{
if (stream->subtype == FOURCC_vide) {
gboolean fps_available = gst_qtdemux_guess_framerate (qtdemux, stream);
if (CUR_STREAM (stream)->caps) {
CUR_STREAM (stream)->caps =
gst_caps_make_writable (CUR_STREAM (stream)->caps);
@ -8509,6 +8517,22 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
}
}
else if (stream->subtype == FOURCC_clcp) {
gboolean fps_available = gst_qtdemux_guess_framerate (qtdemux, stream);
if (CUR_STREAM (stream)->caps) {
CUR_STREAM (stream)->caps =
gst_caps_make_writable (CUR_STREAM (stream)->caps);
/* set framerate if calculated framerate is reliable */
if (fps_available) {
gst_caps_set_simple (CUR_STREAM (stream)->caps,
"framerate", GST_TYPE_FRACTION, CUR_STREAM (stream)->fps_n,
CUR_STREAM (stream)->fps_d, NULL);
}
}
}
if (stream->pad) {
GstCaps *prev_caps = NULL;