OSDN Git Service

HandBrake 0.2
[handbrake-jp/handbrake-jp-git.git] / HBCommon.h
1 /* $Id: HBCommon.h,v 1.9 2003/08/24 19:28:18 titer Exp $ */
2
3 #ifndef _HB_COMMON_H
4 #define _HB_COMMON_H
5
6 /* standard headers */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <inttypes.h>
11 typedef uint8_t byte_t; 
12
13 /* BeOS headers */
14 #include <Looper.h>
15 #include <MenuItem.h>
16
17 /* Internal headers */
18 class HBFifo;
19 class HBPictureWin;
20
21 /* Misc structures */
22 typedef struct dvdplay_s * dvdplay_ptr;
23 typedef struct iso639_lang_t
24 {
25     char * engName;        /* Description in English */
26     char * nativeName;     /* Description in native language */
27     char * iso639_1;       /* ISO-639-1 (2 characters) code */
28 } iso639_lang_t;
29
30 /* BMessages */
31 #define MANAGER_CREATED    'macr'
32 #define PRINT_MESSAGE      'prme'
33 #define DETECT_VOLUMES     'devo'
34 #define START_CONVERT      'stac'
35 #define STOP_CONVERT       'stoc'
36 #define SUSPEND_CONVERT    'suco'
37 #define RESUME_CONVERT     'reco'
38 #define VOLUMES_DETECTED   'vode'
39 #define REFRESH_VOLUMES    'revo'
40 #define VIDEO_SLIDER       'visl'
41 #define AUDIO_SLIDER       'ausl'
42 #define PICTURE_WIN        'piwi'
43 #define NOT_IMPLEMENTED    'noim'
44 #define VOLUME_SELECTED   'vose'
45 #define TITLE_SELECTED    'tise'
46 #define LANGUAGE_SELECTED 'lase'
47 #define CHANGE_STATUS     'chst'
48
49 /* Handy macros */
50 #define EVEN( a )        ( ( (a) & 0x1 ) ? ( (a) + 1 ) : (a) )
51 #define MULTIPLE_16( a ) ( ( ( (a) % 16 ) < 8 ) ? ( (a) - ( (a) % 16 ) ) \
52                            : ( (a) - ( (a) % 16 ) + 16 ) )
53
54 /* Global prototypes */
55 void   Log( char * log, ... );
56 void   Status( char * text, float pos, int mode );
57 char * LanguageForCode( int code );
58
59 /* Possible modes in Status() */
60 #define ENABLE_DETECTING 0x1
61 #define ENABLE_READY     0x2
62 #define ENABLE_ENCODING  0x4
63
64 /* Classes */
65
66 class HBAudioInfo : public BMenuItem
67 {
68     public:
69         /* Common methods and members */
70         HBAudioInfo( int id, char * description );
71         HBAudioInfo( HBAudioInfo * audioInfo );
72         ~HBAudioInfo();
73         
74         uint32_t fId;
75         HBFifo * fAc3Fifo;
76         HBFifo * fRawFifo;
77         HBFifo * fMp3Fifo;
78
79         int      fInSampleRate;
80         int      fOutSampleRate;
81         int      fInBitrate;
82         int      fOutBitrate;
83 };
84
85 class HBTitleInfo : public BMenuItem
86 {
87     public:
88         HBTitleInfo( dvdplay_ptr vmg, int index, char * device );
89         ~HBTitleInfo();
90         bool InitCheck();
91     
92         bool           fInitOK;
93         char         * fDevice;
94         int            fIndex;
95         uint64_t       fLength;
96         
97         /* MPEG2-PS data */
98         HBFifo       * fPSFifo;
99        
100         /* Video info */
101         bool           DecodeFrame( dvdplay_ptr vmg, int i );
102
103         HBFifo       * fMpeg2Fifo;
104         HBFifo       * fRawFifo;
105         HBFifo       * fMpeg4Fifo;
106         
107         /* Video input */
108         uint32_t       fInWidth;
109         uint32_t       fInHeight;
110         uint32_t       fPixelWidth;
111         uint32_t       fPixelHeight;
112         uint32_t       fRate;
113         uint32_t       fScale;
114         
115         /* Video output */
116         bool           fDeinterlace;
117         uint32_t       fOutWidth;
118         uint32_t       fOutHeight;
119         uint32_t       fTopCrop;
120         uint32_t       fBottomCrop;
121         uint32_t       fLeftCrop;
122         uint32_t       fRightCrop;
123         uint32_t       fBitrate;
124         
125         uint8_t      * fPictures[10];
126         HBPictureWin * fPictureWin;
127         
128         /* Audio infos */
129         BList        * fAudioInfoList1;
130         BList        * fAudioInfoList2;
131 };
132
133 class HBVolumeInfo : public BMenuItem
134 {
135     public:
136         HBVolumeInfo( char * name, char * device );
137         ~HBVolumeInfo();
138         bool InitCheck();
139     
140         bool    fInitOK;
141         char  * fName;
142         char  * fDevice;
143         BList * fTitleList;
144 };
145
146 #endif