Main Page   Modules   Compound List   File List   Compound Members   File Members  

xlv_handler.h

Go to the documentation of this file.
00001 /*
00002  * xlv_handler.h
00003  *
00004  * Copyright (C) 2001 Guilhem Lavaux
00005  *
00006  * This file is part of XLV, a free middleware audio-video stream coder/decoder.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * XLV is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00025 #ifndef _XLV_HANDLER_H
00026 #define _XLV_HANDLER_H
00027 
00028 #include <glib.h>
00029 
00030 #include <pthread.h>
00031 
00032 #include "xlv_plugin_mgr.h"
00033 #include "xlv_timer.h"
00034 #include "xlv_renderer.h"
00035 #include "xlv_list.h"
00036 
00044 #define XLV_HBUFFER_DONE    0x0001UL
00045 
00049 #define XLV_HBUFFER_PASSED  0x0002UL
00050 
00054 #define XLV_HBUFFER_SYNC    0x0004UL
00055 
00058 #define XLV_HBUFFER_WAITFOR 0x0008UL
00059 
00063 #define XLV_HBUFFER_ACCEL   0x0010UL
00064 
00067 typedef struct _XLV_HandlerBuffer XLV_HandlerBuffer;
00068 
00070 struct _XLV_HandlerBuffer {
00072     guint m_id;
00074     void *m_buffer;
00079     guint32 m_size;
00081     guint32 m_orig_size;
00083     guint m_flags;
00085     guint32 m_timestamp;
00087     void *m_privatedata;
00088 };
00089 
00091 typedef struct _XLV_OutputHandler XLV_OutputHandler;
00092 
00094 struct _XLV_OutputHandler {
00095     XLV_Timer *m_timer;
00096     XLV_Timer *m_ref_timer;
00097     XLV_Stream *m_output;
00098 
00099     /* Ring buffer management */
00100     XLV_HandlerBuffer *m_ring_buffer;
00101     guint m_ring_buffer_len;
00102     guint32 m_ring_buffer_size;
00103 
00104     /* Is it alive ? */
00105     gboolean m_alive;
00106     gboolean m_pause_queue;
00107     gboolean m_force_pause;
00108 
00109     /* Queue */
00110     gboolean m_halt_queue;
00111     XLV_ListPool *m_pool;
00112     XLV_List *m_queue;
00113     XLV_List *m_done_buffers;
00114 
00115     /* Thread operators */
00116     pthread_t m_q_thread;
00117     pthread_mutex_t m_queue_mutex;
00118     pthread_mutex_t m_done_mutex;
00119     pthread_cond_t m_queue_sleep;
00120 
00121     guint32 m_passed_frames;
00122     guint32 m_frame_time;
00123     guint32 m_renderer_delay;
00124 };
00125 
00126 #ifdef __cplusplus
00127 extern "C" {
00128 #endif
00129 
00139     XLV_OutputHandler *xlv_new_ohandler (XLV_Stream * out);
00140 
00144     void xlv_ohandler_release (XLV_OutputHandler * handler);
00145 
00150     void xlv_ohandler_use_timer (XLV_OutputHandler * handler,
00151                                  XLV_Timer * ref_timer);
00152     
00155     void xlv_ohandler_sync_on (XLV_OutputHandler * handler,
00156                                XLV_OutputHandler * synch);
00157 
00159     void xlv_ohandler_set_frame_time (XLV_OutputHandler * handler, guint32 t);
00160 
00161     void xlv_ohandler_allocate_ring_buffer (XLV_OutputHandler * handler,
00162                                             guint ring_depth);
00163 
00165     void xlv_ohandler_free_ring_buffer (XLV_OutputHandler * handler);
00166     void xlv_ohandler_set_element_size (XLV_OutputHandler * handler,
00167                                         guint32 elem_size);
00168 
00169 /* Return a free buffer where you can write whatever you want to */
00170     XLV_HandlerBuffer *xlv_ohandler_get_buffer (XLV_OutputHandler * handler);
00171     XLV_HandlerBuffer *xlv_ohandler_get_sync_buffer (XLV_OutputHandler *
00172                                                      handler);
00173 
00174     void xlv_ohandler_put_buffer (XLV_OutputHandler * handler, XLV_HandlerBuffer *buf);
00175 
00176 /* Queue management */
00177     guint xlv_ohandler_queue (XLV_OutputHandler * handler,
00178                               XLV_HandlerBuffer * buf);
00179     void xlv_ohandler_wait (XLV_OutputHandler * handler,
00180                             XLV_HandlerBuffer * buf);
00181     void xlv_ohandler_halt_queue (XLV_OutputHandler * handler);
00182     void xlv_ohandler_resume_queue (XLV_OutputHandler * handler);
00183     void xlv_ohandler_resynchronize (XLV_OutputHandler * handler,
00184                                      guint32 time_stamp);
00185     void xlv_ohandler_flush (XLV_OutputHandler * handler);
00186     void xlv_ohandler_empty_queue (XLV_OutputHandler * handler);
00187 
00188 /* Handler state */
00189     gboolean xlv_ohandler_ready (XLV_OutputHandler * handler);
00190 
00191     gboolean xlv_ohandler_is_critical (XLV_OutputHandler * handler);
00192     guint16 xlv_ohandler_to_skip (XLV_OutputHandler * handler);
00193     gboolean xlv_ohandler_is_half_empty (XLV_OutputHandler * handler);
00194 
00195 #ifdef __cplusplus
00196 }
00197 #endif
00198 #endif

Generated on Mon Jul 1 19:39:05 2002 for XLV by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002