GstCaps *sink_caps;
gboolean modified = FALSE;
GstBuffer *buf = NULL;
+ GstStructure *s = NULL;
if (G_UNLIKELY (!gst_pad_has_current_caps (GST_BASE_PARSE_SRC_PAD
(h264parse))))
/* carry over input caps as much as possible; override with our own stuff */
if (!sink_caps)
sink_caps = gst_caps_new_empty_simple ("video/x-h264");
+ else
+ s = gst_caps_get_structure (sink_caps, 0);
sps = h264parse->nalparser->last_sps;
GST_DEBUG_OBJECT (h264parse, "sps: %p", sps);
sps->fps_num, sps->fps_den);
h264parse->fps_num = sps->fps_num;
h264parse->fps_den = sps->fps_den;
- gst_base_parse_set_frame_rate (GST_BASE_PARSE (h264parse),
- h264parse->fps_num, h264parse->fps_den, 0, 0);
modified = TRUE;
}
}
gst_caps_set_simple (caps, "width", G_TYPE_INT, sps->width,
"height", G_TYPE_INT, sps->height, NULL);
/* but not necessarily or reliably this */
- if (h264parse->fps_num > 0 && h264parse->fps_den > 0)
+ if (h264parse->fps_num > 0 && h264parse->fps_den > 0 &&
+ (!s || !gst_structure_has_field (s, "framerate"))) {
+ GST_INFO_OBJECT (h264parse, "setting framerate in caps");
gst_caps_set_simple (caps, "framerate",
GST_TYPE_FRACTION, h264parse->fps_num, h264parse->fps_den, NULL);
+ gst_base_parse_set_frame_rate (GST_BASE_PARSE (h264parse),
+ h264parse->fps_num, h264parse->fps_den, 0, 0);
+ }
}
}
gst_h264_parse_get_string (h264parse, FALSE, h264parse->align), NULL);
gst_h264_parse_get_par (h264parse, &par_n, &par_d);
- if (par_n != 0 && par_d != 0) {
+ if (par_n != 0 && par_d != 0 &&
+ (!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) {
GST_INFO_OBJECT (h264parse, "PAR %d/%d", par_n, par_d);
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
par_n, par_d, NULL);
gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse)
{
GstCaps *caps = NULL;
+ GstStructure *s = NULL;
/* only update if no src caps yet or explicitly triggered */
if (G_LIKELY (gst_pad_has_current_caps (GST_BASE_PARSE_SRC_PAD (mpvparse)) &&
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SINK_PAD (mpvparse));
if (caps) {
caps = gst_caps_make_writable (caps);
+ s = gst_caps_get_structure (caps, 0);
} else {
caps = gst_caps_new_empty_simple ("video/mpeg");
}
"height", G_TYPE_INT, mpvparse->sequencehdr.height, NULL);
}
- /* perhaps we have a framerate */
- if (mpvparse->fps_num > 0 && mpvparse->fps_den > 0) {
+ /* perhaps we have a framerate */
+ if (mpvparse->fps_num > 0 && mpvparse->fps_den > 0 &&
+ (!s || !gst_structure_has_field (s, "framerate"))) {
gint fps_num = mpvparse->fps_num;
gint fps_den = mpvparse->fps_den;
GstClockTime latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num);
}
/* or pixel-aspect-ratio */
- if (mpvparse->sequencehdr.par_w && mpvparse->sequencehdr.par_h > 0) {
+ if (mpvparse->sequencehdr.par_w && mpvparse->sequencehdr.par_h > 0 &&
+ (!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) {
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
mpvparse->sequencehdr.par_w, mpvparse->sequencehdr.par_h, NULL);
}