Main Page   Modules   Compound List   File List   Compound Members   File Members  

xlv_mux.h

00001 /*
00002  * xlv_mux.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  */
00022 #ifndef _XLV_MUX_H
00023 #define _XLV_MUX_H
00024 
00025 #include <glib.h>
00026 #include "xlv_plugin_mgr.h"
00027 #include "xlv_session.h"
00028 #include "xlv_codec.h"
00029 #include "xlv_audio.h"
00030 #include "xlv_video.h"
00031 
00032 #define XLV_MUXER_BASE_CMD 600
00033 
00034 #define XLV_MUXER_NEW_STREAM  (XLV_MUXER_BASE_CMD+0)
00035 #    define XLV_MUXER_AUDIO_STREAM 0
00036 #    define XLV_MUXER_VIDEO_STREAM 1
00037 #    define XLV_MUXER_EXT_STREAM   2
00038 #    define XLV_MUXER_SPU_STREAM   3
00039 
00040 typedef struct _XLV_MuxerStream {
00041     XLV_Stream *m_stream;
00042     guint8 m_stream_type;
00043     const gchar *m_encoding;
00044     guint32 m_codec_data_len;
00045     union {
00046         XLV_PCMData *m_audio_data;
00047         XLV_VideoData *m_video_data;
00048         gpointer m_generic_data;
00049     } m_codec_data;
00050 } XLV_MuxerStream;
00051 
00052 #define XLV_MUXER_SET_TIMESPEC (XLV_MUXER_BASE_CMD+1)
00053 #define XLV_MUXER_SET_MODE     (XLV_MUXER_BASE_CMD+2)
00054 #    define XLV_MUXER_SEEKING   0
00055 #    define XLV_MUXER_STREAMING 1
00056 #define XLV_MUXER_WRITE_HEADERS (XLV_MUXER_BASE_CMD+3)
00057 #define XLV_MUXER_INTERLEAVE    (XLV_MUXER_BASE_CMD+4)
00058 #define XLV_MUXER_NEED_FRAME    (XLV_MUXER_BASE_CMD+5)
00059 
00060 typedef struct _XLV_MuxerInterleave {
00061     guint8 m_interleave_mode;
00065 #    define XLV_MUXER_INTER_SEQUENTIAL 0
00066 
00069 #    define XLV_MUXER_INTER_PARALLEL   1
00070 
00072 #    define XLV_MUXER_INTER_ASAP       2
00073 
00076 #    define XLV_MUXER_INTER_AUTO       3
00077 
00079     guint32 m_interleave_time;
00080 
00081     guint16 m_interleave_flags;
00082 #     define XLV_MUXER_INTER_TIME_MASK     1
00083 #       define XLV_MUXER_INTER_TIME_DELTA    0
00084 #       define XLV_MUXER_INTER_TIME_ABSOLUTE 1
00085 } XLV_MuxerInterleave;
00086 
00087 /* For substreams */
00088 #define XLV_MUXER_STREAM_BASE_CMD     (XLV_MUXER_BASE_CMD+50)
00089 #define XLV_MUXER_STREAM_SET_TIMESPEC (XLV_MUXER_STREAM_BASE_CMD+2)
00090 #define XLV_MUXER_STREAM_NEW_FRAME    (XLV_MUXER_STREAM_BASE_CMD+3)
00091 
00092 typedef struct _XLV_MuxerTimeSpec {
00093     guint8 m_valid_entries;
00094 #   define XLV_MUXER_TIME_FRAME_VALID 0x01
00095 #   define XLV_MUXER_TIME_TIME_VALID 0x02
00096 #   define XLV_MUXER_TIME_SIZE_VALID 0x04
00097 
00098     guint32 m_frames;
00099     guint32 m_time_length;
00100     guint32 m_size;
00101 } XLV_MuxerTimeSpec;
00102 
00103 typedef struct _XLV_Muxer {
00104     XLV_Session *m_session;
00105     XLV_Stream *m_output_stream;
00106     XLV_Stream *m_muxer;
00107     GSList *m_streams;
00108     XLV_MuxerInterleave m_interleave;
00109 } XLV_Muxer;
00110 
00111 typedef struct _XLV_Mux_Stream {
00112     XLV_Muxer *m_muxer;
00113     XLV_Stream *m_stream;
00114 } XLV_Mux_Stream;
00115 
00116 #ifdef __cplusplus
00117 extern "C" {
00118 #endif
00119 
00120     XLV_Muxer *xlv_muxer_new (XLV_Session * session, XLV_Stream * out_stream,
00121                               const gchar * idname);
00122     void xlv_muxer_release (XLV_Muxer * muxer);
00123     gboolean xlv_muxer_set_interleave (XLV_Muxer * muxer, guint8 mode,
00124                                        guint32 inter_time, guint16 flags);
00125     void xlv_muxer_set_time (XLV_Muxer * muxer, guint32 time);
00126 
00127     XLV_Mux_Stream *xlv_muxer_new_stream (XLV_Muxer * muxer,
00128                                           guint8 m_stream_type,
00129                                           XLV_ICodec * codec);
00130     gboolean xlv_muxer_new_frame (XLV_Mux_Stream * s, XLV_CodecFrame * frame);
00131     gboolean xlv_muxer_stream_set_time (XLV_Mux_Stream * s,
00132                                         XLV_MuxerTimeSpec * spec);
00133     /* When several streams are interleaved, this function tells the programmer
00134      * when he/she should add a new frame to the stream.
00135      */
00136     gboolean xlv_muxer_stream_need_frame (XLV_Mux_Stream * s);
00137 
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141 #endif

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