mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
typefindfunctions: recognize SVC and MVC nal units in h264 streams
Ensure the detection of svc and mvc as a part of h264 stream. Once the typefinder detect a subset_sequence_parameter_set(ssps), then each nal unit with type 14 or 20 should be detected as a part of h264 stream thereafter. https://bugzilla.gnome.org/show_bug.cgi?id=694346
This commit is contained in:
parent
a86ca535c8
commit
9791f0aaf1
1 changed files with 17 additions and 9 deletions
|
@ -2505,6 +2505,7 @@ h264_video_type_find (GstTypeFind * tf, gpointer unused)
|
||||||
gboolean seen_idr = FALSE;
|
gboolean seen_idr = FALSE;
|
||||||
gboolean seen_sps = FALSE;
|
gboolean seen_sps = FALSE;
|
||||||
gboolean seen_pps = FALSE;
|
gboolean seen_pps = FALSE;
|
||||||
|
gboolean seen_ssps = FALSE;
|
||||||
int nut, ref;
|
int nut, ref;
|
||||||
int good = 0;
|
int good = 0;
|
||||||
int bad = 0;
|
int bad = 0;
|
||||||
|
@ -2539,18 +2540,25 @@ h264_video_type_find (GstTypeFind * tf, gpointer unused)
|
||||||
good++;
|
good++;
|
||||||
}
|
}
|
||||||
} else if (nut >= 14 && nut <= 33) {
|
} else if (nut >= 14 && nut <= 33) {
|
||||||
/* reserved */
|
if (nut == 15) {
|
||||||
/* Theoretically these are good, since if they exist in the
|
seen_ssps = TRUE;
|
||||||
stream it merely means that a newer backwards-compatible
|
good++;
|
||||||
h.264 stream. But we should be identifying that separately. */
|
} else if (seen_ssps && (nut == 14 || nut == 20)) {
|
||||||
bad++;
|
good++;
|
||||||
|
} else {
|
||||||
|
/* reserved */
|
||||||
|
/* Theoretically these are good, since if they exist in the
|
||||||
|
stream it merely means that a newer backwards-compatible
|
||||||
|
h.264 stream. But we should be identifying that separately. */
|
||||||
|
bad++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* unspecified, application specific */
|
/* unspecified, application specific */
|
||||||
/* don't consider these bad */
|
/* don't consider these bad */
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d", good, bad, seen_pps,
|
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d ssps:%d", good, bad,
|
||||||
seen_sps, seen_idr);
|
seen_pps, seen_sps, seen_idr, seen_ssps);
|
||||||
|
|
||||||
if (seen_sps && seen_pps && seen_idr && good >= 10 && bad < 4) {
|
if (seen_sps && seen_pps && seen_idr && good >= 10 && bad < 4) {
|
||||||
gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, H264_VIDEO_CAPS);
|
gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, H264_VIDEO_CAPS);
|
||||||
|
@ -2562,8 +2570,8 @@ h264_video_type_find (GstTypeFind * tf, gpointer unused)
|
||||||
data_scan_ctx_advance (tf, &c, 1);
|
data_scan_ctx_advance (tf, &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d", good, bad, seen_pps,
|
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d ssps=%d", good, bad,
|
||||||
seen_sps, seen_idr);
|
seen_pps, seen_sps, seen_idr, seen_ssps);
|
||||||
|
|
||||||
if (good >= 2 && bad == 0) {
|
if (good >= 2 && bad == 0) {
|
||||||
gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, H264_VIDEO_CAPS);
|
gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, H264_VIDEO_CAPS);
|
||||||
|
|
Loading…
Reference in a new issue