summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp
new file mode 100644
index 0000000..044cb4a
--- a/dev/null
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.cpp
@@ -0,0 +1,105 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "libmpeg3plugin.h"
21
22/*
23bool LibMpeg3Plugin::audioReadSamples( short *output, int channel, long samples, int stream ) {
24 return file ? mpeg3_read_audio( file, 0, output, 0, channel, samples, stream ) == 1 : FALSE;
25}
26
27
28bool LibMpeg3Plugin::audioReReadSamples( short *output, int channel, long samples, int stream ) {
29 return file ? mpeg3_reread_audio( file, 0, output, 0, channel, samples, stream ) == 1 : FALSE;
30}
31
32
33bool LibMpeg3Plugin::audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ) {
34 samplesRead = samples;
35 return file ? mpeg3_read_audio( file, 0, output, 0, 0, samples, stream ) == 1 : FALSE;
36}
37
38
39bool LibMpeg3Plugin::audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ) {
40 bool err = FALSE;
41 if ( file ) {
42#if 1
43 err = mpeg3_read_audio ( file, 0, output, 1, 0, samples, stream ) == 1;
44 if ( err == FALSE ) {
45 err = mpeg3_reread_audio( file, 0, output + 1, 1, 1, samples, stream ) == 1;
46#else
47 short left[samples];
48 short right[samples];
49 err = mpeg3_read_audio ( file, 0, left, 0, samples, stream ) == 1;
50 if ( !err )
51 err = mpeg3_reread_audio( file, 0, right, 1, samples, stream ) == 1;
52 for ( int j = 0; j < samples; j++ ) {
53 output[j*2+0] = left[j];
54 output[j*2+1] = right[j];
55#endif
56 }
57 }
58 samplesRead = samples;
59 return err;
60}
61*/
62
63bool LibMpeg3Plugin::audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ) {
64 samplesRead = samples;
65 switch ( channels ) {
66 case 1:
67 return file ? mpeg3_read_audio( file, 0, output, 0, 0, samples, stream ) == 1 : FALSE;
68 case 2:
69 if ( ( file ) && ( mpeg3_read_audio( file, 0, output, 1, 0, samples, stream ) != 1 ) &&
70 ( mpeg3_reread_audio( file, 0, output + 1, 1, 1, samples, stream ) != 1 ) )
71 return TRUE;
72 return FALSE;
73 }
74 return FALSE;
75}
76
77bool LibMpeg3Plugin::videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream ) {
78 int format = MPEG3_RGB565;
79 switch ( color_model ) {
80 case RGB565:format = MPEG3_RGB565; break;
81 case BGR565: /*format = MPEG3_BGR565;*/ break;
82 case RGBA8888:format = MPEG3_RGBA8888; break;
83 case BGRA8888:format = MPEG3_BGRA8888; break;
84 }
85 return file ? mpeg3_read_frame( file, output_rows, in_x, in_y, in_w, in_h, in_w, in_h, format, stream ) == 1 : FALSE;
86}
87
88
89bool LibMpeg3Plugin::videoReadScaledFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, ColorFormat color_model, int stream ) {
90 int format = MPEG3_RGB565;
91 switch ( color_model ) {
92 case RGB565:format = MPEG3_RGB565; break;
93 case BGR565:/*format = MPEG3_BGR565;*/ break;
94 case RGBA8888:format = MPEG3_RGBA8888; break;
95 case BGRA8888:format = MPEG3_BGRA8888; break;
96 }
97 return file ? mpeg3_read_frame( file, output_rows, in_x, in_y, in_w, in_h, out_w, out_h, format, stream ) == 1 : FALSE;
98}
99
100
101bool LibMpeg3Plugin::videoReadYUVFrame( char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream ) {
102 return file ? mpeg3_read_yuvframe( file, y_output, u_output, v_output, in_x, in_y, in_w, in_h, stream ) == 1 : FALSE;
103}
104
105