annotate loader/dmo/DMO_VideoDecoder.c @ 10760:e652bc367e17

slight "grammar" fixes
author gabucino
date Sun, 31 Aug 2003 22:53:07 +0000
parents 11cee15b1a8f
children 858e2605726c
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 __MODULE__ "DirectShow_VideoDecoder"
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
62
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
63 #define false 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
64 #define true 1
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
65
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 //int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this){return this->m_Caps;}
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 typedef struct _ct ct;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
70
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
71 struct _ct {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
72 fourcc_t fcc;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
73 unsigned int bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
74 const GUID* subtype;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
75 int cap;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
78 static ct check[] = {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
79 { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420 },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
80 { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12 },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
81 { fccYUY2, 16, &MEDIASUBTYPE_YUY2, CAP_YUY2 },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
82 { fccUYVY, 16, &MEDIASUBTYPE_UYVY, CAP_UYVY },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
83 { fccYVYU, 16, &MEDIASUBTYPE_YVYU, CAP_YVYU },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
84 { fccIYUV, 24, &MEDIASUBTYPE_IYUV, CAP_IYUV },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
85
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
86 { 8, 8, &MEDIASUBTYPE_RGB8, CAP_NONE },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
87 { 15, 16, &MEDIASUBTYPE_RGB555, CAP_NONE },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
88 { 16, 16, &MEDIASUBTYPE_RGB565, CAP_NONE },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
89 { 24, 24, &MEDIASUBTYPE_RGB24, CAP_NONE },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
90 { 32, 32, &MEDIASUBTYPE_RGB32, CAP_NONE },
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
91
9963
alex
parents: 9503
diff changeset
92 {0,0,NULL,0},
8294
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
95 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
96 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
97 DMO_VideoDecoder *this;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
98 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
99 ct* c;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
100
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
101 this = malloc(sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
102 memset( this, 0, sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
103
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
104 this->m_sVhdr2 = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
105 this->m_iLastQuality = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
106 this->m_iMaxAuto = maxauto;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
107
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
108 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
109 Setup_LDT_Keeper();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
110 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
111
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
112 //memset(&m_obh, 0, sizeof(m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
113 //m_obh.biSize = sizeof(m_obh);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
114 /*try*/
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
115 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
116 unsigned int bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
117
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
118 bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
119 sizeof(BITMAPINFOHEADER) : format->biSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
120
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
121 this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
122 memcpy(this->iv.m_bh, format, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
123
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
124 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
125 //this->iv.m_pFrame = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
126 this->iv.m_Mode = DIRECT;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
127 this->iv.m_iDecpos = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
128 this->iv.m_iPlaypos = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
129 this->iv.m_fQuality = 0.0f;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
130 this->iv.m_bCapable16b = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
131
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
132 bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
133 this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
134 memset(this->m_sVhdr, 0, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
135 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
136 this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
137 this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
138 this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
139 //this->m_sVhdr->rcSource.right = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
140 //this->m_sVhdr->rcSource.bottom = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
141 this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
142
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
143 this->m_sOurType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
144 this->m_sOurType.subtype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
145 this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
146 this->m_sOurType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
147 this->m_sOurType.bFixedSizeSamples = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
148 this->m_sOurType.bTemporalCompression = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
149 this->m_sOurType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
150 this->m_sOurType.cbFormat = bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
151 this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
152
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
153 this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
154 memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
155 memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
156 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
157 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
158
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
159 // memset((char*)this->m_sVhdr2, 0, sizeof(VIDEOINFOHEADER)+12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
160 this->m_sVhdr2->rcTarget = this->m_sVhdr->rcTarget;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
161 // this->m_sVhdr2->rcSource = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
162
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
163 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
164 this->m_sDestType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
165 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
166 this->m_sDestType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
167 this->m_sDestType.bFixedSizeSamples = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
168 this->m_sDestType.bTemporalCompression = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
169 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
170 * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
171 this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
172 this->m_sDestType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
173 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
174 this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
175
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
176 memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
177 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
178 ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
179 this->iv.m_obh.biBitCount=24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
180 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
181 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
182 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
183 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
184 * ((this->iv.m_obh.biBitCount + 7) / 8);
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
187 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
188
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
189 if (!this->m_pDMO_Filter)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
190 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
191 printf("Failed to create DMO filter\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
192 return 0;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
195 if (!flip)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
196 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
197 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
198 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
199 // 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
200 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
201 if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
202 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
203 printf("Decoder does not support upside-down RGB frames\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
204 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
205 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
209 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
210
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
211 switch (this->iv.m_bh->biCompression)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
212 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
213 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
214 case fccDIV3:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
215 case fccDIV4:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
216 case fccDIV5:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
217 case fccDIV6:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
218 case fccMP42:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
219 case fccWMV2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
220 //YV12 seems to be broken for DivX :-) codec
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
221 // case fccIV50:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
222 //produces incorrect picture
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
223 //m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
224 //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
225 //m_Caps = CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
226 this->m_Caps = (CAP_YUY2 | CAP_UYVY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
227 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
228 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
229 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
230
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
231 this->m_Caps = CAP_NONE;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
232
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
233 printf("Decoder supports the following YUV formats: ");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
234 for (c = check; c->bits; c++)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
235 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
236 this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
237 this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
238 this->m_sDestType.subtype = *c->subtype;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
239 //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
240 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
241 if (!result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
242 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
243 this->m_Caps = (this->m_Caps | c->cap);
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8294
diff changeset
244 printf("%.4s ", (char*) &c->fcc);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
245 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
246 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
247 printf("\n");
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
250 if (this->m_Caps != CAP_NONE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
251 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
252
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
253 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
254 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
255 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
256
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
257 this->m_iMinBuffers = this->iv.VBUFSIZE;
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 /*catch (FatalError& error)
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 delete[] m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
262 delete[] m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
263 delete m_pDMO_Filter;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
264 throw;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
265 }*/
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
266 return this;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
269 void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this)
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 DMO_VideoDecoder_StopInternal(this);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
272 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
273 free(this->m_sVhdr);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
274 free(this->m_sVhdr2);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
275 DMO_Filter_Destroy(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
276 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
277
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
278 void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this)
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 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
281 ALLOCATOR_PROPERTIES props, props1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
282 Debug printf("DMO_VideoDecoder_StartInternal\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
283 //cout << "DSSTART" << endl;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
284 this->m_pDMO_Filter->Start(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
285
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
286 props.cBuffers = 1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
287 props.cbBuffer = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
288
9503
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
289 props.cbAlign = 1;
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
290 props.cbPrefix = 0;
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
291 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
292 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
293 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
294 this->iv.m_State = START;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
295 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
296
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
297 void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this)
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 // this->m_pDMO_Filter->Stop(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
300 //??? why was this here ??? m_pOurOutput->SetFramePointer(0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
301 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
302
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
303 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
304 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
305 // IMediaSample* sample = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
306 char* ptr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
307 int result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
308 unsigned long status; // to be ignored by M$ specs
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
309 DMO_OUTPUT_DATA_BUFFER db;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
310 CMediaBuffer* bufferin;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
311 //+ uint8_t* imdata = dest ? dest->Data() : 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
312
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
313 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
314
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
315 // 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
316 // if (!sample)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
317 // {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
318 // Debug printf("ERROR: null sample\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
319 // return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
320 // }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
321
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
322 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
323 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
324 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
325
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
326 bufferin = CMediaBufferCreate(size, (void*)src, size, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
327 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
328 (IMediaBuffer*)bufferin,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
329 (is_keyframe) ? DMO_INPUT_DATA_BUFFERF_SYNCPOINT : 0,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
330 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
331 ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
332
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
333 if (result != S_OK)
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 /* something for process */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
336 if (result != S_FALSE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
337 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
338 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
339 printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
340 return size;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
341 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
342
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
343 db.rtTimestamp = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
344 db.rtTimelength = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
345 db.dwStatus = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
346 db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(this->m_sDestType.lSampleSize,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
347 imdata, 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
348 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
349 (imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
350 1, &db, &status);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
351 //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
352 if ((unsigned)result == DMO_E_NOTACCEPTING)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
353 printf("ProcessOutputError: Not accepting\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
354 else if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
355 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
356
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
357 ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer);
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 //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
360 //printf("FLUSH %d\n", r);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
361
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
362 return 0;
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
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 * bits == 0 - leave unchanged
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 //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
369 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
370 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
371 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
372 int should_test=1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
373 int stoped = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
374
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
375 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
376
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
377 /* if (!CImage::Supported(csp, bits))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
378 return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
379 */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
380 // BitmapInfo temp = m_obh;
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 if (!csp) // RGB
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 int ok = true;
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 switch (bits)
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 case 15:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
389 this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
390 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
391 case 16:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
392 this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
393 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
394 case 24:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
395 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
396 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
397 case 32:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
398 this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
399 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
400 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
401 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
402 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
403 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
404
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
405 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
406 this->iv.m_obh.biBitCount=bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
407 if( bits == 15 || bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
408 this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
409 this->iv.m_obh.biCompression=3;//BI_BITFIELDS
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
410 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
411 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
412
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
413 if( bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
414 this->iv.m_obh.colors[0]=0xF800;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
415 this->iv.m_obh.colors[1]=0x07E0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
416 this->iv.m_obh.colors[2]=0x001F;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
417 } else if ( bits == 15 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
418 this->iv.m_obh.colors[0]=0x7C00;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
419 this->iv.m_obh.colors[1]=0x03E0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
420 this->iv.m_obh.colors[2]=0x001F;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
421 } else {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
422 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
423 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
424 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
425 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
426 * ((this->iv.m_obh.biBitCount + 7) / 8);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
427 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
428 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
429 //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
430 } else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
431 { // YUV
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
432 int ok = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
433 switch (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
434 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
435 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
436 this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
437 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
438 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
439 this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
440 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
441 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
442 this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
443 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
444 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
445 this->m_sDestType.subtype = MEDIASUBTYPE_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
446 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
447 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
448 this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
449 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
450 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
451 this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
452 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
453 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
454 this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
455 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
456 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
457 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
458 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
459
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
460 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
461 if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
462 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
463 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
464 this->iv.m_obh.biCompression=csp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
465 this->iv.m_obh.biBitCount=bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
466 this->iv.m_obh.biSizeImage=labs(this->iv.m_obh.biBitCount*
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
467 this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)>>3;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
468 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
469 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
470 this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
471 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
472 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
473 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
474 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
475 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
476 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
477
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
478
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
479 switch(csp)
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 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
482 if(!(this->m_Caps & CAP_YUY2))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
483 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
484 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
485 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
486 if(!(this->m_Caps & CAP_YV12))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
487 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
488 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
489 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
490 if(!(this->m_Caps & CAP_IYUV))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
491 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
492 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
493 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
494 if(!(this->m_Caps & CAP_I420))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
495 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
496 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
497 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
498 if(!(this->m_Caps & CAP_UYVY))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
499 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
500 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
501 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
502 if(!(this->m_Caps & CAP_YVYU))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
503 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
504 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
505 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
506 if(!(this->m_Caps & CAP_YVU9))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
507 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
508 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
509 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
510
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
511 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
512 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
513 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
514
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
515 // if(should_test)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
516 // 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
517 // else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
518 // result = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
519
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
520 // test accept
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
521 if(!this->m_pDMO_Filter) return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
522 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
523
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
524 if (result != 0)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
525 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
526 if (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
527 printf("Warning: unsupported color space\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
528 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
529 printf("Warning: unsupported bit depth\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
530
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
531 this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
532 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
533 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
534 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
535 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
536 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
537 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
538
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
539 return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
540 }
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 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
543
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
544 // m_obh=temp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
545 // if(csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
546 // m_obh.biBitCount=BitmapInfo::BitCount(csp);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
547 this->iv.m_bh->biBitCount = bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
548
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
549 //DMO_VideoDecoder_Restart(this);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
550
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
551 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
552
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
553 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
554 }
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
557 int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d)
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 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
560 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
561 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
562 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
563