mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
h264parser: Parse all SEI payload type even if it's not handled by parser
... so that user can handle it from outside of parser API
This commit is contained in:
parent
db1ea18276
commit
1a09251699
3 changed files with 76 additions and 8 deletions
|
@ -1230,6 +1230,33 @@ error:
|
||||||
return GST_H264_PARSER_ERROR;
|
return GST_H264_PARSER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstH264ParserResult
|
||||||
|
gst_h264_parser_parse_sei_unhandled_payload (GstH264NalParser * parser,
|
||||||
|
GstH264SEIUnhandledPayload * payload, NalReader * nr, guint payload_type,
|
||||||
|
guint payload_size)
|
||||||
|
{
|
||||||
|
guint8 *data = NULL;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
payload->payloadType = payload_type;
|
||||||
|
|
||||||
|
data = g_malloc0 (payload_size);
|
||||||
|
for (i = 0; i < payload_size; ++i) {
|
||||||
|
READ_UINT8 (nr, data[i], 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
payload->size = payload_size;
|
||||||
|
payload->data = data;
|
||||||
|
|
||||||
|
return GST_H264_PARSER_OK;
|
||||||
|
|
||||||
|
error:
|
||||||
|
GST_WARNING ("error parsing \"Unhandled payload\"");
|
||||||
|
g_free (data);
|
||||||
|
|
||||||
|
return GST_H264_PARSER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
static GstH264ParserResult
|
static GstH264ParserResult
|
||||||
gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
|
gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
|
||||||
NalReader * nr, GstH264SEIMessage * sei)
|
NalReader * nr, GstH264SEIMessage * sei)
|
||||||
|
@ -1298,11 +1325,10 @@ gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
|
||||||
&sei->payload.content_light_level, nr);
|
&sei->payload.content_light_level, nr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Just consume payloadSize bytes, which does not account for
|
res = gst_h264_parser_parse_sei_unhandled_payload (nalparser,
|
||||||
emulation prevention bytes */
|
&sei->payload.unhandled_payload, nr, sei->payloadType,
|
||||||
if (!nal_reader_skip_long (nr, payload_size))
|
payload_size >> 3);
|
||||||
goto error;
|
sei->payloadType = GST_H264_SEI_UNHANDLED_PAYLOAD;
|
||||||
res = GST_H264_PARSER_OK;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2421,6 +2447,14 @@ gst_h264_sei_clear (GstH264SEIMessage * sei)
|
||||||
rud->data = NULL;
|
rud->data = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_H264_SEI_UNHANDLED_PAYLOAD:{
|
||||||
|
GstH264SEIUnhandledPayload *payload = &sei->payload.unhandled_payload;
|
||||||
|
|
||||||
|
g_free (payload->data);
|
||||||
|
payload->data = NULL;
|
||||||
|
payload->size = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,8 @@ typedef enum
|
||||||
* contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
|
* contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
|
||||||
* @GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.29) (Since: 1.18)
|
* @GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.29) (Since: 1.18)
|
||||||
* @GST_H264_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.31) (Since: 1.18)
|
* @GST_H264_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.31) (Since: 1.18)
|
||||||
|
* @GST_H264_SEI_UNHANDLED_PAYLOAD: Unhandled SEI message. This may or may not
|
||||||
|
* be defined by spec (Since 1.18)
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
* The type of SEI message.
|
* The type of SEI message.
|
||||||
|
@ -262,6 +264,9 @@ typedef enum
|
||||||
GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
|
GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
|
||||||
GST_H264_SEI_CONTENT_LIGHT_LEVEL = 144,
|
GST_H264_SEI_CONTENT_LIGHT_LEVEL = 144,
|
||||||
/* and more... */
|
/* and more... */
|
||||||
|
|
||||||
|
/* Unhandled SEI type */
|
||||||
|
GST_H264_SEI_UNHANDLED_PAYLOAD = -1
|
||||||
} GstH264SEIPayloadType;
|
} GstH264SEIPayloadType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -358,6 +363,7 @@ typedef struct _GstH264StereoVideoInfo GstH264StereoVideoInfo;
|
||||||
typedef struct _GstH264FramePacking GstH264FramePacking;
|
typedef struct _GstH264FramePacking GstH264FramePacking;
|
||||||
typedef struct _GstH264MasteringDisplayColourVolume GstH264MasteringDisplayColourVolume;
|
typedef struct _GstH264MasteringDisplayColourVolume GstH264MasteringDisplayColourVolume;
|
||||||
typedef struct _GstH264ContentLightLevel GstH264ContentLightLevel;
|
typedef struct _GstH264ContentLightLevel GstH264ContentLightLevel;
|
||||||
|
typedef struct _GstH264SEIUnhandledPayload GstH264SEIUnhandledPayload;
|
||||||
typedef struct _GstH264SEIMessage GstH264SEIMessage;
|
typedef struct _GstH264SEIMessage GstH264SEIMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1160,6 +1166,25 @@ struct _GstH264ContentLightLevel
|
||||||
guint16 max_pic_average_light_level;
|
guint16 max_pic_average_light_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstH264SEIUnhandledPayload:
|
||||||
|
* @payloadType: Payload type
|
||||||
|
* @data: payload raw data excluding payload type and payload size byte
|
||||||
|
* @size: the size of @data
|
||||||
|
*
|
||||||
|
* Contains unhandled SEI payload data. This SEI may or may not
|
||||||
|
* be defined by spec
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
*/
|
||||||
|
struct _GstH264SEIUnhandledPayload
|
||||||
|
{
|
||||||
|
guint payloadType;
|
||||||
|
|
||||||
|
guint8 *data;
|
||||||
|
guint size;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstH264SEIMessage
|
struct _GstH264SEIMessage
|
||||||
{
|
{
|
||||||
GstH264SEIPayloadType payloadType;
|
GstH264SEIPayloadType payloadType;
|
||||||
|
@ -1173,6 +1198,7 @@ struct _GstH264SEIMessage
|
||||||
GstH264FramePacking frame_packing;
|
GstH264FramePacking frame_packing;
|
||||||
GstH264MasteringDisplayColourVolume mastering_display_colour_volume;
|
GstH264MasteringDisplayColourVolume mastering_display_colour_volume;
|
||||||
GstH264ContentLightLevel content_light_level;
|
GstH264ContentLightLevel content_light_level;
|
||||||
|
GstH264SEIUnhandledPayload unhandled_payload;
|
||||||
/* ... could implement more */
|
/* ... could implement more */
|
||||||
} payload;
|
} payload;
|
||||||
};
|
};
|
||||||
|
|
|
@ -866,10 +866,18 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:{
|
||||||
GST_LOG_OBJECT (h264parse, "Unsupported payload type %u",
|
gint payload_type = sei.payloadType;
|
||||||
sei.payloadType);
|
|
||||||
|
if (payload_type == GST_H264_SEI_UNHANDLED_PAYLOAD) {
|
||||||
|
GstH264SEIUnhandledPayload *unhandled =
|
||||||
|
&sei.payload.unhandled_payload;
|
||||||
|
payload_type = unhandled->payloadType;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (h264parse, "Unsupported payload type %d", payload_type);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_array_free (messages, TRUE);
|
g_array_free (messages, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue