annotate loader/dmo/DMO_VideoDecoder.c @ 20935:4a8c67e44c7f

cosmetics: alphabetical order and prettyprinting for the CodecTag table
author diego
date Thu, 16 Nov 2006 00:59:01 +0000
parents 3bf0d70b4c7f
children 2934974c366a
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;
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
76 char *name;
8294
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
79 static ct check[] = {
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
80 { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
81 { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
82 { fccYUY2, 16, &MEDIASUBTYPE_YUY2, CAP_YUY2, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
83 { fccUYVY, 16, &MEDIASUBTYPE_UYVY, CAP_UYVY, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
84 { fccYVYU, 16, &MEDIASUBTYPE_YVYU, CAP_YVYU, NULL },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
85 { fccIYUV, 24, &MEDIASUBTYPE_IYUV, CAP_IYUV, NULL },
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
86
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
87 { 8, 8, &MEDIASUBTYPE_RGB8, CAP_NONE, "RGB8" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
88 { 15, 16, &MEDIASUBTYPE_RGB555, CAP_NONE, "RGB555" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
89 { 16, 16, &MEDIASUBTYPE_RGB565, CAP_NONE, "RGB565" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
90 { 24, 24, &MEDIASUBTYPE_RGB24, CAP_NONE, "RGB24" },
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
91 { 32, 32, &MEDIASUBTYPE_RGB32, CAP_NONE, "RGB32" },
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
92
9963
alex
parents: 9503
diff changeset
93 {0,0,NULL,0},
8294
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
96 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
97 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
98 DMO_VideoDecoder *this;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
99 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
100 ct* c;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
101
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
102 this = malloc(sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
103 memset( this, 0, sizeof(DMO_VideoDecoder));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
104
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
105 this->m_sVhdr2 = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
106 this->m_iLastQuality = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
107 this->m_iMaxAuto = maxauto;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
108
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
109 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
110 Setup_LDT_Keeper();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
111 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
112
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
113 //memset(&m_obh, 0, sizeof(m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
114 //m_obh.biSize = sizeof(m_obh);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
115 /*try*/
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 unsigned int bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
118
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
119 bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
120 sizeof(BITMAPINFOHEADER) : format->biSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
121
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 15919
diff changeset
122 this->iv.m_bh = malloc(bihs);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
123 memcpy(this->iv.m_bh, format, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
124
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
125 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
126 //this->iv.m_pFrame = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
127 this->iv.m_Mode = DIRECT;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
128 this->iv.m_iDecpos = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
129 this->iv.m_iPlaypos = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
130 this->iv.m_fQuality = 0.0f;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
131 this->iv.m_bCapable16b = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
132
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
133 bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 15919
diff changeset
134 this->m_sVhdr = malloc(bihs);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
135 memset(this->m_sVhdr, 0, bihs);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
136 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
137 this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
138 this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
139 this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
140 //this->m_sVhdr->rcSource.right = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
141 //this->m_sVhdr->rcSource.bottom = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
142 this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
143
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
144 this->m_sOurType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
145 this->m_sOurType.subtype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
146 this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
147 this->m_sOurType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
148 this->m_sOurType.bFixedSizeSamples = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
149 this->m_sOurType.bTemporalCompression = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
150 this->m_sOurType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
151 this->m_sOurType.cbFormat = bihs;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
152 this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
153
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
154 this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
155 memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
156 memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
157 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
158 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
159
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
160 // memset((char*)this->m_sVhdr2, 0, sizeof(VIDEOINFOHEADER)+12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
161 this->m_sVhdr2->rcTarget = this->m_sVhdr->rcTarget;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
162 // this->m_sVhdr2->rcSource = this->m_sVhdr->rcSource;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
163
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
164 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
165 this->m_sDestType.majortype = MEDIATYPE_Video;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
166 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
167 this->m_sDestType.formattype = FORMAT_VideoInfo;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
168 this->m_sDestType.bFixedSizeSamples = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
169 this->m_sDestType.bTemporalCompression = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
170 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
171 * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
172 this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
173 this->m_sDestType.pUnk = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
174 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
175 this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
176
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
177 memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
178 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
179 ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
180 this->iv.m_obh.biBitCount=24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
181 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
182 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
183 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
184 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
185 * ((this->iv.m_obh.biBitCount + 7) / 8);
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
188 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
189
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
190 if (!this->m_pDMO_Filter)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
191 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
192 printf("Failed to create DMO filter\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
193 return 0;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
196 if (!flip)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
197 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
198 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
199 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
200 // 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
201 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
202 if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
203 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
204 printf("Decoder does not support upside-down RGB frames\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
205 this->iv.m_obh.biHeight *= -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
206 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
210 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
211
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
212 switch (this->iv.m_bh->biCompression)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
213 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
214 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
215 case fccDIV3:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
216 case fccDIV4:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
217 case fccDIV5:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
218 case fccDIV6:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
219 case fccMP42:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
220 case fccWMV2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
221 //YV12 seems to be broken for DivX :-) codec
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
222 // case fccIV50:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
223 //produces incorrect picture
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
224 //m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
225 //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
226 //m_Caps = CAP_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
227 this->m_Caps = (CAP_YUY2 | CAP_UYVY);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
228 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
229 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
230 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
231
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
232 this->m_Caps = CAP_NONE;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
233
15574
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
234 printf("Decoder supports the following formats: ");
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
235 for (c = check; c->bits; c++)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
236 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
237 this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
238 this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
239 this->m_sDestType.subtype = *c->subtype;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
240 //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
241 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
242 if (!result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
243 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
244 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
245 if (c->name)
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
246 printf("%s ", c->name);
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
247 else
0feaed9986d3 This currently sends control characters to the terminal instead of
rtognimp
parents: 10887
diff changeset
248 printf("%.4s ", (char*) &c->fcc);
8294
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 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
251 printf("\n");
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
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
254 if (this->m_Caps != CAP_NONE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
255 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
256
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
257 this->m_sVhdr2->bmiHeader.biBitCount = 24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
258 this->m_sVhdr2->bmiHeader.biCompression = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
259 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
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 this->m_iMinBuffers = this->iv.VBUFSIZE;
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 /*catch (FatalError& error)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
264 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
265 delete[] m_sVhdr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
266 delete[] m_sVhdr2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
267 delete m_pDMO_Filter;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
268 throw;
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 return this;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
271 }
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 void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
274 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
275 DMO_VideoDecoder_StopInternal(this);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
276 this->iv.m_State = STOP;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
277 free(this->m_sVhdr);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
278 free(this->m_sVhdr2);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
279 DMO_Filter_Destroy(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
280 }
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 void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
283 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
284 #if 0
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
285 ALLOCATOR_PROPERTIES props, props1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
286 Debug printf("DMO_VideoDecoder_StartInternal\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
287 //cout << "DSSTART" << endl;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
288 this->m_pDMO_Filter->Start(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
289
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
290 props.cBuffers = 1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
291 props.cbBuffer = this->m_sDestType.lSampleSize;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
292
9503
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
293 props.cbAlign = 1;
f47d484d8f28 cbAlign=1 fix for proper Windows support (noticed by Sascha Sommer)
alex
parents: 8451
diff changeset
294 props.cbPrefix = 0;
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
295 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
296 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
297 #endif
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
298 this->iv.m_State = START;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
299 }
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 void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this)
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 // this->m_pDMO_Filter->Stop(this->m_pDMO_Filter);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
304 //??? why was this here ??? m_pOurOutput->SetFramePointer(0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
305 }
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 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
308 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
309 // IMediaSample* sample = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
310 char* ptr;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
311 int result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
312 unsigned long status; // to be ignored by M$ specs
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
313 DMO_OUTPUT_DATA_BUFFER db;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
314 CMediaBuffer* bufferin;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
315 //+ uint8_t* imdata = dest ? dest->Data() : 0;
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 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
318
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
319 // 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
320 // if (!sample)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
321 // {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
322 // Debug printf("ERROR: null sample\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
323 // return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
324 // }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
325
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
326 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
327 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
328 #endif
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
329
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
330 bufferin = CMediaBufferCreate(size, (void*)src, size, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
331 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
332 (IMediaBuffer*)bufferin,
15919
b612f732e420 hardcode SYNC flag, so no problems could rise if first frame is skipped
iive
parents: 15574
diff changeset
333 DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
334 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
335 ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin);
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 if (result != S_OK)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
338 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
339 /* something for process */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
340 if (result != S_FALSE)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
341 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
342 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
343 printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
344 return size;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
345 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
346
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
347 db.rtTimestamp = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
348 db.rtTimelength = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
349 db.dwStatus = 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
350 db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(this->m_sDestType.lSampleSize,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
351 imdata, 0, 0);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
352 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
353 (imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER,
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
354 1, &db, &status);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
355 //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
356 if ((unsigned)result == DMO_E_NOTACCEPTING)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
357 printf("ProcessOutputError: Not accepting\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
358 else if (result)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
359 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
360
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
361 ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
362
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
363 //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
364 //printf("FLUSH %d\n", r);
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 return 0;
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
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 * bits == 0 - leave unchanged
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
371 */
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
372 //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
373 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
374 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
375 HRESULT result;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
376 int should_test=1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
377 int stoped = 0;
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 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
380
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
381 /* if (!CImage::Supported(csp, bits))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
382 return -1;
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 // BitmapInfo temp = m_obh;
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 if (!csp) // RGB
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 int ok = true;
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 switch (bits)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
391 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
392 case 15:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
393 this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
394 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
395 case 16:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
396 this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
397 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
398 case 24:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
399 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
400 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
401 case 32:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
402 this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
403 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
404 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
405 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
406 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
407 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
408
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
409 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
410 this->iv.m_obh.biBitCount=bits;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
411 if( bits == 15 || bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
412 this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
413 this->iv.m_obh.biCompression=3;//BI_BITFIELDS
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
414 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
415 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
416
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
417 if( bits == 16 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
418 this->iv.m_obh.colors[0]=0xF800;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
419 this->iv.m_obh.colors[1]=0x07E0;
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 if ( bits == 15 ) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
422 this->iv.m_obh.colors[0]=0x7C00;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
423 this->iv.m_obh.colors[1]=0x03E0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
424 this->iv.m_obh.colors[2]=0x001F;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
425 } else {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
426 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
427 this->iv.m_obh.biCompression = 0; //BI_RGB
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
428 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
429 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
430 * ((this->iv.m_obh.biBitCount + 7) / 8);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
431 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
432 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
433 //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
434 } else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
435 { // YUV
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
436 int ok = true;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
437 switch (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
438 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
439 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
440 this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
441 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
442 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
443 this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
444 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
445 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
446 this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
447 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
448 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
449 this->m_sDestType.subtype = MEDIASUBTYPE_I420;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
450 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
451 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
452 this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
453 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
454 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
455 this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
456 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
457 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
458 this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
459 default:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
460 ok = false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
461 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
462 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
463
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
464 if (ok) {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
465 if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
466 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
467 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
468 this->iv.m_obh.biCompression=csp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
469 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
470
858e2605726c fix for the no video/black screen with some dmo/wmv9 movies
pl
parents: 9978
diff changeset
471 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
472 * ((this->iv.m_obh.biBitCount + 7) / 8);
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
473 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
474 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
475 this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
476 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
477 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
478 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
479 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
480 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
481 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
482
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 switch(csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
485 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
486 case fccYUY2:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
487 if(!(this->m_Caps & CAP_YUY2))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
488 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
489 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
490 case fccYV12:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
491 if(!(this->m_Caps & CAP_YV12))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
492 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
493 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
494 case fccIYUV:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
495 if(!(this->m_Caps & CAP_IYUV))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
496 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
497 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
498 case fccI420:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
499 if(!(this->m_Caps & CAP_I420))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
500 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
501 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
502 case fccUYVY:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
503 if(!(this->m_Caps & CAP_UYVY))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
504 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
505 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
506 case fccYVYU:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
507 if(!(this->m_Caps & CAP_YVYU))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
508 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
509 break;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
510 case fccYVU9:
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
511 if(!(this->m_Caps & CAP_YVU9))
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
512 should_test=false;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
513 break;
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
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
516 #ifdef WIN32_LOADER
8294
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
517 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9963
diff changeset
518 #endif
8294
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 // if(should_test)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
521 // 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
522 // else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
523 // result = -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
524
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
525 // test accept
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
526 if(!this->m_pDMO_Filter) return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
527 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
528
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
529 if (result != 0)
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 if (csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
532 printf("Warning: unsupported color space\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
533 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
534 printf("Warning: unsupported bit depth\n");
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
535
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
536 this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
537 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
538 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
539 if (this->m_sVhdr2->bmiHeader.biCompression == 3)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
540 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
541 else
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
542 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
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 return -1;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
545 }
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 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
548
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
549 // m_obh=temp;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
550 // if(csp)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
551 // m_obh.biBitCount=BitmapInfo::BitCount(csp);
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
552 this->iv.m_bh->biBitCount = bits;
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 //DMO_VideoDecoder_Restart(this);
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 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
557
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
558 return 0;
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
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 int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d)
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
563 {
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
564 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
565 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
566 return 0;
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
567 }
8e00b6a9e40b DMO interfaces (copied/converted(c++->c) from avifile)
arpi
parents:
diff changeset
568