annotate loader/dshow/DS_VideoDecoder.c @ 6371:622d57683187

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