[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 : * This program is an implementation of a part of one or more MPEG-4 7 : * Video tools as specified in ISO/IEC 14496-2 standard. Those intending 8 : * to use this software module in hardware or software products are 9 : * advised that its use may infringe existing patents or copyrights, and 10 : * any such use would be at such party's own risk. The original 11 : * developer of this software module and his/her company, and subsequent 12 : * editors and their companies, will have no liability for use of this 13 : * software or modifications or derivatives thereof. 14 : * 15 : * This program is free software ; you can redistribute it and/or modify 16 : * it under the terms of the GNU General Public License as published by 17 : * the Free Software Foundation ; either version 2 of the License, or 18 : * (at your option) any later version. 19 : * 20 : * This program is distributed in the hope that it will be useful, 21 : * but WITHOUT ANY WARRANTY ; without even the implied warranty of 22 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 : * GNU General Public License for more details. 24 : * 25 : * You should have received a copy of the GNU General Public License 26 : * along with this program ; if not, write to the Free Software 27 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 : * 29 : suxen_drol 610 * $Id: xvid.h,v 1.21 2002-10-24 10:56:07 suxen_drol Exp$ 30 : edgomez 411 * 31 : *****************************************************************************/ 32 : edgomez 199 33 : #ifndef _XVID_H_ 34 : #define _XVID_H_ 35 : 36 : #ifdef __cplusplus 37 : chl 352 extern "C" { 38 : edgomez 199 #endif 39 : 40 : edgomez 608 41 : /** 42 : * \defgroup global_grp Global constants used in both encoder and decoder. 43 : * 44 : * This module describe all constants used in both the encoder and the decoder. 45 : * @{ 46 : */ 47 : 48 : edgomez 199 /***************************************************************************** 49 : edgomez 608 * API version number 50 : edgomez 199 ****************************************************************************/ 51 : 52 : edgomez 608 /** 53 : * \defgroup api_grp API version 54 : * @{ 55 : */ 56 : edgomez 199 57 : edgomez 608 #define API_VERSION ((2 << 16) | (1))/**< This constant tells you what XviD's 58 : * version this header defines. 59 : * 60 : * You can use it to check if the host XviD library API is the same as the one 61 : * you used to build you client program. If versions mismatch, then it is 62 : * highly possible that your application will segfault because the host XviD 63 : * library and your application use structure fields in different ways. 64 : * 65 : */ 66 : edgomez 199 67 : edgomez 608 /** @} */ 68 : edgomez 199 69 : 70 : edgomez 608 /***************************************************************************** 71 : * Error codes 72 : ****************************************************************************/ 73 : edgomez 199 74 : 75 : edgomez 608 /** 76 : * \defgroup error_grp Error codes used by XviD API entry points. 77 : * @{ 78 : */ 79 : edgomez 199 80 : edgomez 608 #define XVID_ERR_FAIL -1 /**< Operation failed. 81 : * 82 : * The requested XviD operation failed. If this error code is returned from : 83 : *
84 : *
• the xvid_init function : you must not try to use an XviD's instance from 85 : * this point of the code. Clean all instances you 86 : * already created and exit the program cleanly. 87 : *
• xvid_encore or xvid_decore : something was wrong and en/decoding 88 : * operation has not been completed 89 : * sucessfully. At your option, you can 90 : * stop the en/decoding process or just ignore 91 : * and go on. 92 : *
• xvid_stop : you can safely ignore it if you call this function at the 93 : * end of your program. 94 : *
686 : *
• 0 (zero) : Then the rate controler chooses the right quantizer 687 : * for you. Tipically used in ABR encoding or first pass of a VBR 688 : * encoding session. 689 : *
• != 0 : Then you force the encoder to use this specific 690 : * quantizer value. It is clamped in the interval 691 : * [1..31]. Tipically used during the 2nd pass of a VBR encoding 692 : * session. 693 : *
*/ 694 : int intra; /**< [in/out] 695 : * 696 : *
697 : *
• [in] : tells XviD if the frame must be encoded as an intra frame 698 : *
699 : *
• 1: forces the encoder to create a keyframe. Mainly used during 700 : * a VBR 2nd pass. 701 : *
• 0: forces the encoder not to create a keyframe. Minaly used 702 : * during a VBR second pass 703 : *
• -1: let the encoder decide (based on contents and 704 : * max_key_interval). Mainly used in ABR mode and during a 1st 705 : * VBR pass. 706 : *
707 : *
• [out] : When first set to -1, the encoder returns the effective keyframe state 708 : * of the frame. 709 : *
710 : */ 711 : HINTINFO hint; /**< [in/out] 712 : * 713 : * mv hint information */ 714 : edgomez 199 715 : } 716 : XVID_ENC_FRAME; 717 : 718 : 719 : edgomez 608 /** Encoding statistics */ 720 : edgomez 199 typedef struct 721 : { 722 : edgomez 608 int quant; /**< [out] 723 : * 724 : * Frame quantizer used during encoding */ 725 : int hlength; /**< [out] 726 : * 727 : * Header bytes in the resulting MPEG4 stream */ 728 : int kblks; /**< [out] 729 : * 730 : * Number of MacroBlocks coded as Intra blocks */ 731 : int mblks; /**< [out] 732 : * 733 : * Number of MacroBlocks coded as Inter blocks */ 734 : int ublks; /**< [out] 735 : * 736 : * Number of MacroBlocks coded as skipped blocks */ 737 : edgomez 199 } 738 : XVID_ENC_STATS; 739 : 740 : 741 : /***************************************************************************** 742 : * Encoder entry point 743 : ****************************************************************************/ 744 : 745 : edgomez 608 /** 746 : * \defgroup encops_grp Encoder operations 747 : * 748 : * These are all the operations XviD's encoder can perform. 749 : * 750 : * @{ 751 : */ 752 : edgomez 199 753 : suxen_drol 610 #define XVID_ENC_ENCODE 0 /**< Encodes a frame 754 : edgomez 608 * 755 : * This operation constant is used when client application wants to encode a 756 : * frame. Client application must also fill XVID_ENC_FRAME appropriately. 757 : */ 758 : 759 : #define XVID_ENC_CREATE 1 /**< Creates a decoder instance 760 : * 761 : * This operation constant is used by a client application in order to create 762 : * an encoder instance. All instances are independant from each other, so 763 : * client application can use safely various threads, each encoding a 764 : * different set of frames. 765 : */ 766 : 767 : #define XVID_ENC_DESTROY 2 /**< Destroys a encoder instance 768 : * 769 : * This operation constant is used by the client application to destroy a 770 : * previously created encoder instance. 771 : */ 772 : 773 : 774 : /** @} */ 775 : 776 : /** 777 : * \defgroup encentry_grp Encoder entry point 778 : * 779 : * @{ 780 : */ 781 : 782 : /** 783 : * \brief Encoder entry point. 784 : * 785 : * This is the XviD's encoder entry point. The possible operations are 786 : * described in the \ref encops_grp section. 787 : * 788 : * \param handle Todo 789 : * \param opt Todo 790 : * \param param1 Todo 791 : * \param param2 Todo 792 : */ 793 : edgomez 199 int xvid_encore(void *handle, 794 : int opt, 795 : void *param1, 796 : void *param2); 797 : 798 : edgomez 608 /** @} */ 799 : edgomez 199 800 : edgomez 608 /** @} */ 801 : 802 : edgomez 199 #ifdef __cplusplus 803 : } 804 : #endif 805 : 806 : #endif