summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2012-09-04 15:12:18 +0300
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-04-10 14:58:16 +0200
commit51151e7aa1637d23880b7c051602970d76a9a45a (patch)
treeb8fc681a6ac405ff37c3d98c8a678e0627e3abae /gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
parent6136ebe5e2fbedc496ac73cdd6461f194630b313 (diff)
downloadgst-vaapi-51151e7aa1637d23880b7c051602970d76a9a45a.tar.gz
Add initial support for GStreamer 1.0.
This integrates support for GStreamer API >= 1.0 only in the libgstvaapi core decoding library. The changes are kept rather minimal here so that the library retains as little dependency as possible on core GStreamer functionality. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
index 074d65e8..5c857e1f 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
@@ -1196,6 +1196,7 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
GstMpegVideoSliceHdr * const slice_hdr = unit->parsed_info;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
+ GstMapInfo map_info;
GST_DEBUG("slice %d (%u bytes)", slice_hdr->slice_vertical_position,
unit->size);
@@ -1203,8 +1204,13 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
if (!is_valid_state(decoder, GST_MPEG_VIDEO_STATE_VALID_PIC_HEADERS))
return GST_VAAPI_DECODER_STATUS_SUCCESS;
+ if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
+ GST_ERROR("failed to map buffer");
+ return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
+ }
+
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
- (GST_BUFFER_DATA(buffer) + unit->offset), unit->size);
+ (map_info.data + unit->offset), unit->size);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@@ -1393,7 +1399,7 @@ gst_vaapi_decoder_mpeg2_parse(GstVaapiDecoder *base_decoder,
if (buf_size < 4)
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
- buf = gst_adapter_peek(adapter, buf_size);
+ buf = gst_adapter_map(adapter, buf_size);
if (!buf)
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
@@ -1476,12 +1482,18 @@ gst_vaapi_decoder_mpeg2_decode(GstVaapiDecoder *base_decoder,
GstMpegVideoPacket packet;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
+ GstMapInfo map_info;
status = ensure_decoder(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
- packet.data = GST_BUFFER_DATA(buffer) + unit->offset;
+ if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
+ GST_ERROR("failed to map buffer");
+ return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
+ }
+
+ packet.data = map_info.data + unit->offset;
packet.size = unit->size;
packet.type = packet.data[3];
packet.offset = 4;