summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorAurélien Zanelli <aurelien.zanelli@parrot.com>2014-01-31 17:07:42 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-06-26 17:22:26 +0200
commit67df2072801012dd084b4da6e916db9967f5650f (patch)
treeb2cc9446f09900a345ce84380ffb2dff879be6fc /gst-libs
parent0440cabf491f2f6e82e7bcde24a805ee966cbaab (diff)
codecparsers: h264: add support for Recovery Point SEI message.
The recovery point SEI message helps a decoder in determining if the decoding process would produce acceptable pictures for display after the decoder initiates random access or after the encoder indicates a broken link in the coded video sequence. This is not used in the h264parse element, but it could help debugging. https://bugzilla.gnome.org/show_bug.cgi?id=723380
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.c29
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.h14
2 files changed, 42 insertions, 1 deletions
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index f960824ac..a0988e6e6 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -853,6 +853,31 @@ error:
}
static GstH264ParserResult
+gst_h264_parser_parse_recovery_point (GstH264NalParser * nalparser,
+ GstH264RecoveryPoint * rp, NalReader * nr)
+{
+ GstH264SPS *const sps = nalparser->last_sps;
+
+ GST_DEBUG ("parsing \"Recovery point\"");
+ if (!sps || !sps->valid) {
+ GST_WARNING ("didn't get the associated sequence paramater set for the "
+ "current access unit");
+ goto error;
+ }
+
+ READ_UE_ALLOWED (nr, rp->recovery_frame_cnt, 0, sps->max_frame_num - 1);
+ READ_UINT8 (nr, rp->exact_match_flag, 1);
+ READ_UINT8 (nr, rp->broken_link_flag, 1);
+ READ_UINT8 (nr, rp->changing_slice_group_idc, 2);
+
+ return GST_H264_PARSER_OK;
+
+error:
+ GST_WARNING ("error parsing \"Recovery point\"");
+ return GST_H264_PARSER_ERROR;
+}
+
+static GstH264ParserResult
gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
NalReader * nr, GstH264SEIMessage * sei)
{
@@ -893,6 +918,10 @@ gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
res = gst_h264_parser_parse_pic_timing (nalparser,
&sei->payload.pic_timing, nr);
break;
+ case GST_H264_SEI_RECOVERY_POINT:
+ res = gst_h264_parser_parse_recovery_point (nalparser,
+ &sei->payload.recovery_point, nr);
+ break;
default:
/* Just consume payloadSize bytes, which does not account for
emulation prevention bytes */
diff --git a/gst-libs/gst/codecparsers/gsth264parser.h b/gst-libs/gst/codecparsers/gsth264parser.h
index f9e5083eb..6c7d6a0f2 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.h
+++ b/gst-libs/gst/codecparsers/gsth264parser.h
@@ -156,6 +156,7 @@ typedef enum
* GstH264SEIPayloadType:
* @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
* @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
+ * @GST_H264_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.2.7)
* ...
*
* The type of SEI message.
@@ -163,7 +164,8 @@ typedef enum
typedef enum
{
GST_H264_SEI_BUF_PERIOD = 0,
- GST_H264_SEI_PIC_TIMING = 1
+ GST_H264_SEI_PIC_TIMING = 1,
+ GST_H264_SEI_RECOVERY_POINT = 6,
/* and more... */
} GstH264SEIPayloadType;
@@ -234,6 +236,7 @@ typedef struct _GstH264SliceHdr GstH264SliceHdr;
typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
typedef struct _GstH264PicTiming GstH264PicTiming;
typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
+typedef struct _GstH264RecoveryPoint GstH264RecoveryPoint;
typedef struct _GstH264SEIMessage GstH264SEIMessage;
/**
@@ -706,6 +709,14 @@ struct _GstH264BufferingPeriod
guint8 vcl_initial_cpb_removal_delay_offset[32];
};
+struct _GstH264RecoveryPoint
+{
+ guint32 recovery_frame_cnt;
+ guint8 exact_match_flag;
+ guint8 broken_link_flag;
+ guint8 changing_slice_group_idc;
+};
+
struct _GstH264SEIMessage
{
GstH264SEIPayloadType payloadType;
@@ -713,6 +724,7 @@ struct _GstH264SEIMessage
union {
GstH264BufferingPeriod buffering_period;
GstH264PicTiming pic_timing;
+ GstH264RecoveryPoint recovery_point;
/* ... could implement more */
} payload;
};