annotate loader/dshow/DS_VideoDecoder.c @ 33412:2a2e9b6551d8

configure: Convert HAVE_SYS_MMAN_H into a 0/1 definition. FFmpeg/Libav uses it as a 0/1 definition, so adapt MPlayer to do the same.
author diego
date Tue, 24 May 2011 19:51:38 +0000
parents 914208d188b9
children 389d43c448b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
1 /********************************************************
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
2
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
3 DirectShow Video decoder implementation
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
4 Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
5
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
6 *********************************************************/
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
7 #include "config.h"
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
8 #include "guids.h"
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
9 #include "interfaces.h"
30170
008338d7679f Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents: 29263
diff changeset
10 #include "loader/registry.h"
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
11 #include "libwin32.h"
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
12 #include "DS_Filter.h"
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
13
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 25681
diff changeset
14 struct DS_VideoDecoder
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
15 {
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
16 IVideoDecoder iv;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
17
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
18 DS_Filter* m_pDS_Filter;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
19 AM_MEDIA_TYPE m_sOurType, m_sDestType;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
20 VIDEOINFOHEADER* m_sVhdr;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
21 VIDEOINFOHEADER* m_sVhdr2;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
22 int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
23 int m_iLastQuality; // remember last quality as integer
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
24 int m_iMinBuffers;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
25 int m_iMaxAuto;
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
26 int m_bIsDivX; // for speed
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
27 int m_bIsDivX4; // for speed
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
28 };
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
29 static SampleProcUserData sampleProcData;
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
30
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
31 #include "DS_VideoDecoder.h"
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
32
30170
008338d7679f Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents: 29263
diff changeset
33 #include "loader/wine/winerror.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
34 #ifdef WIN32_LOADER
30170
008338d7679f Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents: 29263
diff changeset
35 #include "loader/ldt_keeper.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
36 #endif
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
37
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
38 #include <unistd.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
39 #include <fcntl.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
40 #include <errno.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
41 #include <sys/types.h>
33412
2a2e9b6551d8 configure: Convert HAVE_SYS_MMAN_H into a 0/1 definition.
diego
parents: 32394
diff changeset
42 #if HAVE_SYS_MMAN_H
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
43 #include <sys/mman.h>
9978
11cee15b1a8f last mingw32 support patch by Sascha Sommer
alex
parents: 9967
diff changeset
44 #endif
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
45 #include <stdio.h>
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
46 #include <stdlib.h> // labs
2072
4b3f3f850896 killed unneeded dependency on c++ headers
arpi
parents: 2069
diff changeset
47
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
48 // strcmp((const char*)info.dll,...) is used instead of (... == ...)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
49 // so Arpi could use char* pointer in his simplified DS_VideoDecoder class
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
50
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
51 #define false 0
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
52 #define true 1
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
53
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
54 int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
55 {return this->m_Caps;}
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
56
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 25681
diff changeset
57 typedef struct ct ct;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
58
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 25681
diff changeset
59 struct ct {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
60 unsigned int bits;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
61 fourcc_t fcc;
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 7472
diff changeset
62 const GUID *subtype;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
63 int cap;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
64 };
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
65
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
66 static ct check[] = {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
67 {16, fccYUY2, &MEDIASUBTYPE_YUY2, CAP_YUY2},
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
68 {12, fccIYUV, &MEDIASUBTYPE_IYUV, CAP_IYUV},
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
69 {16, fccUYVY, &MEDIASUBTYPE_UYVY, CAP_UYVY},
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
70 {12, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12},
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
71 //{16, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12},
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
72 {16, fccYVYU, &MEDIASUBTYPE_YVYU, CAP_YVYU},
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
73 {12, fccI420, &MEDIASUBTYPE_I420, CAP_I420},
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
74 {9, fccYVU9, &MEDIASUBTYPE_YVU9, CAP_YVU9},
9581
0ef45318414a a warning fix and rgb15/16 support by Sascha Sommer
alex
parents: 9503
diff changeset
75 {0, 0, 0, 0},
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
76 };
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
77
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
78
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
79 DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
80 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
81 DS_VideoDecoder *this;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
82 HRESULT result;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
83 ct* c;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
84
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
85 this = malloc(sizeof(DS_VideoDecoder));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
86 memset( this, 0, sizeof(DS_VideoDecoder));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
87
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
88 this->m_sVhdr2 = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
89 this->m_iLastQuality = -1;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
90 this->m_iMaxAuto = maxauto;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
91
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
92 #ifdef WIN32_LOADER
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
93 Setup_LDT_Keeper();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
94 #endif
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
95
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
96 //memset(&m_obh, 0, sizeof(m_obh));
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
97 //m_obh.biSize = sizeof(m_obh);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
98 /*try*/
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
99 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
100 unsigned int bihs;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
101
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
102 bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
103 sizeof(BITMAPINFOHEADER) : format->biSize;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
104
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 9978
diff changeset
105 this->iv.m_bh = malloc(bihs);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
106 memcpy(this->iv.m_bh, format, bihs);
22187
88b36fd17976 Precent overflow of this->m_sVhdr->bmiHeader buffer, may have been
rtogni
parents: 22001
diff changeset
107 this->iv.m_bh->biSize = bihs;
4205
c42ab0e5bbbc possible sig11 fixed - noticed by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents: 3978
diff changeset
108
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
109 this->iv.m_State = STOP;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
110 //this->iv.m_pFrame = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
111 this->iv.m_Mode = DIRECT;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
112 this->iv.m_iDecpos = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
113 this->iv.m_iPlaypos = -1;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
114 this->iv.m_fQuality = 0.0f;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
115 this->iv.m_bCapable16b = true;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
116
4205
c42ab0e5bbbc possible sig11 fixed - noticed by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents: 3978
diff changeset
117 bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 9978
diff changeset
118 this->m_sVhdr = malloc(bihs);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
119 memset(this->m_sVhdr, 0, bihs);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
120 memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
121 this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
122 this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
123 this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
124 //this->m_sVhdr->rcSource.right = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
125 //this->m_sVhdr->rcSource.bottom = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
126 this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
127
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
128 this->m_sOurType.majortype = MEDIATYPE_Video;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
129 this->m_sOurType.subtype = MEDIATYPE_Video;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
130 this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
131 this->m_sOurType.formattype = FORMAT_VideoInfo;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
132 this->m_sOurType.bFixedSizeSamples = false;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
133 this->m_sOurType.bTemporalCompression = true;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
134 this->m_sOurType.pUnk = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
135 this->m_sOurType.cbFormat = bihs;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
136 this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
137
25681
355f24f329d4 Get rid of another useless cast
reimar
parents: 24394
diff changeset
138 this->m_sVhdr2 = malloc(sizeof(VIDEOINFOHEADER)+12);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
139 memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
140 memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
141 this->m_sVhdr2->bmiHeader.biCompression = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
142 this->m_sVhdr2->bmiHeader.biBitCount = 24;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
143
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
144 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
145 this->m_sDestType.majortype = MEDIATYPE_Video;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
146 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
147 this->m_sDestType.formattype = FORMAT_VideoInfo;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
148 this->m_sDestType.bFixedSizeSamples = true;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
149 this->m_sDestType.bTemporalCompression = false;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
150 this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
151 * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
152 this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
153 this->m_sDestType.pUnk = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
154 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
155 this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
156
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
157 memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
158 memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
159 ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
160 this->iv.m_obh.biBitCount=24;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
161 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
162 this->iv.m_obh.biCompression = 0; //BI_RGB
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
163 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
164 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
165 * ((this->iv.m_obh.biBitCount + 7) / 8);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
166
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
167
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
168 this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
169
3456
ebab4801241f do not fault if Filter_Create failed
alex
parents: 3444
diff changeset
170 if (!this->m_pDS_Filter)
ebab4801241f do not fault if Filter_Create failed
alex
parents: 3444
diff changeset
171 {
ebab4801241f do not fault if Filter_Create failed
alex
parents: 3444
diff changeset
172 printf("Failed to create DirectShow filter\n");
ebab4801241f do not fault if Filter_Create failed
alex
parents: 3444
diff changeset
173 return 0;
ebab4801241f do not fault if Filter_Create failed
alex
parents: 3444
diff changeset
174 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
175
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
176 if (!flip)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
177 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
178 this->iv.m_obh.biHeight *= -1;
3466
b6caac381405 avifile merge
arpi
parents: 3456
diff changeset
179 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
180 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
181 if (result)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
182 {
3466
b6caac381405 avifile merge
arpi
parents: 3456
diff changeset
183 printf("Decoder does not support upside-down RGB frames\n");
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
184 this->iv.m_obh.biHeight *= -1;
3466
b6caac381405 avifile merge
arpi
parents: 3456
diff changeset
185 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
186 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
187 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
188
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
189 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) );
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
190
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
191 switch (this->iv.m_bh->biCompression)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
192 {
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
193 #if 0
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
194 case fccDIV3:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
195 case fccDIV4:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
196 case fccDIV5:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
197 case fccDIV6:
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
198 case fccMP42:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
199 case fccWMV2:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
200 //YV12 seems to be broken for DivX :-) codec
3060
33989b5b8d02 xine's bugs fixed - YV50 yv12 and setup_fs
arpi
parents: 3059
diff changeset
201 // case fccIV50:
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
202 //produces incorrect picture
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
203 //m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
204 //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
205 //m_Caps = CAP_I420;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
206 this->m_Caps = (CAP_YUY2 | CAP_UYVY);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
207 break;
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
208 #endif
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
209 default:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
210
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
211 this->m_Caps = CAP_NONE;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
212
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
213 printf("Decoder supports the following YUV formats: ");
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
214 for (c = check; c->bits; c++)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
215 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
216 this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
217 this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
218 this->m_sDestType.subtype = *c->subtype;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
219 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
220 if (!result)
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
221 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
222 this->m_Caps = (this->m_Caps | c->cap);
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 7472
diff changeset
223 printf("%.4s ", (char *)&c->fcc);
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
224 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
225 }
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
226 printf("\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
227 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
228
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
229 if (this->m_Caps != CAP_NONE)
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
230 printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
231
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
232 this->m_sVhdr2->bmiHeader.biBitCount = 24;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
233 this->m_sVhdr2->bmiHeader.biCompression = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
234 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
235
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
236 this->m_iMinBuffers = this->iv.VBUFSIZE;
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
237 this->m_bIsDivX = (strcmp(dllname, "divxcvki.ax") == 0
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
238 || strcmp(dllname, "divx_c32.ax") == 0
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
239 || strcmp(dllname, "wmvds32.ax") == 0
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
240 || strcmp(dllname, "wmv8ds32.ax") == 0);
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
241 this->m_bIsDivX4 = (strcmp(dllname, "divxdec.ax") == 0);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
242 if (this->m_bIsDivX)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
243 this->iv.VBUFSIZE += 7;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
244 else if (this->m_bIsDivX4)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
245 this->iv.VBUFSIZE += 9;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
246 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
247 /*catch (FatalError& error)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
248 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
249 delete[] m_sVhdr;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
250 delete[] m_sVhdr2;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
251 delete m_pDS_Filter;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
252 throw;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
253 }*/
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
254 return this;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
255 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
256
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
257 void DS_VideoDecoder_Destroy(DS_VideoDecoder *this)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
258 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
259 DS_VideoDecoder_StopInternal(this);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
260 this->iv.m_State = STOP;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
261 free(this->m_sVhdr);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
262 free(this->m_sVhdr2);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
263 DS_Filter_Destroy(this->m_pDS_Filter);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
264 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
265
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
266 void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
267 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
268 Debug printf("DS_VideoDecoder_StartInternal\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
269 //cout << "DSSTART" << endl;
22304
254733f57707 Fixed loading of VoxWare and wma9sp binary audio codecs using dshow engine.
voroshil
parents: 22187
diff changeset
270 this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll);
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
271 this->m_pDS_Filter->Start(this->m_pDS_Filter);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
272
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
273 this->iv.m_State = START;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
274 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
275
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
276 void DS_VideoDecoder_StopInternal(DS_VideoDecoder *this)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
277 {
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
278 this->m_pDS_Filter->Stop(this->m_pDS_Filter);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
279 //??? why was this here ??? m_pOurOutput->SetFramePointer(0);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
280 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
281
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
282 int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
283 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
284 IMediaSample* sample = 0;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
285 char* ptr;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
286 int result;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
287
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
288 Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
289
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
290 this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
291
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
292 if (!sample)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
293 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
294 Debug printf("ERROR: null sample\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
295 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
296 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
297
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
298 //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
299
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
300
3466
b6caac381405 avifile merge
arpi
parents: 3456
diff changeset
301 sample->vt->SetActualDataLength(sample, size);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
302 sample->vt->GetPointer(sample, (BYTE **)&ptr);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
303 memcpy(ptr, src, size);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
304 sample->vt->SetSyncPoint(sample, is_keyframe);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
305 sample->vt->SetPreroll(sample, pImage ? 0 : 1);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
306 // sample->vt->SetMediaType(sample, &m_sOurType);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
307
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
308 // FIXME: - crashing with YV12 at this place decoder will crash
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
309 // while doing this call
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
310 // %FS register was not setup for calling into win32 dll. Are all
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
311 // crashes inside ...->Receive() fixed now?
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
312 //
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
313 // nope - but this is surely helpfull - I'll try some more experiments
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
314 #ifdef WIN32_LOADER
3060
33989b5b8d02 xine's bugs fixed - YV50 yv12 and setup_fs
arpi
parents: 3059
diff changeset
315 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9581
diff changeset
316 #endif
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
317 #if 0
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
318 if (!this->m_pDS_Filter || !this->m_pDS_Filter->m_pImp
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
319 || !this->m_pDS_Filter->m_pImp->vt
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
320 || !this->m_pDS_Filter->m_pImp->vt->Receive)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
321 printf("DecodeInternal ERROR???\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
322 #endif
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
323 result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
324 if (result)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
325 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
326 Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
327 }
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
328 if (pImage)
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
329 {
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
330 memcpy(pImage, sampleProcData.frame_pointer, sampleProcData.frame_size);
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22307
diff changeset
331 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
332 sample->vt->Release((IUnknown*)sample);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
333
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
334 #if 0
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
335 if (this->m_bIsDivX)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
336 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
337 int q;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
338 IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
339 // always check for actual value
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
340 // this seems to be the only way to know the actual value
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
341 hidden->vt->GetSmth2(hidden, &this->m_iLastQuality);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
342 if (this->m_iLastQuality > 9)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
343 this->m_iLastQuality -= 10;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
344
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
345 if (this->m_iLastQuality < 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
346 this->m_iLastQuality = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
347 else if (this->m_iLastQuality > this->m_iMaxAuto)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
348 this->m_iLastQuality = this->m_iMaxAuto;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
349
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
350 //cout << " Qual: " << this->m_iLastQuality << endl;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
351 this->iv.m_fQuality = this->m_iLastQuality / 4.0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
352 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
353 else if (this->m_bIsDivX4)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
354 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
355
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
356 // maybe access methods directly to safe some cpu cycles...
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
357 DS_VideoDecoder_GetValue(this, "Postprocessing", this->m_iLastQuality);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
358 if (this->m_iLastQuality < 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
359 this->m_iLastQuality = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
360 else if (this->m_iLastQuality > this->m_iMaxAuto)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
361 this->m_iLastQuality = this->m_iMaxAuto;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
362
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
363 //cout << " Qual: " << m_iLastQuality << endl;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
364 this->iv.m_fQuality = this->m_iLastQuality / 6.0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
365 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
366
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
367 if (this->iv.m_Mode == -1 ) // ???BUFFERED_QUALITY_AUTO)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
368 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
369 // adjust Quality - depends on how many cached frames we have
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
370 int buffered = this->iv.m_iDecpos - this->iv.m_iPlaypos;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
371
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
372 if (this->m_bIsDivX || this->m_bIsDivX4)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
373 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
374 int to = buffered - this->m_iMinBuffers;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
375 if (to < 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
376 to = 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
377 if (to != this->m_iLastQuality)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
378 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
379 if (to > this->m_iMaxAuto)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
380 to = this->m_iMaxAuto;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
381 if (this->m_iLastQuality != to)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
382 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
383 if (this->m_bIsDivX)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
384 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
385 IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
386 hidden->vt->SetSmth(hidden, to, 0);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
387 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
388 else
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
389 DS_VideoDecoder_SetValue(this, "Postprocessing", to);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
390 #ifndef QUIET
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
391 //printf("Switching quality %d -> %d b:%d\n",m_iLastQuality, to, buffered);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
392 #endif
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
393 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
394 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
395 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
396 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
397 #endif
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
398
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
399 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
400 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
401
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
402 /*
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
403 * bits == 0 - leave unchanged
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
404 */
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
405 //int SetDestFmt(DS_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
406 int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
407 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
408 HRESULT result;
22307
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
409 ALLOCATOR_PROPERTIES props,props1;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
410 int should_test=1;
24394
efc631c41550 cosmetics: Fix silly typo.
diego
parents: 24390
diff changeset
411 int stopped = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
412
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
413 Debug printf("DS_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
414
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
415 /* if (!CImage::Supported(csp, bits))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
416 return -1;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
417 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
418 // BitmapInfo temp = m_obh;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
419
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
420 if (!csp) // RGB
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
421 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
422 int ok = true;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
423
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
424 switch (bits)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
425 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
426 case 15:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
427 this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
428 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
429 case 16:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
430 this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
431 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
432 case 24:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
433 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
434 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
435 case 32:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
436 this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
437 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
438 default:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
439 ok = false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
440 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
441 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
442
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
443 if (ok) {
9581
0ef45318414a a warning fix and rgb15/16 support by Sascha Sommer
alex
parents: 9503
diff changeset
444 if (bits == 15)
0ef45318414a a warning fix and rgb15/16 support by Sascha Sommer
alex
parents: 9503
diff changeset
445 this->iv.m_obh.biBitCount=16;
0ef45318414a a warning fix and rgb15/16 support by Sascha Sommer
alex
parents: 9503
diff changeset
446 else
0ef45318414a a warning fix and rgb15/16 support by Sascha Sommer
alex
parents: 9503
diff changeset
447 this->iv.m_obh.biBitCount=bits;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
448 if( bits == 15 || bits == 16 ) {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
449 this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
450 this->iv.m_obh.biCompression=3;//BI_BITFIELDS
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
451 this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
452 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
453
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
454 if( bits == 16 ) {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
455 this->iv.m_obh.colors[0]=0xF800;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
456 this->iv.m_obh.colors[1]=0x07E0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
457 this->iv.m_obh.colors[2]=0x001F;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
458 } else if ( bits == 15 ) {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
459 this->iv.m_obh.colors[0]=0x7C00;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
460 this->iv.m_obh.colors[1]=0x03E0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
461 this->iv.m_obh.colors[2]=0x001F;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
462 } else {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
463 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
464 this->iv.m_obh.biCompression = 0; //BI_RGB
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
465 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
466 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
467 * ((this->iv.m_obh.biBitCount + 7) / 8);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
468 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
469 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
470 //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
471 } else
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
472 { // YUV
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
473 int ok = true;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
474 switch (csp)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
475 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
476 case fccYUY2:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
477 this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
478 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
479 case fccYV12:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
480 this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
481 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
482 case fccIYUV:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
483 this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
484 break;
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
485 case fccI420:
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
486 this->m_sDestType.subtype = MEDIASUBTYPE_I420;
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
487 break;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
488 case fccUYVY:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
489 this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
490 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
491 case fccYVYU:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
492 this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
493 break;
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
494 case fccYVU9:
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
495 this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
496 default:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
497 ok = false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
498 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
499 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
500
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
501 if (ok) {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
502 if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
503 this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
504 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
505 this->iv.m_obh.biCompression=csp;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
506 this->iv.m_obh.biBitCount=bits;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
507 this->iv.m_obh.biSizeImage=labs(this->iv.m_obh.biBitCount*
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
508 this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)>>3;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
509 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
510 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
511 this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
512 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
513 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
514 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
515 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
516 else
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
517 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
518
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
519
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
520 switch(csp)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
521 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
522 case fccYUY2:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
523 if(!(this->m_Caps & CAP_YUY2))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
524 should_test=false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
525 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
526 case fccYV12:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
527 if(!(this->m_Caps & CAP_YV12))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
528 should_test=false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
529 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
530 case fccIYUV:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
531 if(!(this->m_Caps & CAP_IYUV))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
532 should_test=false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
533 break;
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
534 case fccI420:
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
535 if(!(this->m_Caps & CAP_I420))
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
536 should_test=false;
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
537 break;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
538 case fccUYVY:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
539 if(!(this->m_Caps & CAP_UYVY))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
540 should_test=false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
541 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
542 case fccYVYU:
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
543 if(!(this->m_Caps & CAP_YVYU))
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
544 should_test=false;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
545 break;
6527
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
546 case fccYVU9:
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
547 if(!(this->m_Caps & CAP_YVU9))
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
548 should_test=false;
1baa35e06053 yvu9 and if09 support. fixed i420,iyuv handling
alex
parents: 4205
diff changeset
549 break;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
550 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
551 if(should_test)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
552 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
553 else
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
554 result = -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
555
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
556 if (result != 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
557 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
558 if (csp)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
559 printf("Warning: unsupported color space\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
560 else
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
561 printf("Warning: unsupported bit depth\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
562
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
563 this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
564 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder));
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
565 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
566 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
567 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
568 else
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
569 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
570
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
571 return -1;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
572 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
573
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
574 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh));
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
575
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
576 // m_obh=temp;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
577 // if(csp)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
578 // m_obh.biBitCount=BitmapInfo::BitCount(csp);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
579 this->iv.m_bh->biBitCount = bits;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
580
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
581 //DS_VideoDecoder_Restart(this);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
582
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
583 if (this->iv.m_State == START)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
584 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
585 DS_VideoDecoder_StopInternal(this);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
586 this->iv.m_State = STOP;
24394
efc631c41550 cosmetics: Fix silly typo.
diego
parents: 24390
diff changeset
587 stopped = true;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
588 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
589
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
590 this->m_pDS_Filter->m_pInputPin->vt->Disconnect(this->m_pDS_Filter->m_pInputPin);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
591 this->m_pDS_Filter->m_pOutputPin->vt->Disconnect(this->m_pDS_Filter->m_pOutputPin);
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
592 this->m_pDS_Filter->m_pOurOutput->SetNewFormat(this->m_pDS_Filter->m_pOurOutput,&this->m_sDestType);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
593 result = this->m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pInputPin,
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
594 this->m_pDS_Filter->m_pOurInput,
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
595 &this->m_sOurType);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
596 if (result)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
597 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
598 printf("Error reconnecting input pin 0x%x\n", (int)result);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
599 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
600 }
22307
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
601
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
602 if(this->m_pDS_Filter->m_pAll)
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
603 this->m_pDS_Filter->m_pAll->vt->Release(this->m_pDS_Filter->m_pAll);
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
604 this->m_pDS_Filter->m_pAll=MemAllocatorCreate();
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
605 if (!this->m_pDS_Filter->m_pAll)
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
606 {
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
607 printf("Call to MemAllocatorCreate failed\n");
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
608 return -1;
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
609 }
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
610 //Seting allocator property according to our media type
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
611 props.cBuffers=1;
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
612 props.cbBuffer=this->m_sDestType.lSampleSize;
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
613 props.cbAlign=1;
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
614 props.cbPrefix=0;
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
615 this->m_pDS_Filter->m_pAll->vt->SetProperties(this->m_pDS_Filter->m_pAll, &props, &props1);
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
616 //Notify remote pin about choosed allocator
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
617 this->m_pDS_Filter->m_pImp->vt->NotifyAllocator(this->m_pDS_Filter->m_pImp, this->m_pDS_Filter->m_pAll, 0);
68125c62b6eb Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents: 22304
diff changeset
618
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
619 result = this->m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pOutputPin,
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
620 (IPin *)this->m_pDS_Filter->m_pOurOutput,
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
621 &this->m_sDestType);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
622 if (result)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
623 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
624 printf("Error reconnecting output pin 0x%x\n", (int)result);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
625 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
626 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
627
24394
efc631c41550 cosmetics: Fix silly typo.
diego
parents: 24390
diff changeset
628 if (stopped)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
629 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
630 DS_VideoDecoder_StartInternal(this);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
631 this->iv.m_State = START;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
632 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
633
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
634 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
635 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
636
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
637
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
638 int DS_VideoDecoder_SetDirection(DS_VideoDecoder *this, int d)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
639 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
640 this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
641 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
642 return 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
643 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
644
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
645 int DS_VideoDecoder_GetValue(DS_VideoDecoder *this, const char* name, int* value)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
646 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
647 /*
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
648 if (m_bIsDivX4)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
649 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
650 IDivxFilterInterface* pIDivx;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
651 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
652 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
653 Debug printf("No such interface\n");
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
654 return -1;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
655 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
656 if (strcmp(name, "Postprocessing") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
657 {
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
658 pIDivx->vt->get_PPLevel(pIDivx, &value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
659 value /= 10;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
660 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
661 else if (strcmp(name, "Brightness") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
662 pIDivx->vt->get_Brightness(pIDivx, &value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
663 else if (strcmp(name, "Contrast") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
664 pIDivx->vt->get_Contrast(pIDivx, &value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
665 else if (strcmp(name, "Saturation") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
666 pIDivx->vt->get_Saturation(pIDivx, &value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
667 else if (strcmp(name, "MaxAuto") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
668 value = m_iMaxAuto;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
669 pIDivx->vt->Release((IUnknown*)pIDivx);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
670 return 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
671 }
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
672 else if (m_bIsDivX)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
673 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
674 if (m_State != START)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
675 return VFW_E_NOT_RUNNING;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
676 // brightness 87
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
677 // contrast 74
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
678 // hue 23
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
679 // saturation 20
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
680 // post process mode 0
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
681 // get1 0x01
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
682 // get2 10
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
683 // get3=set2 86
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
684 // get4=set3 73
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
685 // get5=set4 19
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
686 // get6=set5 23
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
687 IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter+0xb8);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
688 if (strcmp(name, "Quality") == 0)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
689 {
32394
914208d188b9 Remove #warning preprocessor directives or replace them by suitable comments.
diego
parents: 32139
diff changeset
690 // NOT SURE
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
691 int r = hidden->vt->GetSmth2(hidden, &value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
692 if (value >= 10)
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
693 value -= 10;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
694 return 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
695 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
696 if (strcmp(name, "Brightness") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
697 return hidden->vt->GetSmth3(hidden, &value);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
698 if (strcmp(name, "Contrast") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
699 return hidden->vt->GetSmth4(hidden, &value);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
700 if (strcmp(name, "Hue") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
701 return hidden->vt->GetSmth6(hidden, &value);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
702 if (strcmp(name, "Saturation") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
703 return hidden->vt->GetSmth5(hidden, &value);
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
704 if (strcmp(name, "MaxAuto") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
705 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
706 value = m_iMaxAuto;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
707 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
708 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
709 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
710 else if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
711 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
712 IHidden2* hidden = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
713 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
714 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
715 Debug printf("No such interface\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
716 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
717 }
32394
914208d188b9 Remove #warning preprocessor directives or replace them by suitable comments.
diego
parents: 32139
diff changeset
718 // FIXME
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
719 int recordpar[30];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
720 recordpar[0]=0x7c;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
721 recordpar[1]=fccIV50;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
722 recordpar[2]=0x10005;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
723 recordpar[3]=2;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
724 recordpar[4]=1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
725 recordpar[5]=0x80000000;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
726
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
727 if (strcmp(name, "Brightness") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
728 recordpar[5]|=0x20;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
729 else if (strcmp(name, "Saturation") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
730 recordpar[5]|=0x40;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
731 else if (strcmp(name, "Contrast") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
732 recordpar[5]|=0x80;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
733 if (!recordpar[5])
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
734 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
735 hidden->vt->Release((IUnknown*)hidden);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
736 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
737 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
738 if (hidden->vt->DecodeSet(hidden, recordpar))
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
739 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
740
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
741 if (strcmp(name, "Brightness") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
742 value = recordpar[18];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
743 else if (strcmp(name, "Saturation") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
744 value = recordpar[19];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
745 else if (strcmp(name, "Contrast") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
746 value = recordpar[20];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
747
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
748 hidden->vt->Release((IUnknown*)hidden);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
749 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
750 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
751 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
752 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
753
3946
c00db356082f headers cleanup
arpi
parents: 3466
diff changeset
754 int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
755 {
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
756 if (this->m_bIsDivX4) {
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
757 IDivxFilterInterface* pIDivx=NULL;
3978
2ba1d0ca9dce debug--
arpi
parents: 3957
diff changeset
758 // printf("DS_SetValue for DIVX4, name=%s value=%d\n",name,value);
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
759 if (this->m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)this->m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
760 {
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
761 printf("No such interface\n");
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
762 return -1;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
763 }
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
764 if (strcasecmp(name, "Postprocessing") == 0)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
765 pIDivx->vt->put_PPLevel(pIDivx, value * 10);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
766 else if (strcasecmp(name, "Brightness") == 0)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
767 pIDivx->vt->put_Brightness(pIDivx, value);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
768 else if (strcasecmp(name, "Contrast") == 0)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
769 pIDivx->vt->put_Contrast(pIDivx, value);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
770 else if (strcasecmp(name, "Saturation") == 0)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
771 pIDivx->vt->put_Saturation(pIDivx, value);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
772 else if (strcasecmp(name, "MaxAuto") == 0)
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
773 this->m_iMaxAuto = value;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
774 pIDivx->vt->Release((IUnknown*)pIDivx);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
775 //printf("Set %s %d\n", name, value);
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
776 return 0;
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
777 }
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
778
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
779 if (this->m_bIsDivX) {
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
780 IHidden* hidden;
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
781 if (this->iv.m_State != START)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
782 return VFW_E_NOT_RUNNING;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
783
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
784 //cout << "set value " << name << " " << value << endl;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
785 // brightness 87
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
786 // contrast 74
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
787 // hue 23
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
788 // saturation 20
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
789 // post process mode 0
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
790 // get1 0x01
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
791 // get2 10
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
792 // get3=set2 86
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
793 // get4=set3 73
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
794 // get5=set4 19
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
795 // get6=set5 23
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
796 hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
7316
e09428ee353f disable annonying debug printf (autoq)
atmos4
parents: 6801
diff changeset
797 //printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
798 if (strcasecmp(name, "Quality") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
799 {
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
800 this->m_iLastQuality = value;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
801 return hidden->vt->SetSmth(hidden, value, 0);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
802 }
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
803 if (strcasecmp(name, "Brightness") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
804 return hidden->vt->SetSmth2(hidden, value, 0);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
805 if (strcasecmp(name, "Contrast") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
806 return hidden->vt->SetSmth3(hidden, value, 0);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
807 if (strcasecmp(name, "Saturation") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
808 return hidden->vt->SetSmth4(hidden, value, 0);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
809 if (strcasecmp(name, "Hue") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
810 return hidden->vt->SetSmth5(hidden, value, 0);
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
811 if (strcasecmp(name, "MaxAuto") == 0)
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
812 {
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
813 this->m_iMaxAuto = value;
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
814 }
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
815 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
816 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
817 #if 0
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
818 if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
819 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
820 IHidden2* hidden = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
821 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
822 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2875
diff changeset
823 Debug printf("No such interface\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
824 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
825 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
826 int recordpar[30];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
827 recordpar[0]=0x7c;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
828 recordpar[1]=fccIV50;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
829 recordpar[2]=0x10005;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
830 recordpar[3]=2;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
831 recordpar[4]=1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
832 recordpar[5]=0x80000000;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
833 if (strcmp(name, "Brightness") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
834 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
835 recordpar[5]|=0x20;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
836 recordpar[18]=value;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
837 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
838 else if (strcmp(name, "Saturation") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
839 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
840 recordpar[5]|=0x40;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
841 recordpar[19]=value;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
842 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
843 else if (strcmp(name, "Contrast") == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
844 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
845 recordpar[5]|=0x80;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
846 recordpar[20]=value;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
847 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
848 if(!recordpar[5])
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
849 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
850 hidden->vt->Release((IUnknown*)hidden);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
851 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
852 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
853 HRESULT result = hidden->vt->DecodeSet(hidden, recordpar);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
854 hidden->vt->Release((IUnknown*)hidden);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
855
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
856 return result;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
857 }
3957
49290522ab06 SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents: 3946
diff changeset
858 #endif
3978
2ba1d0ca9dce debug--
arpi
parents: 3957
diff changeset
859 // printf("DS_SetValue for ????, name=%s value=%d\n",name,value);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
860 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
861 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
862
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
863 int DS_SetAttr_DivX(char* attribute, int value){
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7316
diff changeset
864 int result, status, newkey;
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
865 if(strcasecmp(attribute, "Quality")==0){
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
866 char* keyname="SOFTWARE\\Microsoft\\Scrunch";
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
867 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
868 if(result!=0)
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
869 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
870 printf("VideoDecoder::SetExtAttr: registry failure\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
871 return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
872 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
873 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
874 if(result!=0)
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
875 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
876 printf("VideoDecoder::SetExtAttr: error writing value\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
877 return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
878 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
879 value=-1;
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
880 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
881 if(result!=0)
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
882 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
883 printf("VideoDecoder::SetExtAttr: error writing value\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
884 return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
885 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
886 RegCloseKey(newkey);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
887 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
888 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
889
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
890 if(
6801
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
891 (strcasecmp(attribute, "Saturation")==0) ||
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
892 (strcasecmp(attribute, "Hue")==0) ||
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
893 (strcasecmp(attribute, "Contrast")==0) ||
7847b993acf3 SetValue: ignore case of 'item'
arpi
parents: 6527
diff changeset
894 (strcasecmp(attribute, "Brightness")==0)
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
895 )
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
896 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
897 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video";
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
898 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
899 if(result!=0)
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
900 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
901 printf("VideoDecoder::SetExtAttr: registry failure\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
902 return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
903 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
904 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
905 if(result!=0)
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
906 {
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
907 printf("VideoDecoder::SetExtAttr: error writing value\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
908 return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
909 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
910 RegCloseKey(newkey);
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
911 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26544
diff changeset
912 }
3063
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
913
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
914 printf("Unknown attribute!\n");
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
915 return -200;
004e3199fee0 mplayer integration
arpi
parents: 3060
diff changeset
916 }