summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2011-11-18 15:41:40 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-01-16 11:40:51 +0100
commitc3455e341e6b441e5468ecd9356f7625cb685dce (patch)
treebaa129ac409326da51710e8980a1016b307415e4 /gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
parent6ae97634cf8d8c5f0978a52202e29a5cbdd5c062 (diff)
vc1: replace GstVaapiTSB with GstAdapter (gst-plugins-base >= 0.10.24).
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapidecoder_vc1.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_vc1.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
index 55d0f0b8..0bf52371 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
@@ -31,7 +31,6 @@
#include "gstvaapidecoder_priv.h"
#include "gstvaapidisplay_priv.h"
#include "gstvaapiobject_priv.h"
-#include "gstvaapiutils_tsb.h"
#define DEBUG 1
#include "gstvaapidebug.h"
@@ -58,7 +57,7 @@ struct _GstVaapiDecoderVC1Private {
GstVaapiPicture *current_picture;
GstVaapiPicture *next_picture;
GstVaapiPicture *prev_picture;
- GstVaapiTSB *tsb;
+ GstAdapter *adapter;
GstBuffer *sub_buffer;
guint8 *rbdu_buffer;
guint rbdu_buffer_size;
@@ -125,9 +124,10 @@ gst_vaapi_decoder_vc1_close(GstVaapiDecoderVC1 *decoder)
priv->bitplanes = NULL;
}
- if (priv->tsb) {
- gst_vaapi_tsb_destroy(priv->tsb);
- priv->tsb = NULL;
+ if (priv->adapter) {
+ gst_adapter_clear(priv->adapter);
+ g_object_unref(priv->adapter);
+ priv->adapter = NULL;
}
}
@@ -138,8 +138,8 @@ gst_vaapi_decoder_vc1_open(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
gst_vaapi_decoder_vc1_close(decoder);
- priv->tsb = gst_vaapi_tsb_new();
- if (!priv->tsb)
+ priv->adapter = gst_adapter_new();
+ if (!priv->adapter)
return FALSE;
priv->bitplanes = gst_vc1_bitplanes_new();
@@ -970,7 +970,7 @@ decode_frame(GstVaapiDecoderVC1 *decoder, GstVC1BDU *rbdu, GstVC1BDU *ebdu)
}
/* Update presentation time */
- pts = gst_vaapi_tsb_get_timestamp(priv->tsb);
+ pts = gst_adapter_prev_timestamp(priv->adapter, NULL);
picture->pts = pts;
/* Update reference pictures */
@@ -1111,7 +1111,8 @@ decode_buffer(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
if (!buf && buf_size == 0)
return decode_sequence_end(decoder);
- gst_vaapi_tsb_push(priv->tsb, buffer);
+ gst_buffer_ref(buffer);
+ gst_adapter_push(priv->adapter, buffer);
/* Assume demuxer sends out plain frames if codec-data */
codec_data = GST_VAAPI_DECODER_CODEC_DATA(decoder);
@@ -1122,7 +1123,9 @@ decode_buffer(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
ebdu.offset = 0;
ebdu.data = buf;
status = decode_ebdu(decoder, &ebdu);
- gst_vaapi_tsb_pop(priv->tsb, buf_size);
+
+ if (gst_adapter_available(priv->adapter) >= buf_size)
+ gst_adapter_flush(priv->adapter, buf_size);
return status;
}
@@ -1153,9 +1156,12 @@ decode_buffer(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
break;
ofs += ebdu.offset + ebdu.size;
- gst_vaapi_tsb_pop(priv->tsb, ebdu.offset);
+ if (gst_adapter_available(priv->adapter) >= ebdu.offset)
+ gst_adapter_flush(priv->adapter, ebdu.offset);
+
status = decode_ebdu(decoder, &ebdu);
- gst_vaapi_tsb_pop(priv->tsb, ebdu.size);
+ if (gst_adapter_available(priv->adapter) >= ebdu.size)
+ gst_adapter_flush(priv->adapter, ebdu.size);
} while (status == GST_VAAPI_DECODER_STATUS_SUCCESS);
return status;
}
@@ -1316,7 +1322,7 @@ gst_vaapi_decoder_vc1_init(GstVaapiDecoderVC1 *decoder)
priv->current_picture = NULL;
priv->next_picture = NULL;
priv->prev_picture = NULL;
- priv->tsb = NULL;
+ priv->adapter = NULL;
priv->sub_buffer = NULL;
priv->rbdu_buffer = NULL;
priv->rbdu_buffer_size = 0;