]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_consumer.h
Make mlt_consumer_purge() more thorough. (SF-187)
[mlt] / src / framework / mlt_consumer.h
index be938e996e71082b35cc2574d985c3d6eee62094..e4415516b363747f5ea01eb8943f6335edf89f8a 100644 (file)
  * \properties \em test_card the name of a resource to use as the test card, defaults to
  * environment variable MLT_TEST_CARD. If undefined, the hard-coded default test card is
  * white silence. A test card is what appears when nothing is produced.
- * \event \em consumer-frame-show Subclass implementations should fire this.
- * \event \em consumer-frame-render The abstract class fires this.
- * \event \em consumer-stopped
+ * \event \em consumer-frame-show Subclass implementations fire this immediately after showing a frame
+ * or when a frame should be shown (if audio-only consumer).
+ * \event \em consumer-frame-render The base class fires this immediately before rendering a frame.
+ * \event \em consumer-thread-started The base class fires when beginning execution of a rendering thread.
+ * \event \em consumer-thread-stopped The base class fires when a rendering thread has ended.
+ * \event \em consumer-stopped This is fired when the subclass implementation calls mlt_consumer_stopped().
  * \properties \em fps video frames per second as floating point (read only)
  * \properties \em frame_rate_num the numerator of the video frame rate, overrides \p mlt_profile_s
  * \properties \em frame_rate_den the denominator of the video frame rate, overrides \p mlt_profile_s
  * \properties \em display_aspect_num the numerator of the video frame aspect ratio, overrides \p mlt_profile_s
  * \properties \em display_aspect_den the denominator of the video frame aspect ratio, overrides \p mlt_profile_s
  * \properties \em priority the OS scheduling priority for the render threads when real_time is not 0.
- * \properties \em top_field_first when not progressive, whether interlace field order is top-field-first, defaults to 0
+ * \properties \em top_field_first when not progressive, whether interlace field order is top-field-first, defaults to 0.
+ *   Set this to -1 if the consumer does not care about the field order.
+ * \properties \em mlt_image_format the image format to request in rendering threads, defaults to yuv422
+ * \properties \em mlt_audio_format the audio format to request in rendering threads, defaults to S16
  */
 
 struct mlt_consumer_s
@@ -96,6 +102,12 @@ struct mlt_consumer_s
         */
        int ( *is_stopped )( mlt_consumer );
 
+       /** Purge the consumer of buffered data (virtual function).
+        *
+        * \param mlt_consumer a consumer
+        */
+       void ( *purge )( mlt_consumer );
+
        /** The destructor virtual function
         *
         * \param mlt_consumer a consumer
@@ -118,6 +130,7 @@ struct mlt_consumer_s
        int put_active;
        mlt_event event_listener;
        mlt_position position;
+       int is_purge;
 
        /* additional fields added for the parallel work queue */
        mlt_deque worker_threads;
@@ -127,6 +140,7 @@ struct mlt_consumer_s
        int consecutive_rendered;
        int process_head;
        int started;
+       pthread_t *threads; /**< \private used to deallocate all threads */
 };
 
 #define MLT_CONSUMER_SERVICE( consumer )       ( &( consumer )->parent )