mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 07:38:16 +00:00
asfdemux: Handle PAR/interlaced information stored in packet payload.
This is the 'other' way to store non 1/1 PAR in asf streams (by storing it in the ASF Packet payload extensions).
This commit is contained in:
parent
1cc2eed416
commit
a3f200e4f8
2 changed files with 36 additions and 1 deletions
|
@ -1278,6 +1278,26 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
|||
stream->discont = FALSE;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (stream->is_video && payload->par_x && payload->par_y &&
|
||||
(payload->par_x != stream->par_x) &&
|
||||
(payload->par_y != stream->par_y))) {
|
||||
GST_DEBUG ("Updating PAR (%d/%d => %d/%d)",
|
||||
stream->par_x, stream->par_y, payload->par_x, payload->par_y);
|
||||
stream->par_x = payload->par_x;
|
||||
stream->par_y = payload->par_y;
|
||||
gst_caps_set_simple (stream->caps, "pixel-aspect-ratio",
|
||||
GST_TYPE_FRACTION, stream->par_x, stream->par_y, NULL);
|
||||
gst_pad_set_caps (stream->pad, stream->caps);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (stream->interlaced != payload->interlaced)) {
|
||||
GST_DEBUG ("Updating interlaced status (%d => %d)", stream->interlaced,
|
||||
payload->interlaced);
|
||||
stream->interlaced = payload->interlaced;
|
||||
gst_caps_set_simple (stream->caps, "interlaced", G_TYPE_BOOLEAN,
|
||||
stream->interlaced, NULL);
|
||||
}
|
||||
|
||||
gst_buffer_set_caps (payload->buf, stream->caps);
|
||||
|
||||
/* (sort of) interpolate timestamps using upstream "frame of reference",
|
||||
|
@ -1772,6 +1792,17 @@ gst_asf_demux_setup_pad (GstASFDemux * demux, GstPad * src_pad,
|
|||
stream->is_video = is_video;
|
||||
stream->pending_tags = tags;
|
||||
stream->discont = TRUE;
|
||||
if (is_video) {
|
||||
GstStructure *st;
|
||||
gint par_x, par_y;
|
||||
st = gst_caps_get_structure (caps, 0);
|
||||
if (gst_structure_get_fraction (st, "pixel-aspect-ratio", &par_x, &par_y) &&
|
||||
par_x > 0 && par_y > 0) {
|
||||
GST_DEBUG ("PAR %d/%d", par_x, par_y);
|
||||
stream->par_x = par_x;
|
||||
stream->par_y = par_y;
|
||||
}
|
||||
}
|
||||
|
||||
stream->payloads = g_array_new (FALSE, FALSE, sizeof (AsfPayload));
|
||||
|
||||
|
@ -1901,7 +1932,6 @@ gst_asf_demux_add_video_stream (GstASFDemux * demux,
|
|||
ax, ay, NULL);
|
||||
}
|
||||
}
|
||||
/* remove the framerate we will guess and add it later */
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_remove_field (s, "framerate");
|
||||
}
|
||||
|
|
|
@ -98,6 +98,11 @@ typedef struct
|
|||
GstFlowReturn last_flow; /* last flow return */
|
||||
GArray *payloads; /* pending payloads */
|
||||
|
||||
/* Video stream PAR & interlacing */
|
||||
guint8 par_x;
|
||||
guint8 par_y;
|
||||
gboolean interlaced;
|
||||
|
||||
/* extended stream properties (optional) */
|
||||
AsfStreamExtProps ext_props;
|
||||
|
||||
|
|
Loading…
Reference in a new issue