[svn] / trunk / xvidcore / src / xvid.h Repository: Repository Listing svn

# Annotation of /trunk/xvidcore/src/xvid.h

 1 : edgomez 199 /***************************************************************************** 2 : edgomez 411 * 3 : * XVID MPEG-4 VIDEO CODEC 4 : * - XviD Main header file - 5 : * 6 : edgomez 648 * This file is part of XviD, a free MPEG-4 video encoder/decoder 7 : edgomez 411 * 8 : edgomez 648 * XviD is free software; you can redistribute it and/or modify it 9 : * under the terms of the GNU General Public License as published by 10 : * the Free Software Foundation; either version 2 of the License, or 11 : edgomez 411 * (at your option) any later version. 12 : * 13 : * This program is distributed in the hope that it will be useful, 14 : edgomez 648 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 : edgomez 411 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 : * GNU General Public License for more details. 17 : * 18 : * You should have received a copy of the GNU General Public License 19 : edgomez 648 * along with this program; if not, write to the Free Software 20 : edgomez 411 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 : * 22 : edgomez 648 * Under section 8 of the GNU General Public License, the copyright 23 : * holders of XVID explicitly forbid distribution in the following 24 : * countries: 25 : edgomez 411 * 26 : edgomez 648 * - Japan 27 : * - United States of America 28 : * 29 : * Linking XviD statically or dynamically with other modules is making a 30 : * combined work based on XviD. Thus, the terms and conditions of the 31 : * GNU General Public License cover the whole combination. 32 : * 33 : * As a special exception, the copyright holders of XviD give you 34 : * permission to link XviD with independent modules that communicate with 35 : * XviD solely through the VFW1.1 and DShow interfaces, regardless of the 36 : * license terms of these independent modules, and to copy and distribute 37 : * the resulting combined work under terms of your choice, provided that 38 : * every copy of the combined work is accompanied by a complete copy of 39 : * the source code of XviD (the version of XviD used to produce the 40 : * combined work), being distributed under the terms of the GNU General 41 : * Public License plus this exception. An independent module is a module 42 : * which is not derived from or based on XviD. 43 : * 44 : * Note that people who make modified versions of XviD are not obligated 45 : * to grant this special exception for their modified versions; it is 46 : * their choice whether to do so. The GNU General Public License gives 47 : * permission to release a modified version without this exception; this 48 : * exception also makes it possible to release a modified version which 49 : * carries forward this exception. 50 : * 51 : * $Id: xvid.h,v 1.23 2002-11-16 23:38:16 edgomez Exp$ 52 : * 53 : edgomez 411 *****************************************************************************/ 54 : edgomez 199 55 : #ifndef _XVID_H_ 56 : #define _XVID_H_ 57 : 58 : #ifdef __cplusplus 59 : chl 352 extern "C" { 60 : edgomez 199 #endif 61 : 62 : edgomez 608 63 : /** 64 : * \defgroup global_grp Global constants used in both encoder and decoder. 65 : * 66 : * This module describe all constants used in both the encoder and the decoder. 67 : * @{ 68 : */ 69 : 70 : edgomez 199 /***************************************************************************** 71 : edgomez 608 * API version number 72 : edgomez 199 ****************************************************************************/ 73 : 74 : edgomez 608 /** 75 : * \defgroup api_grp API version 76 : * @{ 77 : */ 78 : edgomez 199 79 : edgomez 608 #define API_VERSION ((2 << 16) | (1))/**< This constant tells you what XviD's 80 : * version this header defines. 81 : * 82 : * You can use it to check if the host XviD library API is the same as the one 83 : * you used to build you client program. If versions mismatch, then it is 84 : * highly possible that your application will segfault because the host XviD 85 : suxen_drol 629 * library and your application use different structures. 86 : edgomez 608 * 87 : */ 88 : edgomez 199 89 : edgomez 608 /** @} */ 90 : edgomez 199 91 : 92 : edgomez 608 /***************************************************************************** 93 : * Error codes 94 : ****************************************************************************/ 95 : edgomez 199 96 : 97 : edgomez 608 /** 98 : suxen_drol 629 * \defgroup error_grp Error codes returned by XviD API entry points. 99 : edgomez 608 * @{ 100 : */ 101 : edgomez 199 102 : edgomez 608 #define XVID_ERR_FAIL -1 /**< Operation failed. 103 : * 104 : * The requested XviD operation failed. If this error code is returned from : 105 : *
106 : *
• the xvid_init function : you must not try to use an XviD's instance from 107 : * this point of the code. Clean all instances you 108 : * already created and exit the program cleanly. 109 : *
• xvid_encore or xvid_decore : something was wrong and en/decoding 110 : suxen_drol 629 * operation was not completed sucessfully. 111 : * you can stop the en/decoding process or just 112 : * ignore and go on. 113 : edgomez 608 *
• xvid_stop : you can safely ignore it if you call this function at the 114 : * end of your program. 115 : *
705 : *
• 0 (zero) : Then the rate controler chooses the right quantizer 706 : suxen_drol 629 * for you. Typically used in ABR encoding, or first pass of a VBR 707 : edgomez 608 * encoding session. 708 : *
• != 0 : Then you force the encoder to use this specific 709 : * quantizer value. It is clamped in the interval 710 : * [1..31]. Tipically used during the 2nd pass of a VBR encoding 711 : * session. 712 : *
*/ 713 : int intra; /**< [in/out] 714 : * 715 : *
716 : *
• [in] : tells XviD if the frame must be encoded as an intra frame 717 : *
718 : *
• 1: forces the encoder to create a keyframe. Mainly used during 719 : * a VBR 2nd pass. 720 : *
• 0: forces the encoder not to create a keyframe. Minaly used 721 : * during a VBR second pass 722 : *
• -1: let the encoder decide (based on contents and 723 : * max_key_interval). Mainly used in ABR mode and during a 1st 724 : * VBR pass. 725 : *
726 : *
• [out] : When first set to -1, the encoder returns the effective keyframe state 727 : * of the frame. 728 : *
729 : */ 730 : HINTINFO hint; /**< [in/out] 731 : * 732 : * mv hint information */ 733 : edgomez 199 734 : } 735 : XVID_ENC_FRAME; 736 : 737 : 738 : edgomez 608 /** Encoding statistics */ 739 : edgomez 199 typedef struct 740 : { 741 : edgomez 608 int quant; /**< [out] 742 : * 743 : * Frame quantizer used during encoding */ 744 : int hlength; /**< [out] 745 : * 746 : * Header bytes in the resulting MPEG4 stream */ 747 : int kblks; /**< [out] 748 : * 749 : suxen_drol 629 * Number of intra macro blocks */ 750 : edgomez 608 int mblks; /**< [out] 751 : * 752 : suxen_drol 629 * Number of inter macro blocks */ 753 : edgomez 608 int ublks; /**< [out] 754 : * 755 : suxen_drol 629 * Number of skipped macro blocks */ 756 : edgomez 199 } 757 : XVID_ENC_STATS; 758 : 759 : 760 : /***************************************************************************** 761 : * Encoder entry point 762 : ****************************************************************************/ 763 : 764 : edgomez 608 /** 765 : * \defgroup encops_grp Encoder operations 766 : * 767 : * These are all the operations XviD's encoder can perform. 768 : * 769 : * @{ 770 : */ 771 : edgomez 199 772 : suxen_drol 610 #define XVID_ENC_ENCODE 0 /**< Encodes a frame 773 : edgomez 608 * 774 : * This operation constant is used when client application wants to encode a 775 : * frame. Client application must also fill XVID_ENC_FRAME appropriately. 776 : */ 777 : 778 : #define XVID_ENC_CREATE 1 /**< Creates a decoder instance 779 : * 780 : * This operation constant is used by a client application in order to create 781 : suxen_drol 629 * an encoder instance. Encoder instances are independant from each other. 782 : edgomez 608 */ 783 : 784 : #define XVID_ENC_DESTROY 2 /**< Destroys a encoder instance 785 : * 786 : * This operation constant is used by the client application to destroy a 787 : * previously created encoder instance. 788 : */ 789 : 790 : 791 : /** @} */ 792 : 793 : /** 794 : * \defgroup encentry_grp Encoder entry point 795 : * 796 : * @{ 797 : */ 798 : 799 : /** 800 : * \brief Encoder entry point. 801 : * 802 : * This is the XviD's encoder entry point. The possible operations are 803 : * described in the \ref encops_grp section. 804 : * 805 : suxen_drol 629 * \param handle Encoder instance handle 806 : * \param opt Encoder option constant 807 : * \param param1 Used to pass XVID_ENC_PARAM or XVID_ENC_FRAME structures. 808 : * \param param2 Optionally used to pass the XVID_ENC_STATS structure. 809 : edgomez 608 */ 810 : edgomez 199 int xvid_encore(void *handle, 811 : int opt, 812 : void *param1, 813 : void *param2); 814 : 815 : edgomez 608 /** @} */ 816 : edgomez 199 817 : edgomez 608 /** @} */ 818 : 819 : edgomez 199 #ifdef __cplusplus 820 : } 821 : #endif 822 : 823 : #endif