5b69a5b742985484b3d33ab5f144438884b9d5fc
2 * DirectShow capture interface
3 * Copyright (c) 2010 Ramiro Polla
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "dshow_capture.h"
24 DECLARE_QUERYINTERFACE(libAVEnumMediaTypes
,
25 { {&IID_IUnknown
,0}, {&IID_IEnumMediaTypes
,0} })
26 DECLARE_ADDREF(libAVEnumMediaTypes
)
27 DECLARE_RELEASE(libAVEnumMediaTypes
)
30 libAVEnumMediaTypes_Next(libAVEnumMediaTypes
*this, unsigned long n
,
31 AM_MEDIA_TYPE
**types
, unsigned long *fetched
)
34 dshowdebug("libAVEnumMediaTypes_Next(%p)\n", this);
37 if (!this->pos
&& n
== 1) {
38 if (!IsEqualGUID(&this->type
.majortype
, &GUID_NULL
)) {
39 AM_MEDIA_TYPE
*type
= av_malloc(sizeof(AM_MEDIA_TYPE
));
40 ff_copy_dshow_media_type(type
, &this->type
);
53 libAVEnumMediaTypes_Skip(libAVEnumMediaTypes
*this, unsigned long n
)
55 dshowdebug("libAVEnumMediaTypes_Skip(%p)\n", this);
56 if (n
) /* Any skip will always fall outside of the only valid type. */
61 libAVEnumMediaTypes_Reset(libAVEnumMediaTypes
*this)
63 dshowdebug("libAVEnumMediaTypes_Reset(%p)\n", this);
68 libAVEnumMediaTypes_Clone(libAVEnumMediaTypes
*this, libAVEnumMediaTypes
**enums
)
70 libAVEnumMediaTypes
*new;
71 dshowdebug("libAVEnumMediaTypes_Clone(%p)\n", this);
74 new = libAVEnumMediaTypes_Create(&this->type
);
83 libAVEnumMediaTypes_Setup(libAVEnumMediaTypes
*this, const AM_MEDIA_TYPE
*type
)
85 IEnumMediaTypesVtbl
*vtbl
= this->vtbl
;
86 SETVTBL(vtbl
, libAVEnumMediaTypes
, QueryInterface
);
87 SETVTBL(vtbl
, libAVEnumMediaTypes
, AddRef
);
88 SETVTBL(vtbl
, libAVEnumMediaTypes
, Release
);
89 SETVTBL(vtbl
, libAVEnumMediaTypes
, Next
);
90 SETVTBL(vtbl
, libAVEnumMediaTypes
, Skip
);
91 SETVTBL(vtbl
, libAVEnumMediaTypes
, Reset
);
92 SETVTBL(vtbl
, libAVEnumMediaTypes
, Clone
);
95 this->type
.majortype
= GUID_NULL
;
97 ff_copy_dshow_media_type(&this->type
, type
);
102 DECLARE_CREATE(libAVEnumMediaTypes
, libAVEnumMediaTypes_Setup(this, type
), const AM_MEDIA_TYPE
*type
)
103 DECLARE_DESTROY(libAVEnumMediaTypes
, nothing
)