From: David Flynn <[email protected]>

Rather than add extra members to SchroFrame, keep tag information in
the deocder's SchroPicture.

Signed-off-by: David Flynn <[email protected]>
---
 schroedinger/schrodecoder.c |   33 +++++++++++++++++++++++++++++----
 schroedinger/schrodecoder.h |    2 ++
 schroedinger/schroframe.h   |    4 ----
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/schroedinger/schrodecoder.c b/schroedinger/schrodecoder.c
index 3f3fb38..957c15d 100644
--- a/schroedinger/schrodecoder.c
+++ b/schroedinger/schrodecoder.c
@@ -499,6 +499,35 @@ schro_decoder_get_picture_number (SchroDecoder *decoder)
 }
 
 /**
+ * schro_decoder_get_picture_tag:
+ * @decoder: a decoder object
+ *
+ * Returns any tag associated with the next picture to be returned
+ * by @schro_decoder_pull().  Ownership of the tag is transfered to
+ * the caller.
+ *
+ * Returns: a tag represented by void* or NULL
+ */
+void *
+schro_decoder_get_picture_tag (SchroDecoder *decoder)
+{
+  SchroDecoderInstance *instance = decoder->instance;
+  SchroPicture *picture = NULL;
+
+  if (instance->reorder_queue->n >= instance->reorder_queue_size ||
+      instance->flushing) {
+    picture = schro_queue_peek (instance->reorder_queue);
+  }
+  if (picture) {
+    void *tag = picture->tag;
+    picture->tag = NULL;
+    picture->tag_free = NULL;
+    return tag;
+  }
+  return NULL;
+}
+
+/**
  * schro_decoder_add_output_picture:
  * @decoder: a decoder object
  * @frame: the frame to add to the picture queue
@@ -653,10 +682,6 @@ schro_decoder_pull (SchroDecoder *decoder)
 
   /* XXX would be nice to warn if expected picture not present */
   frame = schro_frame_ref (picture->output_picture);
-  frame->tag = picture->tag;
-  frame->tag_free = picture->tag_free;
-  picture->tag = NULL;
-
   schro_picture_unref (picture);
 
   return frame;
diff --git a/schroedinger/schrodecoder.h b/schroedinger/schrodecoder.h
index 156ebae..e435ed4 100644
--- a/schroedinger/schrodecoder.h
+++ b/schroedinger/schrodecoder.h
@@ -198,6 +198,8 @@ int schro_decoder_autoparse_wait (SchroDecoder *decoder);
 int schro_decoder_autoparse_push (SchroDecoder *decoder, SchroBuffer *buffer);
 int schro_decoder_autoparse_push_end_of_sequence (SchroDecoder *decoder);
 
+void* schro_decoder_get_picture_tag (SchroDecoder *decoder);
+
 int schro_decoder_decode_parse_header (SchroUnpack *unpack);
 void schro_decoder_parse_sequence_header (SchroDecoderInstance *instance, 
SchroUnpack *unpack);
 int schro_decoder_compare_sequence_header_buffer (SchroBuffer *a, SchroBuffer 
*b);
diff --git a/schroedinger/schroframe.h b/schroedinger/schroframe.h
index ac8516e..4b0bb76 100644
--- a/schroedinger/schroframe.h
+++ b/schroedinger/schroframe.h
@@ -88,10 +88,6 @@ struct _SchroFrame {
   void *virt_priv2;
 
   int extension;
-
-  /* private data that is associated with this picture */
-  void *tag;
-  void (*tag_free) (void*);
 };
 
 struct _SchroUpsampledFrame {
-- 
1.5.6.5


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Schrodinger-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to