]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blobdiff - src/gstducatividdec.h
mpeg2dec: Fix negotiation issue with playbin
[glsdk/gst-plugin-ducati.git] / src / gstducatividdec.h
index def8247a4dbad57f8f06952a60f4f968a63086b3..56c57c7d94e17b36a083c69abb9367a6ce03ea23 100644 (file)
 
 #include <stdint.h>
 #include <stddef.h>
+#include <unistd.h>
 #include <omap_drm.h>
 #include <omap_drmif.h>
 
 #include "gstducati.h"
 #include "gstducatibufferpriv.h"
 
-#include <gst/drm/gstdrmbufferpool.h>
+#include <gst/drm/gstdrmallocator.h>
 #include <gst/video/video.h>
-#include <gst/video/video-crop.h>
+#include <gst/video/gstvideometa.h>
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_DUCATIVIDDEC               (gst_ducati_viddec_get_type())
 #define GST_DUCATIVIDDEC(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DUCATIVIDDEC, GstDucatiVidDec))
 #define GST_DUCATIVIDDEC_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DUCATIVIDDEC, GstDucatiVidDecClass))
 #define GST_IS_DUCATIVIDDEC(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DUCATIVIDDEC))
 #define GST_IS_DUCATIVIDDEC_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DUCATIVIDDEC))
 #define GST_DUCATIVIDDEC_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DUCATIVIDDEC, GstDucatiVidDecClass))
-
-typedef struct _GstDucatiVidDec      GstDucatiVidDec;
+typedef struct _GstDucatiVidDec GstDucatiVidDec;
 typedef struct _GstDucatiVidDecClass GstDucatiVidDecClass;
 
+/* For re-ordering in normal playback */
 #define MAX_BACKLOG_FRAMES 16
+/* For re-ordering in reverse playback */
+#define MAX_BACKLOG_ARRAY_SIZE 120
 
 struct _GstDucatiVidDec
 {
@@ -52,7 +54,7 @@ struct _GstDucatiVidDec
 
   GstPad *sinkpad, *srcpad;
 
-  GstDRMBufferPool *pool;
+  GstBufferPool *pool;
 
   /* minimum output size required by the codec: */
   gint outsize;
@@ -83,15 +85,11 @@ struct _GstDucatiVidDec
   /* number of bytes pushed to input on current frame: */
   gint in_size;
 
-  /* the crop to attach to output buffers: */
-  GstVideoCrop *crop;
-
   /* on first output buffer, we need to send crop info to sink.. and some
    * operations like flushing should be avoided if we haven't sent any
    * input buffers:
    */
   gboolean first_out_buffer, first_in_buffer;
-  gboolean send_crop_event;
 
   GstSegment segment;
   gdouble qos_proportion;
@@ -100,7 +98,9 @@ struct _GstDucatiVidDec
   gboolean need_out_buf;
 
   /* by default, codec_data from sinkpad is prepended to first buffer: */
-  GstBuffer *codec_data;
+
+  guint8 *codecdata;
+  gsize codecdatasize;
 
   /* workaround enabled to indicate that timestamp from demuxer is PTS,
    * not DTS (cough, cough.. avi):
@@ -118,30 +118,41 @@ struct _GstDucatiVidDec
 
   gboolean needs_flushing;
 
+  gboolean codec_create_params_changed;
+
   GHashTable *passed_in_bufs;
 
+  GHashTable *dce_locked_bufs;
+
 #define NDTS 32
   GstClockTime dts_queue[NDTS];
   gint dts_ridx, dts_widx;
   GstClockTime last_dts, last_pts;
 
-  Engine_Handle           engine;
-  VIDDEC3_Handle          codec;
-  VIDDEC3_Params         *params;
-  VIDDEC3_DynamicParams  *dynParams;
-  VIDDEC3_Status         *status;
-  XDM2_BufDesc           *inBufs;
-  XDM2_BufDesc           *outBufs;
-  VIDDEC3_InArgs         *inArgs;
-  VIDDEC3_OutArgs        *outArgs;
+  Engine_Handle engine;
+  VIDDEC3_Handle codec;
+  VIDDEC3_Params *params;
+  VIDDEC3_DynamicParams *dynParams;
+  VIDDEC3_Status *status;
+  XDM2_BufDesc *inBufs;
+  XDM2_BufDesc *outBufs;
+  VIDDEC3_InArgs *inArgs;
+  VIDDEC3_OutArgs *outArgs;
 
   XDAS_Int16 pageMemType;
   struct omap_device *device;
 
+  GstCaps *sinkcaps;
+
   /* Frames waiting to be reordered */
-  GstBuffer *backlog_frames[MAX_BACKLOG_FRAMES + 1];
+  GstBuffer *backlog_frames[MAX_BACKLOG_ARRAY_SIZE + 1];
   gint backlog_maxframes;
   gint backlog_nframes;
+  gint backlog_max_maxframes;
+
+  gboolean codec_debug_info;
+
+  const char *error_strings[32];
 };
 
 struct _GstDucatiVidDecClass
@@ -155,7 +166,7 @@ struct _GstDucatiVidDecClass
    * class implementation of this method handles standard stuff like
    * width/height/framerate/codec_data.
    */
-  gboolean (*parse_caps) (GstDucatiVidDec * self, GstStructure * s);
+    gboolean (*parse_caps) (GstDucatiVidDec * self, GstStructure * s);
 
   /**
    * Called when the input buffer size changes, to recalculate codec required
@@ -166,33 +177,34 @@ struct _GstDucatiVidDecClass
   /**
    * Called to allocate/initialize  params/dynParams/status/inArgs/outArgs
    */
-  gboolean (*allocate_params) (GstDucatiVidDec * self, gint params_sz,
+    gboolean (*allocate_params) (GstDucatiVidDec * self, gint params_sz,
       gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz);
 
   /**
    * Push input data into codec's input buffer, returning a sub-buffer of
    * any remaining data, or NULL if none.  Consumes reference to 'buf'
    */
-  GstBuffer * (*push_input) (GstDucatiVidDec * self, GstBuffer * buf);
+  GstBuffer *(*push_input) (GstDucatiVidDec * self, GstBuffer * buf);
 
   /**
    * Called to handle errors returned by VIDDEC3_process.
    */
-  gint (*handle_error) (GstDucatiVidDec * self, gint ret, gint extended_error,
+    gint (*handle_error) (GstDucatiVidDec * self, gint ret, gint extended_error,
       gint status_extended_error);
 
   /**
    * Called to check whether it's a good idea to drop buf or not.
    */
-  gboolean (*can_drop_frame) (GstDucatiVidDec * self, GstBuffer * buf, gint64 diff);
+    gboolean (*can_drop_frame) (GstDucatiVidDec * self, GstBuffer * buf,
+      gint64 diff);
 
-  gboolean (*query) (GstDucatiVidDec * self, GstPad * pad, GstQuery * query,
+    gboolean (*query) (GstDucatiVidDec * self, GstPad * pad, GstQuery * query,
       gboolean * forward);
 
   /**
    * Called to push a decoder buffer. Consumes reference to 'buf'.
    */
-  GstFlowReturn (*push_output) (GstDucatiVidDec * self, GstBuffer * buf);
+    GstFlowReturn (*push_output) (GstDucatiVidDec * self, GstBuffer * buf);
 
   /**
    * Called before a flush happens.
@@ -202,7 +214,7 @@ struct _GstDucatiVidDecClass
   /**
    * Called to set new caps on the sink pad.
    */
-  gboolean (*set_sink_caps) (GstDucatiVidDec * self, GstCaps *caps);
+    gboolean (*set_sink_caps) (GstDucatiVidDec * self, GstCaps * caps);
 };
 
 GType gst_ducati_viddec_get_type (void);
@@ -210,7 +222,7 @@ GType gst_ducati_viddec_get_type (void);
 /* helper methods for derived classes: */
 
 static inline void
-push_input (GstDucatiVidDec * self, const guint8 *in, gint sz)
+push_input (GstDucatiVidDec * self, const guint8 * in, gint sz)
 {
   GST_DEBUG_OBJECT (self, "push: %d bytes)", sz);
   memcpy (self->input + self->in_size, in, sz);
@@ -218,8 +230,8 @@ push_input (GstDucatiVidDec * self, const guint8 *in, gint sz)
 }
 
 static inline int
-check_start_code (const guint8 *sc, gint scsize,
-    const guint8 *inbuf, gint insize)
+check_start_code (const guint8 * sc, gint scsize,
+    const guint8 * inbuf, gint insize)
 {
   if (insize < scsize)
     return FALSE;
@@ -236,8 +248,8 @@ check_start_code (const guint8 *sc, gint scsize,
 }
 
 static inline int
-find_start_code (const guint8 *sc, gint scsize,
-    const guint8 *inbuf, gint insize)
+find_start_code (const guint8 * sc, gint scsize,
+    const guint8 * inbuf, gint insize)
 {
   gint size = 0;
   while (insize) {
@@ -250,9 +262,7 @@ find_start_code (const guint8 *sc, gint scsize,
   return size;
 }
 
-gboolean
-gst_ducati_viddec_codec_flush (GstDucatiVidDec * self, gboolean eos);
+gboolean gst_ducati_viddec_codec_flush (GstDucatiVidDec * self, gboolean eos);
 
 G_END_DECLS
-
 #endif /* __GST_DUCATIVIDDEC_H__ */