annotate loader/dmo/DMO_VideoDecoder.c @ 22002:ebd2d5efb11b

filename double-conversion, especially usefull for CJK users :-) Patch by Zuxy Meng <zuxy.meng@gmail.com> date: Oct 25, 2006 2:20 AM subject: [MPlayer-dev-eng] [PATCH] Filename double-conversion
author gpoirier
date Fri, 26 Jan 2007 09:57:09 +0000
parents 2934974c366a
children c6edb6c59a7a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
1 /********************************************************
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
2
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
3 DirectShow Video decoder implementation
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
4 Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
5
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
6 *********************************************************/
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
7 #include "config.h"
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
8 #include "guids.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
9 #include "interfaces.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
10 #include "registry.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
11 #ifdef WIN32_LOADER
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8294
diff changeset
12 #include "../ldt_keeper.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
13 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
14
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
15 #ifndef NOAVIFILE_HEADERS
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
16 #include "videodecoder.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
17 #else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
18 #include "libwin32.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
19 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
20 #include "DMO_Filter.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
21
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
22 #include "DMO_VideoDecoder.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
23
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
24 struct _DMO_VideoDecoder
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
25 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
26 IVideoDecoder iv;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
27
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
28 DMO_Filter* m_pDMO_Filter;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
29 AM_MEDIA_TYPE m_sOurType, m_sDestType;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
30 VIDEOINFOHEADER* m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
31 VIDEOINFOHEADER* m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
32 int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
33 int m_iLastQuality; // remember last quality as integer
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
34 int m_iMinBuffers;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
35 int m_iMaxAuto;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
36 };
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
37
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
38 //#include "DMO_VideoDecoder.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
39
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
40 #include "../wine/winerror.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
41
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
42 #ifndef NOAVIFILE_HEADERS
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
43 #define VFW_E_NOT_RUNNING 0x80040226
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
44 #include "fourcc.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
45 #include "except.h"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
46 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
47
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
48 #include <unistd.h>
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
49 #include <fcntl.h>
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
50 #include <errno.h>
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
51 #include <sys/types.h>
9978
11cee15b1a8f last mingw32 support patch by Sascha Sommer
alex
parents: 9967
diff changeset
52 #ifndef __MINGW32__
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
53 #include <sys/mman.h>
9978
11cee15b1a8f last mingw32 support patch by Sascha Sommer
alex
parents: 9967
diff changeset
54 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
55 #include <stdio.h>
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
56 #include <stdlib.h> // labs
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
57
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
58 // strcmp((const char*)info.dll,...) is used instead of (... == ...)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
59 // so Arpi could use char* pointer in his simplified DMO_VideoDecoder class
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
60
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
61 #define false 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
62 #define true 1
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
63
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
64
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
65 //int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this){return this->m_Caps;}
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
66
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
67 typedef struct _ct ct;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
68
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
69 struct _ct {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
70 fourcc_t fcc;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
71 unsigned int bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
72 const GUID* subtype;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
73 int cap;
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
74 char *name;
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
75 };
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
76
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
77 static ct check[] = {
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
78 { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
79 { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
80 { fccYUY2, 16, &MEDIASUBTYPE_YUY2, CAP_YUY2, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
81 { fccUYVY, 16, &MEDIASUBTYPE_UYVY, CAP_UYVY, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
82 { fccYVYU, 16, &MEDIASUBTYPE_YVYU, CAP_YVYU, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
83 { fccIYUV, 24, &MEDIASUBTYPE_IYUV, CAP_IYUV, NULL },
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
84
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
85 { 8, 8, &MEDIASUBTYPE_RGB8, CAP_NONE, "RGB8" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
86 { 15, 16, &MEDIASUBTYPE_RGB555, CAP_NONE, "RGB555" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
87 { 16, 16, &MEDIASUBTYPE_RGB565, CAP_NONE, "RGB565" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
88 { 24, 24, &MEDIASUBTYPE_RGB24, CAP_NONE, "RGB24" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
89 { 32, 32, &MEDIASUBTYPE_RGB32, CAP_NONE, "RGB32" },
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
90
9963
alex
parents: 9503
diff changeset
91 {0,0,NULL,0},
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
92 };
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
93
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
94 DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
95 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
96 DMO_VideoDecoder *this;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
97 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
98 ct* c;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
99
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
100 this = malloc(sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
101 memset( this, 0, sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
102
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
103 this->m_sVhdr2 = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
104 this->m_iLastQuality = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
105 this->m_iMaxAuto = maxauto;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
106
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
107 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
108 Setup_LDT_Keeper();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
109 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
110
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
111 //memset(&m_obh, 0, sizeof(m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
112 //m_obh.biSize = sizeof(m_obh);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
113 /*try*/
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
114 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
115 unsigned int bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
116
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
117 bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
118 sizeof(BITMAPINFOHEADER) : format->biSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
119
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 15919
diff changeset
120 this->iv.m_bh = malloc(bihs);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
121 memcpy(this->iv.m_bh, format, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
122
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
123 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
124 //this->iv.m_pFrame = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
125 this->iv.m_Mode = DIRECT;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
126 this->iv.m_iDecpos = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
127 this->iv.m_iPlaypos = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
128 this->iv.m_fQuality = 0.0f;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
129 this->iv.m_bCapable16b = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
130
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
131 bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 15919
diff changeset
132 this->m_sVhdr = malloc(bihs);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
133 memset(this->m_sVhdr, 0, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
134 memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
135 this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
136 this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
137 this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
138 //this->m_sVhdr->rcSource.right = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
139 //this->m_sVhdr->rcSource.bottom = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
140 this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
141
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
142 this->m_sOurType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
143 this->m_sOurType.subtype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
144 this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
145 this->m_sOurType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
146 this->m_sOurType.bFixedSizeSamples = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
147 this->m_sOurType.bTemporalCompression = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
148 this->m_sOurType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
149 this->m_sOurType.cbFormat = bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
150 this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
151
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
152 this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
153 memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
154 memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
155 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
156 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
157
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
158 // memset((char*)this->m_sVhdr2, 0, sizeof(VIDEOINFOHEADER)+12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
159 this->m_sVhdr2->rcTarget = this->m_sVhdr->rcTarget;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
160 // this->m_sVhdr2->rcSource = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
161
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
162 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
163 this->m_sDestType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
164 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
165 this->m_sDestType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
166 this->m_sDestType.bFixedSizeSamples = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
167 this->m_sDestType.bTemporalCompression = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
168 this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
169 * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
170 this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
171 this->m_sDestType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
172 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
173 this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
174
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
175 memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
176 memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
177 ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
178 this->iv.m_obh.biBitCount=24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
179 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
180 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
181 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
182 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
183 * ((this->iv.m_obh.biBitCount + 7) / 8);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
184
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
185
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
186 this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
187
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
188 if (!this->m_pDMO_Filter)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
189 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
190 printf("Failed to create DMO filter\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
191 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
192 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
193
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
194 if (!flip)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
195 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
196 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
197 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
198 // result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
199 result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
200 if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
201 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
202 printf("Decoder does not support upside-down RGB frames\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
203 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
204 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
205 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
206 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
207
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
208 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) );
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
209
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
210 switch (this->iv.m_bh->biCompression)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
211 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
212 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
213 case fccDIV3:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
214 case fccDIV4:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
215 case fccDIV5:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
216 case fccDIV6:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
217 case fccMP42:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
218 case fccWMV2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
219 //YV12 seems to be broken for DivX :-) codec
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
220 // case fccIV50:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
221 //produces incorrect picture
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
222 //m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
223 //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
224 //m_Caps = CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
225 this->m_Caps = (CAP_YUY2 | CAP_UYVY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
226 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
227 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
228 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
229
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
230 this->m_Caps = CAP_NONE;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
231
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
232 printf("Decoder supports the following formats: ");
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
233 for (c = check; c->bits; c++)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
234 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
235 this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
236 this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
237 this->m_sDestType.subtype = *c->subtype;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
238 //result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
239 result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
240 if (!result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
241 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
242 this->m_Caps = (this->m_Caps | c->cap);
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
243 if (c->name)
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
244 printf("%s ", c->name);
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
245 else
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
246 printf("%.4s ", (char*) &c->fcc);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
247 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
248 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
249 printf("\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
250 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
251
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
252 if (this->m_Caps != CAP_NONE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
253 printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
254
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
255 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
256 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
257 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
258
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
259 this->m_iMinBuffers = this->iv.VBUFSIZE;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
260 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
261 /*catch (FatalError& error)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
262 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
263 delete[] m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
264 delete[] m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
265 delete m_pDMO_Filter;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
266 throw;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
267 }*/
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
268 return this;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
269 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
270
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
271 void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
272 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
273 DMO_VideoDecoder_StopInternal(this);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
274 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
275 free(this->m_sVhdr);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
276 free(this->m_sVhdr2);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
277 DMO_Filter_Destroy(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
278 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
279
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
280 void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
281 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
282 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
283 ALLOCATOR_PROPERTIES props, props1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
284 Debug printf("DMO_VideoDecoder_StartInternal\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
285 //cout << "DSSTART" << endl;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
286 this->m_pDMO_Filter->Start(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
287
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
288 props.cBuffers = 1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
289 props.cbBuffer = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
290
9503
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
291 props.cbAlign = 1;
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
292 props.cbPrefix = 0;
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
293 this->m_pDMO_Filter->m_pAll->vt->SetProperties(this->m_pDMO_Filter->m_pAll, &props, &props1);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
294 this->m_pDMO_Filter->m_pAll->vt->Commit(this->m_pDMO_Filter->m_pAll);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
295 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
296 this->iv.m_State = START;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
297 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
298
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
299 void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
300 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
301 // this->m_pDMO_Filter->Stop(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
302 //??? why was this here ??? m_pOurOutput->SetFramePointer(0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
303 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
304
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
305 int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int size, int is_keyframe, char* imdata)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
306 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
307 // IMediaSample* sample = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
308 char* ptr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
309 int result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
310 unsigned long status; // to be ignored by M$ specs
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
311 DMO_OUTPUT_DATA_BUFFER db;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
312 CMediaBuffer* bufferin;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
313 //+ uint8_t* imdata = dest ? dest->Data() : 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
314
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
315 Debug printf("DMO_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,imdata);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
316
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
317 // this->m_pDMO_Filter->m_pAll->vt->GetBuffer(this->m_pDMO_Filter->m_pAll, &sample, 0, 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
318 // if (!sample)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
319 // {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
320 // Debug printf("ERROR: null sample\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
321 // return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
322 // }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
323
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
324 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
325 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
326 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
327
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
328 bufferin = CMediaBufferCreate(size, (void*)src, size, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
329 result = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
330 (IMediaBuffer*)bufferin,
15919
b612f732e420 hardcode SYNC flag, so no problems could rise if first frame is skipped
iive
parents: 15574
diff changeset
331 DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
332 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
333 ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
334
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
335 if (result != S_OK)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
336 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
337 /* something for process */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
338 if (result != S_FALSE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
339 printf("ProcessInputError r:0x%x=%d (keyframe: %d)\n", result, result, is_keyframe);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
340 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
341 printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
342 return size;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
343 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
344
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
345 db.rtTimestamp = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
346 db.rtTimelength = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
347 db.dwStatus = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
348 db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(this->m_sDestType.lSampleSize,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
349 imdata, 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
350 result = this->m_pDMO_Filter->m_pMedia->vt->ProcessOutput(this->m_pDMO_Filter->m_pMedia,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
351 (imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
352 1, &db, &status);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
353 //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
354 if ((unsigned)result == DMO_E_NOTACCEPTING)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
355 printf("ProcessOutputError: Not accepting\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
356 else if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
357 printf("ProcessOutputError: r:0x%x=%d %ld stat:%ld\n", result, result, status, db.dwStatus);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
358
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
359 ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
360
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
361 //int r = m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
362 //printf("FLUSH %d\n", r);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
363
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
364 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
365 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
366
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
367 /*
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
368 * bits == 0 - leave unchanged
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
369 */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
370 //int SetDestFmt(DMO_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
371 int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
372 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
373 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
374 int should_test=1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
375 int stoped = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
376
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
377 Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
378
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
379 /* if (!CImage::Supported(csp, bits))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
380 return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
381 */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
382 // BitmapInfo temp = m_obh;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
383
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
384 if (!csp) // RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
385 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
386 int ok = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
387
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
388 switch (bits)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
389 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
390 case 15:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
391 this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
392 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
393 case 16:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
394 this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
395 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
396 case 24:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
397 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
398 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
399 case 32:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
400 this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
401 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
402 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
403 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
404 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
405 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
406
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
407 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
408 this->iv.m_obh.biBitCount=bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
409 if( bits == 15 || bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
410 this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
411 this->iv.m_obh.biCompression=3;//BI_BITFIELDS
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
412 this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
413 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
414
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
415 if( bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
416 this->iv.m_obh.colors[0]=0xF800;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
417 this->iv.m_obh.colors[1]=0x07E0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
418 this->iv.m_obh.colors[2]=0x001F;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
419 } else if ( bits == 15 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
420 this->iv.m_obh.colors[0]=0x7C00;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
421 this->iv.m_obh.colors[1]=0x03E0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
422 this->iv.m_obh.colors[2]=0x001F;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
423 } else {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
424 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
425 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
426 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
427 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
428 * ((this->iv.m_obh.biBitCount + 7) / 8);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
429 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
430 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
431 //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
432 } else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
433 { // YUV
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
434 int ok = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
435 switch (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
436 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
437 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
438 this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
439 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
440 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
441 this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
442 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
443 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
444 this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
445 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
446 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
447 this->m_sDestType.subtype = MEDIASUBTYPE_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
448 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
449 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
450 this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
451 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
452 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
453 this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
454 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
455 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
456 this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
457 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
458 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
459 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
460 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
461
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
462 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
463 if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
464 this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
465 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
466 this->iv.m_obh.biCompression=csp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
467 this->iv.m_obh.biBitCount=bits;
10887
858e2605726c fix for the no video/black screen with some dmo/wmv9 movies
pl
parents: 9978
diff changeset
468
858e2605726c fix for the no video/black screen with some dmo/wmv9 movies
pl
parents: 9978
diff changeset
469 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
858e2605726c fix for the no video/black screen with some dmo/wmv9 movies
pl
parents: 9978
diff changeset
470 * ((this->iv.m_obh.biBitCount + 7) / 8);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
471 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
472 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
473 this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
474 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
475 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
476 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
477 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
478 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
479 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
480
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
481
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
482 switch(csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
483 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
484 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
485 if(!(this->m_Caps & CAP_YUY2))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
486 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
487 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
488 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
489 if(!(this->m_Caps & CAP_YV12))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
490 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
491 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
492 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
493 if(!(this->m_Caps & CAP_IYUV))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
494 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
495 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
496 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
497 if(!(this->m_Caps & CAP_I420))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
498 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
499 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
500 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
501 if(!(this->m_Caps & CAP_UYVY))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
502 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
503 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
504 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
505 if(!(this->m_Caps & CAP_YVYU))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
506 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
507 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
508 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
509 if(!(this->m_Caps & CAP_YVU9))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
510 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
511 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
512 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
513
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
514 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
515 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
516 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
517
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
518 // if(should_test)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
519 // result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
520 // else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
521 // result = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
522
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
523 // test accept
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
524 if(!this->m_pDMO_Filter) return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
525 result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
526
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
527 if (result != 0)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
528 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
529 if (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
530 printf("Warning: unsupported color space\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
531 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
532 printf("Warning: unsupported bit depth\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
533
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
534 this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
535 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
536 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
537 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
538 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
539 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
540 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
541
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
542 return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
543 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
544
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
545 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
546
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
547 // m_obh=temp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
548 // if(csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
549 // m_obh.biBitCount=BitmapInfo::BitCount(csp);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
550 this->iv.m_bh->biBitCount = bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
551
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
552 //DMO_VideoDecoder_Restart(this);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
553
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
554 this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
555
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
556 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
557 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
558
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
559
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
560 int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
561 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
562 this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
563 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
564 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
565 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
566