Commit a832e20d authored by François Grisez's avatar François Grisez
Browse files

VideoToolboxH264Decoder: remove SEIs from NALu stream before decoding

parent e07988dd
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
typedef enum { typedef enum {
MSH264NaluTypeIDR = 5, MSH264NaluTypeIDR = 5,
MSH264NaluTypeSEI = 6,
MSH264NaluTypeSPS = 7, MSH264NaluTypeSPS = 7,
MSH264NaluTypePPS = 8 MSH264NaluTypePPS = 8
} MSH264NaluType; } MSH264NaluType;
......
...@@ -739,7 +739,11 @@ static void h264_dec_init(MSFilter *f) { ...@@ -739,7 +739,11 @@ static void h264_dec_init(MSFilter *f) {
f->data = ctx; f->data = ctx;
} }
static void h264_dec_extract_parameter_sets(VTH264DecCtx *ctx, MSQueue *input, MSQueue *output) { /*
* Remove non-VCL NALu from a nalu stream. SPSs and PPSs are saved in
* the decoding context.
*/
static void h264_dec_filter_nalu_stream(VTH264DecCtx *ctx, MSQueue *input, MSQueue *output) {
mblk_t *nalu; mblk_t *nalu;
while((nalu = ms_queue_get(input))) { while((nalu = ms_queue_get(input))) {
MSH264NaluType nalu_type = ms_h264_nalu_get_type(nalu); MSH264NaluType nalu_type = ms_h264_nalu_get_type(nalu);
...@@ -752,6 +756,9 @@ static void h264_dec_extract_parameter_sets(VTH264DecCtx *ctx, MSQueue *input, M ...@@ -752,6 +756,9 @@ static void h264_dec_extract_parameter_sets(VTH264DecCtx *ctx, MSQueue *input, M
if (ctx->pps != NULL) freemsg(ctx->pps); if (ctx->pps != NULL) freemsg(ctx->pps);
ctx->pps = nalu; ctx->pps = nalu;
break; break;
case MSH264NaluTypeSEI:
freemsg(nalu);
break;
default: default:
ms_queue_put(output, nalu); ms_queue_put(output, nalu);
} }
...@@ -816,7 +823,7 @@ static void h264_dec_process(MSFilter *f) { ...@@ -816,7 +823,7 @@ static void h264_dec_process(MSFilter *f) {
* Extract SPSs and PPSs from the frame and use them in order to * Extract SPSs and PPSs from the frame and use them in order to
* find the video format out. * find the video format out.
*/ */
h264_dec_extract_parameter_sets(ctx, &q_nalus, &q_nalus2); h264_dec_filter_nalu_stream(ctx, &q_nalus, &q_nalus2);
if (ctx->sps != NULL && ctx->pps != NULL) { if (ctx->sps != NULL && ctx->pps != NULL) {
if (ctx->format_desc == NULL || (unpack_status & (Rfc3984NewSPS | Rfc3984NewPPS))) { if (ctx->format_desc == NULL || (unpack_status & (Rfc3984NewSPS | Rfc3984NewPPS))) {
if (unpack_status & Rfc3984NewSPS) vth264dec_message("new SPS"); if (unpack_status & Rfc3984NewSPS) vth264dec_message("new SPS");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment