annotate loader/dshow/DS_VideoDecoder.c @ 3063:004e3199fee0

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