Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

libmpeg3.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef LIBMPEG3_H
00021 #define LIBMPEG3_H
00022 
00023 #include "mpeg3private.h"
00024 
00025 #if defined(__cplusplus)
00026 extern "C" {
00027 #endif
00028 
00029 /* Supported color models for mpeg3_read_frame */
00030 #define MPEG3_RGB565 2
00031 #define MPEG3_BGR888 0
00032 #define MPEG3_BGRA8888 1
00033 #define MPEG3_RGB888 3
00034 #define MPEG3_RGBA8888 4
00035 #define MPEG3_RGBA16161616 5
00036 
00037 /* Color models for the 601 to RGB conversion */
00038 /* 601 not implemented for scalar code */
00039 #define MPEG3_601_RGB565 11
00040 #define MPEG3_601_BGR888 7
00041 #define MPEG3_601_BGRA8888 8
00042 #define MPEG3_601_RGB888 9
00043 #define MPEG3_601_RGBA8888 10
00044 
00045 /* Check for file compatibility.  Return 1 if compatible. */
00046 LIBMPEG_EXPORT int mpeg3_check_sig(char *path);
00047 
00048 /* Open the MPEG3 stream. */
00049 LIBMPEG_EXPORT mpeg3_t* mpeg3_open(char *path);
00050 
00051 /* Open the MPEG3 stream and copy the tables from an already open stream. */
00052 /* Eliminates the initial timecode search. */
00053 LIBMPEG_EXPORT mpeg3_t* mpeg3_open_copy(char *path, mpeg3_t *old_file);
00054 LIBMPEG_EXPORT int mpeg3_close(mpeg3_t *file);
00055 
00056 /* Performance */
00057 LIBMPEG_EXPORT int mpeg3_set_cpus(mpeg3_t *file, int cpus);
00058 LIBMPEG_EXPORT int mpeg3_set_mmx(mpeg3_t *file, int use_mmx);
00059 
00060 /* Query the MPEG3 stream about audio. */
00061 LIBMPEG_EXPORT int mpeg3_has_audio(mpeg3_t *file);
00062 LIBMPEG_EXPORT int mpeg3_total_astreams(mpeg3_t *file);             /* Number of multiplexed audio streams */
00063 LIBMPEG_EXPORT int mpeg3_audio_channels(mpeg3_t *file, int stream);
00064 LIBMPEG_EXPORT int mpeg3_sample_rate(mpeg3_t *file, int stream);
00065 
00066 /* Total length obtained from the timecode. */
00067 /* For DVD files, this is unreliable. */
00068 LIBMPEG_EXPORT long mpeg3_audio_samples(mpeg3_t *file, int stream); 
00069 LIBMPEG_EXPORT int mpeg3_set_sample(mpeg3_t *file, long sample, int stream);    /* Seek to a sample */
00070 LIBMPEG_EXPORT long mpeg3_get_sample(mpeg3_t *file, int stream);    /* Tell current position */
00071 
00072 /* Read a PCM buffer of audio from 1 channel and advance the position. */
00073 /* Return a 1 if error. */
00074 /* Stream defines the number of the multiplexed stream to read. */
00075 LIBMPEG_EXPORT int mpeg3_read_audio(mpeg3_t *file, 
00076                 mpeg3_real_t *output_f,      /* Pointer to pre-allocated buffer of floats */
00077                 short *output_i,      /* Pointer to pre-allocated buffer of int16's */
00078                 int sampleSpacing, // how many bytes to skip over inbetween samples
00079                 int channel,          /* Channel to decode */
00080                 long samples,         /* Number of samples to decode */
00081                 int stream);          /* Stream containing the channel */
00082 
00083 /* Reread the last PCM buffer from a different channel and advance the position */
00084 LIBMPEG_EXPORT int mpeg3_reread_audio(mpeg3_t *file, 
00085                 mpeg3_real_t *output_f,      /* Pointer to pre-allocated buffer of floats */
00086                 short *output_i,      /* Pointer to pre-allocated buffer of int16's */
00087                 int sampleSpacing, // how many bytes to skip over inbetween samples
00088                 int channel,          /* Channel to decode */
00089                 long samples,         /* Number of samples to decode */
00090                 int stream);          /* Stream containing the channel */
00091 
00092 /* Read the next compressed audio chunk.  Store the size in size and return a  */
00093 /* 1 if error. */
00094 /* Stream defines the number of the multiplexed stream to read. */
00095 LIBMPEG_EXPORT int mpeg3_read_audio_chunk(mpeg3_t *file, 
00096                 unsigned char *output, 
00097                 long *size, 
00098                 long max_size,
00099                 int stream);
00100 
00101 /* Query the stream about video. */
00102 LIBMPEG_EXPORT int mpeg3_has_video(mpeg3_t *file);
00103 LIBMPEG_EXPORT int mpeg3_total_vstreams(mpeg3_t *file);            /* Number of multiplexed video streams */
00104 LIBMPEG_EXPORT int mpeg3_video_width(mpeg3_t *file, int stream);
00105 LIBMPEG_EXPORT int mpeg3_video_height(mpeg3_t *file, int stream);
00106 LIBMPEG_EXPORT float mpeg3_frame_rate(mpeg3_t *file, int stream);  /* Frames/sec */
00107 
00108 /* Total length.   */
00109 /* For DVD files, this is 1 indicating only percentage seeking is available. */
00110 LIBMPEG_EXPORT long mpeg3_video_frames(mpeg3_t *file, int stream);
00111 LIBMPEG_EXPORT int mpeg3_set_frame(mpeg3_t *file, long frame, int stream); /* Seek to a frame */
00112 LIBMPEG_EXPORT int mpeg3_skip_frames();
00113 LIBMPEG_EXPORT long mpeg3_get_frame(mpeg3_t *file, int stream);            /* Tell current position */
00114 
00115 /* Seek all the tracks based on a percentage of the total bytes in the  */
00116 /* file or the total */
00117 /* time in a toc if one exists.  Percentage is a 0 to 1 double. */
00118 /* This eliminates the need for tocs and 64 bit longs but doesn't  */
00119 /* give frame accuracy. */
00120 LIBMPEG_EXPORT int mpeg3_seek_percentage(mpeg3_t *file, double percentage);
00121 LIBMPEG_EXPORT double mpeg3_tell_percentage(mpeg3_t *file);
00122 LIBMPEG_EXPORT int mpeg3_previous_frame(mpeg3_t *file, int stream);
00123 LIBMPEG_EXPORT int mpeg3_end_of_audio(mpeg3_t *file, int stream);
00124 LIBMPEG_EXPORT int mpeg3_end_of_video(mpeg3_t *file, int stream);
00125 
00126 /* Give the seconds time in the last packet read */
00127 LIBMPEG_EXPORT double mpeg3_get_time(mpeg3_t *file);
00128 
00129 /* Read a frame.  The dimensions of the input area and output frame must be supplied. */
00130 /* The frame is taken from the input area and scaled to fit the output frame in 1 step. */
00131 /* Stream defines the number of the multiplexed stream to read. */
00132 /* The last row of **output_rows must contain 4 extra bytes for scratch work. */
00133 LIBMPEG_EXPORT int mpeg3_read_frame(mpeg3_t *file, 
00134                 unsigned char **output_rows, /* Array of pointers to the start of each output row */
00135                 int in_x,                    /* Location in input frame to take picture */
00136                 int in_y, 
00137                 int in_w, 
00138                 int in_h, 
00139                 int out_w,                   /* Dimensions of output_rows */
00140                 int out_h, 
00141                 int color_model,             /* One of the color model #defines */
00142                 int stream);
00143 
00144 /* Read a YUV frame.  The 3 planes are copied into the y, u, and v buffers provided. */
00145 /* The input is cropped to the dimensions given but not scaled. */
00146 LIBMPEG_EXPORT int mpeg3_read_yuvframe(mpeg3_t *file,
00147                 char *y_output,
00148                 char *u_output,
00149                 char *v_output,
00150                 int in_x,
00151                 int in_y,
00152                 int in_w,
00153                 int in_h,
00154                 int stream);
00155 
00156 LIBMPEG_EXPORT int mpeg3_drop_frames(mpeg3_t *file, long frames, int stream);
00157 
00158 /* Read the next compressed frame including headers. */
00159 /* Store the size in size and return a 1 if error. */
00160 /* Stream defines the number of the multiplexed stream to read. */
00161 LIBMPEG_EXPORT int mpeg3_read_video_chunk(mpeg3_t *file, 
00162                 unsigned char *output, 
00163                 long *size, 
00164                 long max_size,
00165                 int stream);
00166 
00167 /* Master control */
00168 LIBMPEG_EXPORT int mpeg3_total_programs();
00169 LIBMPEG_EXPORT int mpeg3_set_program(int program);
00170 
00171 #if defined(__cplusplus)
00172 }
00173 #endif
00174 
00175 #endif

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2