summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-10-10 10:35:20 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:50:30 +0100
commitfdcad30281cd70a33caa830fc35f173f0da77311 (patch)
tree61a05f9b1c244cce932aa9a7336ed214bab1886d /gst-libs
parent6335d7aa63d533529a1c3403df1b180cf79dbdd6 (diff)
h264: add decode_nalu() helper function.
Split decode_buffer() into the core infrastructure that determines the NAL units contained in the adapter and the actual function that decodes the NAL unit.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h264.c77
1 files changed, 41 insertions, 36 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index a3af7941..fc6cbf81 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -2214,6 +2214,45 @@ scan_for_start_code(GstAdapter *adapter, guint ofs, guint size, guint32 *scp)
}
static GstVaapiDecoderStatus
+decode_nalu(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
+{
+ GstVaapiDecoderStatus status;
+
+ switch (nalu->type) {
+ case GST_H264_NAL_SLICE_IDR:
+ /* fall-through. IDR specifics are handled in init_picture() */
+ case GST_H264_NAL_SLICE:
+ status = decode_slice(decoder, nalu);
+ break;
+ case GST_H264_NAL_SPS:
+ status = decode_sps(decoder, nalu);
+ break;
+ case GST_H264_NAL_PPS:
+ status = decode_pps(decoder, nalu);
+ break;
+ case GST_H264_NAL_SEI:
+ status = decode_sei(decoder, nalu);
+ break;
+ case GST_H264_NAL_SEQ_END:
+ status = decode_sequence_end(decoder);
+ break;
+ case GST_H264_NAL_AU_DELIMITER:
+ /* skip all Access Unit NALs */
+ status = GST_VAAPI_DECODER_STATUS_SUCCESS;
+ break;
+ case GST_H264_NAL_FILLER_DATA:
+ /* skip all Filler Data NALs */
+ status = GST_VAAPI_DECODER_STATUS_SUCCESS;
+ break;
+ default:
+ GST_WARNING("unsupported NAL unit type %d", nalu->type);
+ status = GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER;
+ break;
+ }
+ return status;
+}
+
+static GstVaapiDecoderStatus
decode_buffer(GstVaapiDecoderH264 *decoder, GstBuffer *buffer)
{
GstVaapiDecoderH264Private * const priv = decoder->priv;
@@ -2298,42 +2337,8 @@ decode_buffer(GstVaapiDecoderH264 *decoder, GstBuffer *buffer)
);
}
status = get_status(result);
- if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
- gst_buffer_unref(buffer);
- break;
- }
-
- switch (nalu.type) {
- case GST_H264_NAL_SLICE_IDR:
- /* fall-through. IDR specifics are handled in init_picture() */
- case GST_H264_NAL_SLICE:
- status = decode_slice(decoder, &nalu);
- break;
- case GST_H264_NAL_SPS:
- status = decode_sps(decoder, &nalu);
- break;
- case GST_H264_NAL_PPS:
- status = decode_pps(decoder, &nalu);
- break;
- case GST_H264_NAL_SEI:
- status = decode_sei(decoder, &nalu);
- break;
- case GST_H264_NAL_SEQ_END:
- status = decode_sequence_end(decoder);
- break;
- case GST_H264_NAL_AU_DELIMITER:
- /* skip all Access Unit NALs */
- status = GST_VAAPI_DECODER_STATUS_SUCCESS;
- break;
- case GST_H264_NAL_FILLER_DATA:
- /* skip all Filler Data NALs */
- status = GST_VAAPI_DECODER_STATUS_SUCCESS;
- break;
- default:
- GST_WARNING("unsupported NAL unit type %d", nalu.type);
- status = GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER;
- break;
- }
+ if (status == GST_VAAPI_DECODER_STATUS_SUCCESS)
+ status = decode_nalu(decoder, &nalu);
gst_buffer_unref(buffer);
} while (status == GST_VAAPI_DECODER_STATUS_SUCCESS);