⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zumjmux.h

📁 jpeg and mpeg 编解码技术源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _ZUMJMUX_H_
#define _ZUMJMUX_H_

#include <windows.h>

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the ZUMJMUX_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// ZUMJMUX_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef ZUMJMUX_EXPORTS
#define ZUMJMUX_API __declspec(dllexport)
#else
#define ZUMJMUX_API __declspec(dllimport)
#endif


enum ZUMJMUX_API LockStatus {MUX_UNLOCKED, MUX_LOCKED} ;


/********************************************************************************************/
/*																							*/
/* There are three available synchronization modes:											*/
/* 1. MUX_AV_OSYNC_AND_GENLOCK. This synchronization mode declares a situation where the	*/
/*    Audio	stream and the Video stream are completely synchronized.						*/
/* 2. MUX_AV_SYNC_BY_V_TS - This synchronization mode declares a situation where Video time	*/
/*    stamps is specified in Video stream and we can detect out-of-sync by using them.		*/
/*    Once out-of-sync was detected the corresponding Audio samples are discarded.			*/
/*    This synchronization mode does not enable handling drifts between Audio and Video		*/
/*    clocks.																				*/
/* 3. MUX_AV_NO_SYNC - This synchronization mode does not provide any instrument for		*/
/*	  recognizing out-of-sync conditions. Therefore lack of synchronization between Video	*/
/*	  and Audio that may appear while presentation can be as a result of a clock drift or	*/
/*	  out-of-sync.																			*/
/*																							*/
/********************************************************************************************/

enum ZUMJMUX_API SynchronizationModeStatus {
		MUX_AV_SYNC_BY_V_TS, 
		MUX_AV_NO_SYNC
};

/********************************************************************************************/
/*																							*/
/*	All the setvice routines are from MxMessage type.										*/
/*																							*/
/********************************************************************************************/
 
enum ZUMJMUX_API MxMessage 
{
	MUX_OK,							// Approval for the application.
	MUX_CANT_ALLOCATE_NEW_HANDLE,	// There is no available handle for the application.
	MUX_ILLEGAL_PARAMETER,			// One of the application parameters is not legal.
	MUX_FORBIDDEN_CALLS_FLOW,		// Service routine was called in a forbidden order.
	MUX_UNDEFINED_HANDLE,			// The application handle does not exists.
	MUX_LACK_OF_OUTPUT_BUFFERS,		// The Mux stopped as a result of lack of output buffers.	
	MUX_LACK_OF_VIDEO_BUFFERS,		// The Mux stopped as a result of lack of Video buffers.
	MUX_LACK_OF_AUDIO_BUFFERS,		// The Mux stopped as a result of lack of Audio buffers.
	MUX_MEMORY_ALLOCATION_FAILED,	// Failure in allocating memory.
	MUX_CANNOT_OPEN_FILE,			// The Mux can not open the given filename.
	MUX_FILE_MODE,					// This error message is used if an output buffer is given
									// by the application to the Mux when the working mode is file mode. 
	MUX_AUDIO_STREAM_IS_ILLEGAL,	// Returned if the Audio stream don't correspond to the assumption 
									// that all the Audio frames in the Audio stream has the same size 
									// ( plus minus 2-3 bytes). In this case the Mux will Stop the 
									// multiplexing operation and close the application handle.
	MUX_DONE,						// Mux announcement that the multiplexing operaiton is done.
	MUX_ERROR							
};


// Available resolutions in Z1011 model. 

enum ZUMJMUX_API MxResolution {MUX_SIF, MUX_QSIF}; 

enum ZUMJMUX_API MxBufferType
{
		MUX_VIDEO,		// Send the MPEG video elementry stream.
		MUX_AUDIO,		// Send the MPEG audio elementry stream. 
		MUX_MPEG		// Return the system layer MPEG stream.
};

typedef ZUMJMUX_API unsigned char MxHandle;

#define MUX_AUDIO_STREAM_DOES_NOT_EXIST 0
#define MUX_VIDEO_STREAM_DOES_NOT_EXIST 0 


/********************************************************************************************/
/*																							*/
/* The following data structures definitions are common for the System Mux and				*/
/* the application:																			*/
/*																							*/
/* MxParams - Parameters structure, holds the parameters that the application provides for 	*/
/*			  the Mux in order to specify a specific format for the Mux operation.			*/
/*																							*/
/* Buffer - Data structure, Input/Output stream-data buffer sent by the application for		*/
/*          the Mux usage  																	*/
/*																							*/
/********************************************************************************************/

struct ZUMJMUX_API MxParams{ 

	LockStatus SystemAudioLockFlag; // Setting its value to MUX_LOCKED indicates for the STD that 
									// the Audio clock and the system time clock (STC) are locked.

	unsigned int STDAudioBufferSize;		// Define the size of the STD input buffer for Audio data.
	
	LockStatus SystemVideoLockFlag; // Setting its value to MUX_LOCKED indicates for the STD that 
									// the Video clock and the system time clock (STC) are locked.

	unsigned int STDVideoBufferSize;		// Define the size of the STD input buffer for Video data.
	
	SynchronizationModeStatus SynchronizationModes;	// This parameter defines the available 
													// synchronization modes for the input 
													// Audio/Video streams. Each synchronization 
													// mode describes a specific set of assumption 
													// on the Mux behavior.  	
		
	unsigned int MuxRate;			// Specify the rate at which the STD receives the multiplexed stream 
							// during the pack in which it is included. 

	BOOL FixedFlag;			// Setting its value to TRUE indicates fixed bit-rate otherwise 
							// variable bit-rate operation is indicated. 
	char *MxFileName;		// Specifies the filename that the muxed stream should be written to.

	BOOL VCDFlag;			// This is a one-bit flag. Setting its value to TRUE specifies that the 
							// SysMux operation is subjected to the Video CD constrains. 

	BOOL AllowScrSkip;				// This flag specifying the SCR  Policy. If its value is set to
									// TRUE then SCR is increased by skipping the necessary  values.
									// Otherwise SCR is increased by adding a padding pack.  	

	int SystemHeadersFrequency;		// Specifies the maximum time interval between two 
									// consecutive System_headers. Its units are 1/(60sec). 

	BOOL ExclusiveSystemHeaderPack;	// If its value is set to TRUE then the packs that include the 
									// System_header will not include any packet_data, instead they 
									// will contain padding_packets (one per pack).If its value is 
									// set to FALSE then no constrains are applied.

	unsigned int AudioPackSize;		// Specify the number of bytes in the Audio pack.Setting its 
									// value to MUX_AUDIO_STREAM_DOES_NOT_EXIST indicates that 
									// Audio stream is not exist.

    BOOL FixedAudioPacketHeaderSize;	// Setting its value to MxTRUE indicates fixed packet header
										// size of 13 bytes. Otherwise the header can be smaller.

    unsigned int VideoPackSize;			// Specify the number of bytes in the Video pack.Setting its
										// value to MUX_VIDEO_STREAM_DOES_NOT_EXIST indicates that 
										// Video stream is not exist.

	BOOL BalanceStreamSize;				// Setting this value to TRUE allow the mux to add silent 
										// Audio frames artificially in order to control the audio 
										// stream size (in aspects of time).										

};

struct ZUMJMUX_API MxBuffer{

	MxBufferType BufferType;	// Defines the buffer type Audio/Video/MuxedStream.  
	unsigned int BufferSize;	// Holds the data buffer size in bytes.
	unsigned int Position;				// Holds the current number of bytes that the System Mux read 
								// (write) until now.
	BOOL Done;					// Indicating if the System Mux had finished writing to the output 
								// buffer. 
	BOOL LastBuffer;			// Setting its value to TRUE specifies that this is the last 
								// buffer of the type 'type'. 
	char *Data;					// Data is a pointer to the data buffer in which the necessary data
								// for (or from) the System Mux is stored.		
} ;


/********************************************************************************************/
/*																							*/
/*		SERVICES ROUTINES FOR THE APPLICATION												*/
/*																							*/
/********************************************************************************************/

/************************************************************************************/
/*																					*/
/*	Function name: MxOpen															*/
/*																					*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -