Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
@ 2022-01-02  9:49 Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 1/5] avdevice/dshow: tv_tuner_audio_dialog cleanup missing Diederick Niehorster
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

These five patches fix two regressions (one crashing bug making dshow
unusable on x86, and one regression introduced by my recent patches due
to which devices that seem to not behave according to spec but worked
fine before my patches could no longer be used.
They furthermore fix three small issues i found looking through the dshow code: 2x needed cleanup not being done, and one where to skip setting format for a pin when its useless.

new in v2 is fixing of the x86 crash

Diederick Niehorster (5):
  avdevice/dshow: tv_tuner_audio_dialog cleanup missing
  avdevice/dshow: proper cleanup of queried media types
  avdevice/dshow: fix crash on x86
  avdevice/dshow: only set pin format if wanted
  avdevice/dshow: ensure pin's default format is set

 libavdevice/dshow.c                |  93 +++++++++++++---------
 libavdevice/dshow_capture.h        | 120 ++++++++++++++---------------
 libavdevice/dshow_crossbar.c       |   4 +
 libavdevice/dshow_enummediatypes.c |   8 +-
 libavdevice/dshow_enumpins.c       |   8 +-
 libavdevice/dshow_filter.c         |  24 +++---
 libavdevice/dshow_pin.c            |  48 ++++++------
 7 files changed, 165 insertions(+), 140 deletions(-)

-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [FFmpeg-devel] [PATCH v2 1/5] avdevice/dshow: tv_tuner_audio_dialog cleanup missing
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
@ 2022-01-02  9:49 ` Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 2/5] avdevice/dshow: proper cleanup of queried media types Diederick Niehorster
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

Cleanup was missing for when the show_analog_tv_tuner_audio_dialog is
true.

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/dshow_crossbar.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/dshow_crossbar.c b/libavdevice/dshow_crossbar.c
index 2438683cde..961defe690 100644
--- a/libavdevice/dshow_crossbar.c
+++ b/libavdevice/dshow_crossbar.c
@@ -204,5 +204,9 @@ end:
         IAMTVTuner_Release(tv_tuner_filter);
     if (tv_tuner_base_filter)
         IBaseFilter_Release(tv_tuner_base_filter);
+    if (tv_audio_filter)
+        IAMAudioInputMixer_Release(tv_audio_filter);
+    if (tv_audio_base_filter)
+        IBaseFilter_Release(tv_audio_base_filter);
     return hr;
 }
-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/5] avdevice/dshow: proper cleanup of queried media types
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 1/5] avdevice/dshow: tv_tuner_audio_dialog cleanup missing Diederick Niehorster
@ 2022-01-02  9:49 ` Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 3/5] avdevice/dshow: fix crash on x86 Diederick Niehorster
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/dshow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 30f1be1ead..4b6887881d 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -953,7 +953,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
                     av_log(avctx, AV_LOG_INFO, "(%s)", chroma ? chroma : "unknown");
 
                 av_log(avctx, AV_LOG_INFO, "\n");
-                continue;
+                goto next;
             }
             if (requested_video_codec_id != AV_CODEC_ID_RAWVIDEO) {
                 if (requested_video_codec_id != fmt_info->codec_id)
@@ -1038,6 +1038,7 @@ next:
         if (type && type->pbFormat)
             CoTaskMemFree(type->pbFormat);
         CoTaskMemFree(type);
+        type = NULL;
     }
     // previously found a matching VIDEOINFOHEADER format and stored
     // it for safe keeping. Searching further for a matching
-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [FFmpeg-devel] [PATCH v2 3/5] avdevice/dshow: fix crash on x86
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 1/5] avdevice/dshow: tv_tuner_audio_dialog cleanup missing Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 2/5] avdevice/dshow: proper cleanup of queried media types Diederick Niehorster
@ 2022-01-02  9:49 ` Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 4/5] avdevice/dshow: only set pin format if wanted Diederick Niehorster
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

fix regression introduced in 911ba8417e8881a7380842e69e11ca05fdc46575.
Removal of WINAPI decoration from function signatures caused crashed
when using dshow on x86.

Fixes #9568

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/dshow_capture.h        | 120 ++++++++++++++---------------
 libavdevice/dshow_enummediatypes.c |   8 +-
 libavdevice/dshow_enumpins.c       |   8 +-
 libavdevice/dshow_filter.c         |  24 +++---
 libavdevice/dshow_pin.c            |  48 ++++++------
 5 files changed, 104 insertions(+), 104 deletions(-)

diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 5a2691518c..21f5cf7e83 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -70,7 +70,7 @@ enum dshowSourceFilterType {
 };
 
 #define DECLARE_QUERYINTERFACE(prefix, class, ...)                           \
-long                                                                         \
+long WINAPI                                                                  \
 ff_dshow_##prefix##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
 {                                                                            \
     struct GUIDoffset ifaces[] = __VA_ARGS__;                                \
@@ -93,14 +93,14 @@ ff_dshow_##prefix##_QueryInterface(class *this, const GUID *riid, void **ppvObje
     return E_NOINTERFACE;                                                    \
 }
 #define DECLARE_ADDREF(prefix, class)                                        \
-unsigned long                                                                \
+unsigned long WINAPI                                                         \
 ff_dshow_##prefix##_AddRef(class *this)                                      \
 {                                                                            \
     dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_AddRef(%p)\t%ld\n", this, this->ref+1); \
     return InterlockedIncrement(&this->ref);                                 \
 }
 #define DECLARE_RELEASE(prefix, class)                                       \
-unsigned long                                                                \
+unsigned long WINAPI                                                         \
 ff_dshow_##prefix##_Release(class *this)                                     \
 {                                                                            \
     long ref = InterlockedDecrement(&this->ref);                             \
@@ -167,34 +167,34 @@ struct DShowPin {
     IMemInputPinVtbl *imemvtbl;
 };
 
-long          ff_dshow_pin_QueryInterface          (DShowPin *, const GUID *, void **);
-unsigned long ff_dshow_pin_AddRef                  (DShowPin *);
-unsigned long ff_dshow_pin_Release                 (DShowPin *);
-long          ff_dshow_pin_Connect                 (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
-long          ff_dshow_pin_ReceiveConnection       (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
-long          ff_dshow_pin_Disconnect              (DShowPin *);
-long          ff_dshow_pin_ConnectedTo             (DShowPin *, IPin **);
-long          ff_dshow_pin_ConnectionMediaType     (DShowPin *, AM_MEDIA_TYPE *);
-long          ff_dshow_pin_QueryPinInfo            (DShowPin *, PIN_INFO *);
-long          ff_dshow_pin_QueryDirection          (DShowPin *, PIN_DIRECTION *);
-long          ff_dshow_pin_QueryId                 (DShowPin *, wchar_t **);
-long          ff_dshow_pin_QueryAccept             (DShowPin *, const AM_MEDIA_TYPE *);
-long          ff_dshow_pin_EnumMediaTypes          (DShowPin *, IEnumMediaTypes **);
-long          ff_dshow_pin_QueryInternalConnections(DShowPin *, IPin **, unsigned long *);
-long          ff_dshow_pin_EndOfStream             (DShowPin *);
-long          ff_dshow_pin_BeginFlush              (DShowPin *);
-long          ff_dshow_pin_EndFlush                (DShowPin *);
-long          ff_dshow_pin_NewSegment              (DShowPin *, REFERENCE_TIME, REFERENCE_TIME, double);
-
-long          ff_dshow_meminputpin_QueryInterface          (DShowMemInputPin *, const GUID *, void **);
-unsigned long ff_dshow_meminputpin_AddRef                  (DShowMemInputPin *);
-unsigned long ff_dshow_meminputpin_Release                 (DShowMemInputPin *);
-long          ff_dshow_meminputpin_GetAllocator            (DShowMemInputPin *, IMemAllocator **);
-long          ff_dshow_meminputpin_NotifyAllocator         (DShowMemInputPin *, IMemAllocator *, BOOL);
-long          ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *, ALLOCATOR_PROPERTIES *);
-long          ff_dshow_meminputpin_Receive                 (DShowMemInputPin *, IMediaSample *);
-long          ff_dshow_meminputpin_ReceiveMultiple         (DShowMemInputPin *, IMediaSample **, long, long *);
-long          ff_dshow_meminputpin_ReceiveCanBlock         (DShowMemInputPin *);
+long          WINAPI ff_dshow_pin_QueryInterface          (DShowPin *, const GUID *, void **);
+unsigned long WINAPI ff_dshow_pin_AddRef                  (DShowPin *);
+unsigned long WINAPI ff_dshow_pin_Release                 (DShowPin *);
+long          WINAPI ff_dshow_pin_Connect                 (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
+long          WINAPI ff_dshow_pin_ReceiveConnection       (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
+long          WINAPI ff_dshow_pin_Disconnect              (DShowPin *);
+long          WINAPI ff_dshow_pin_ConnectedTo             (DShowPin *, IPin **);
+long          WINAPI ff_dshow_pin_ConnectionMediaType     (DShowPin *, AM_MEDIA_TYPE *);
+long          WINAPI ff_dshow_pin_QueryPinInfo            (DShowPin *, PIN_INFO *);
+long          WINAPI ff_dshow_pin_QueryDirection          (DShowPin *, PIN_DIRECTION *);
+long          WINAPI ff_dshow_pin_QueryId                 (DShowPin *, wchar_t **);
+long          WINAPI ff_dshow_pin_QueryAccept             (DShowPin *, const AM_MEDIA_TYPE *);
+long          WINAPI ff_dshow_pin_EnumMediaTypes          (DShowPin *, IEnumMediaTypes **);
+long          WINAPI ff_dshow_pin_QueryInternalConnections(DShowPin *, IPin **, unsigned long *);
+long          WINAPI ff_dshow_pin_EndOfStream             (DShowPin *);
+long          WINAPI ff_dshow_pin_BeginFlush              (DShowPin *);
+long          WINAPI ff_dshow_pin_EndFlush                (DShowPin *);
+long          WINAPI ff_dshow_pin_NewSegment              (DShowPin *, REFERENCE_TIME, REFERENCE_TIME, double);
+
+long          WINAPI ff_dshow_meminputpin_QueryInterface          (DShowMemInputPin *, const GUID *, void **);
+unsigned long WINAPI ff_dshow_meminputpin_AddRef                  (DShowMemInputPin *);
+unsigned long WINAPI ff_dshow_meminputpin_Release                 (DShowMemInputPin *);
+long          WINAPI ff_dshow_meminputpin_GetAllocator            (DShowMemInputPin *, IMemAllocator **);
+long          WINAPI ff_dshow_meminputpin_NotifyAllocator         (DShowMemInputPin *, IMemAllocator *, BOOL);
+long          WINAPI ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *, ALLOCATOR_PROPERTIES *);
+long          WINAPI ff_dshow_meminputpin_Receive                 (DShowMemInputPin *, IMediaSample *);
+long          WINAPI ff_dshow_meminputpin_ReceiveMultiple         (DShowMemInputPin *, IMediaSample **, long, long *);
+long          WINAPI ff_dshow_meminputpin_ReceiveCanBlock         (DShowMemInputPin *);
 
 void                 ff_dshow_pin_Destroy(DShowPin *);
 DShowPin            *ff_dshow_pin_Create (DShowFilter *filter);
@@ -212,13 +212,13 @@ struct DShowEnumPins {
     DShowFilter *filter;
 };
 
-long          ff_dshow_enumpins_QueryInterface(DShowEnumPins *, const GUID *, void **);
-unsigned long ff_dshow_enumpins_AddRef        (DShowEnumPins *);
-unsigned long ff_dshow_enumpins_Release       (DShowEnumPins *);
-long          ff_dshow_enumpins_Next          (DShowEnumPins *, unsigned long, IPin **, unsigned long *);
-long          ff_dshow_enumpins_Skip          (DShowEnumPins *, unsigned long);
-long          ff_dshow_enumpins_Reset         (DShowEnumPins *);
-long          ff_dshow_enumpins_Clone         (DShowEnumPins *, DShowEnumPins **);
+long          WINAPI ff_dshow_enumpins_QueryInterface(DShowEnumPins *, const GUID *, void **);
+unsigned long WINAPI ff_dshow_enumpins_AddRef        (DShowEnumPins *);
+unsigned long WINAPI ff_dshow_enumpins_Release       (DShowEnumPins *);
+long          WINAPI ff_dshow_enumpins_Next          (DShowEnumPins *, unsigned long, IPin **, unsigned long *);
+long          WINAPI ff_dshow_enumpins_Skip          (DShowEnumPins *, unsigned long);
+long          WINAPI ff_dshow_enumpins_Reset         (DShowEnumPins *);
+long          WINAPI ff_dshow_enumpins_Clone         (DShowEnumPins *, DShowEnumPins **);
 
 void                 ff_dshow_enumpins_Destroy(DShowEnumPins *);
 DShowEnumPins       *ff_dshow_enumpins_Create (DShowPin *pin, DShowFilter *filter);
@@ -233,13 +233,13 @@ struct DShowEnumMediaTypes {
     AM_MEDIA_TYPE type;
 };
 
-long          ff_dshow_enummediatypes_QueryInterface(DShowEnumMediaTypes *, const GUID *, void **);
-unsigned long ff_dshow_enummediatypes_AddRef        (DShowEnumMediaTypes *);
-unsigned long ff_dshow_enummediatypes_Release       (DShowEnumMediaTypes *);
-long          ff_dshow_enummediatypes_Next          (DShowEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *);
-long          ff_dshow_enummediatypes_Skip          (DShowEnumMediaTypes *, unsigned long);
-long          ff_dshow_enummediatypes_Reset         (DShowEnumMediaTypes *);
-long          ff_dshow_enummediatypes_Clone         (DShowEnumMediaTypes *, DShowEnumMediaTypes **);
+long          WINAPI ff_dshow_enummediatypes_QueryInterface(DShowEnumMediaTypes *, const GUID *, void **);
+unsigned long WINAPI ff_dshow_enummediatypes_AddRef        (DShowEnumMediaTypes *);
+unsigned long WINAPI ff_dshow_enummediatypes_Release       (DShowEnumMediaTypes *);
+long          WINAPI ff_dshow_enummediatypes_Next          (DShowEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *);
+long          WINAPI ff_dshow_enummediatypes_Skip          (DShowEnumMediaTypes *, unsigned long);
+long          WINAPI ff_dshow_enummediatypes_Reset         (DShowEnumMediaTypes *);
+long          WINAPI ff_dshow_enummediatypes_Clone         (DShowEnumMediaTypes *, DShowEnumMediaTypes **);
 
 void                 ff_dshow_enummediatypes_Destroy(DShowEnumMediaTypes *);
 DShowEnumMediaTypes *ff_dshow_enummediatypes_Create(const AM_MEDIA_TYPE *type);
@@ -262,21 +262,21 @@ struct DShowFilter {
     void (*callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type);
 };
 
-long          ff_dshow_filter_QueryInterface (DShowFilter *, const GUID *, void **);
-unsigned long ff_dshow_filter_AddRef         (DShowFilter *);
-unsigned long ff_dshow_filter_Release        (DShowFilter *);
-long          ff_dshow_filter_GetClassID     (DShowFilter *, CLSID *);
-long          ff_dshow_filter_Stop           (DShowFilter *);
-long          ff_dshow_filter_Pause          (DShowFilter *);
-long          ff_dshow_filter_Run            (DShowFilter *, REFERENCE_TIME);
-long          ff_dshow_filter_GetState       (DShowFilter *, DWORD, FILTER_STATE *);
-long          ff_dshow_filter_SetSyncSource  (DShowFilter *, IReferenceClock *);
-long          ff_dshow_filter_GetSyncSource  (DShowFilter *, IReferenceClock **);
-long          ff_dshow_filter_EnumPins       (DShowFilter *, IEnumPins **);
-long          ff_dshow_filter_FindPin        (DShowFilter *, const wchar_t *, IPin **);
-long          ff_dshow_filter_QueryFilterInfo(DShowFilter *, FILTER_INFO *);
-long          ff_dshow_filter_JoinFilterGraph(DShowFilter *, IFilterGraph *, const wchar_t *);
-long          ff_dshow_filter_QueryVendorInfo(DShowFilter *, wchar_t **);
+long          WINAPI ff_dshow_filter_QueryInterface (DShowFilter *, const GUID *, void **);
+unsigned long WINAPI ff_dshow_filter_AddRef         (DShowFilter *);
+unsigned long WINAPI ff_dshow_filter_Release        (DShowFilter *);
+long          WINAPI ff_dshow_filter_GetClassID     (DShowFilter *, CLSID *);
+long          WINAPI ff_dshow_filter_Stop           (DShowFilter *);
+long          WINAPI ff_dshow_filter_Pause          (DShowFilter *);
+long          WINAPI ff_dshow_filter_Run            (DShowFilter *, REFERENCE_TIME);
+long          WINAPI ff_dshow_filter_GetState       (DShowFilter *, DWORD, FILTER_STATE *);
+long          WINAPI ff_dshow_filter_SetSyncSource  (DShowFilter *, IReferenceClock *);
+long          WINAPI ff_dshow_filter_GetSyncSource  (DShowFilter *, IReferenceClock **);
+long          WINAPI ff_dshow_filter_EnumPins       (DShowFilter *, IEnumPins **);
+long          WINAPI ff_dshow_filter_FindPin        (DShowFilter *, const wchar_t *, IPin **);
+long          WINAPI ff_dshow_filter_QueryFilterInfo(DShowFilter *, FILTER_INFO *);
+long          WINAPI ff_dshow_filter_JoinFilterGraph(DShowFilter *, IFilterGraph *, const wchar_t *);
+long          WINAPI ff_dshow_filter_QueryVendorInfo(DShowFilter *, wchar_t **);
 
 void                 ff_dshow_filter_Destroy(DShowFilter *);
 DShowFilter         *ff_dshow_filter_Create (void *, void *, enum dshowDeviceType);
diff --git a/libavdevice/dshow_enummediatypes.c b/libavdevice/dshow_enummediatypes.c
index 82944507f6..4cb7057e17 100644
--- a/libavdevice/dshow_enummediatypes.c
+++ b/libavdevice/dshow_enummediatypes.c
@@ -26,7 +26,7 @@ DECLARE_QUERYINTERFACE(enummediatypes, DShowEnumMediaTypes,
 DECLARE_ADDREF(enummediatypes, DShowEnumMediaTypes)
 DECLARE_RELEASE(enummediatypes, DShowEnumMediaTypes)
 
-long ff_dshow_enummediatypes_Next(DShowEnumMediaTypes *this, unsigned long n,
+long WINAPI ff_dshow_enummediatypes_Next(DShowEnumMediaTypes *this, unsigned long n,
                          AM_MEDIA_TYPE **types, unsigned long *fetched)
 {
     int count = 0;
@@ -50,20 +50,20 @@ long ff_dshow_enummediatypes_Next(DShowEnumMediaTypes *this, unsigned long n,
         return S_FALSE;
     return S_OK;
 }
-long ff_dshow_enummediatypes_Skip(DShowEnumMediaTypes *this, unsigned long n)
+long WINAPI ff_dshow_enummediatypes_Skip(DShowEnumMediaTypes *this, unsigned long n)
 {
     dshowdebug("ff_dshow_enummediatypes_Skip(%p)\n", this);
     if (n) /* Any skip will always fall outside of the only valid type. */
         return S_FALSE;
     return S_OK;
 }
-long ff_dshow_enummediatypes_Reset(DShowEnumMediaTypes *this)
+long WINAPI ff_dshow_enummediatypes_Reset(DShowEnumMediaTypes *this)
 {
     dshowdebug("ff_dshow_enummediatypes_Reset(%p)\n", this);
     this->pos = 0;
     return S_OK;
 }
-long ff_dshow_enummediatypes_Clone(DShowEnumMediaTypes *this, DShowEnumMediaTypes **enums)
+long WINAPI ff_dshow_enummediatypes_Clone(DShowEnumMediaTypes *this, DShowEnumMediaTypes **enums)
 {
     DShowEnumMediaTypes *new;
     dshowdebug("ff_dshow_enummediatypes_Clone(%p)\n", this);
diff --git a/libavdevice/dshow_enumpins.c b/libavdevice/dshow_enumpins.c
index 6bf59928f9..759b589ade 100644
--- a/libavdevice/dshow_enumpins.c
+++ b/libavdevice/dshow_enumpins.c
@@ -26,7 +26,7 @@ DECLARE_QUERYINTERFACE(enumpins, DShowEnumPins,
 DECLARE_ADDREF(enumpins, DShowEnumPins)
 DECLARE_RELEASE(enumpins, DShowEnumPins)
 
-long ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
+long WINAPI ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
                    unsigned long *fetched)
 {
     int count = 0;
@@ -45,20 +45,20 @@ long ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
         return S_FALSE;
     return S_OK;
 }
-long ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
+long WINAPI ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
 {
     dshowdebug("ff_dshow_enumpins_Skip(%p)\n", this);
     if (n) /* Any skip will always fall outside of the only valid pin. */
         return S_FALSE;
     return S_OK;
 }
-long ff_dshow_enumpins_Reset(DShowEnumPins *this)
+long WINAPI ff_dshow_enumpins_Reset(DShowEnumPins *this)
 {
     dshowdebug("ff_dshow_enumpins_Reset(%p)\n", this);
     this->pos = 0;
     return S_OK;
 }
-long ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
+long WINAPI ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
 {
     DShowEnumPins *new;
     dshowdebug("ff_dshow_enumpins_Clone(%p)\n", this);
diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c
index 61e057a836..4642ac077c 100644
--- a/libavdevice/dshow_filter.c
+++ b/libavdevice/dshow_filter.c
@@ -26,32 +26,32 @@ DECLARE_QUERYINTERFACE(filter, DShowFilter,
 DECLARE_ADDREF(filter, DShowFilter)
 DECLARE_RELEASE(filter, DShowFilter)
 
-long ff_dshow_filter_GetClassID(DShowFilter *this, CLSID *id)
+long WINAPI ff_dshow_filter_GetClassID(DShowFilter *this, CLSID *id)
 {
     dshowdebug("ff_dshow_filter_GetClassID(%p)\n", this);
     /* I'm not creating a ClassID just for this. */
     return E_FAIL;
 }
-long ff_dshow_filter_Stop(DShowFilter *this)
+long WINAPI ff_dshow_filter_Stop(DShowFilter *this)
 {
     dshowdebug("ff_dshow_filter_Stop(%p)\n", this);
     this->state = State_Stopped;
     return S_OK;
 }
-long ff_dshow_filter_Pause(DShowFilter *this)
+long WINAPI ff_dshow_filter_Pause(DShowFilter *this)
 {
     dshowdebug("ff_dshow_filter_Pause(%p)\n", this);
     this->state = State_Paused;
     return S_OK;
 }
-long ff_dshow_filter_Run(DShowFilter *this, REFERENCE_TIME start)
+long WINAPI ff_dshow_filter_Run(DShowFilter *this, REFERENCE_TIME start)
 {
     dshowdebug("ff_dshow_filter_Run(%p) %"PRId64"\n", this, start);
     this->state = State_Running;
     this->start_time = start;
     return S_OK;
 }
-long ff_dshow_filter_GetState(DShowFilter *this, DWORD ms, FILTER_STATE *state)
+long WINAPI ff_dshow_filter_GetState(DShowFilter *this, DWORD ms, FILTER_STATE *state)
 {
     dshowdebug("ff_dshow_filter_GetState(%p)\n", this);
     if (!state)
@@ -59,7 +59,7 @@ long ff_dshow_filter_GetState(DShowFilter *this, DWORD ms, FILTER_STATE *state)
     *state = this->state;
     return S_OK;
 }
-long ff_dshow_filter_SetSyncSource(DShowFilter *this, IReferenceClock *clock)
+long WINAPI ff_dshow_filter_SetSyncSource(DShowFilter *this, IReferenceClock *clock)
 {
     dshowdebug("ff_dshow_filter_SetSyncSource(%p)\n", this);
 
@@ -73,7 +73,7 @@ long ff_dshow_filter_SetSyncSource(DShowFilter *this, IReferenceClock *clock)
 
     return S_OK;
 }
-long ff_dshow_filter_GetSyncSource(DShowFilter *this, IReferenceClock **clock)
+long WINAPI ff_dshow_filter_GetSyncSource(DShowFilter *this, IReferenceClock **clock)
 {
     dshowdebug("ff_dshow_filter_GetSyncSource(%p)\n", this);
 
@@ -85,7 +85,7 @@ long ff_dshow_filter_GetSyncSource(DShowFilter *this, IReferenceClock **clock)
 
     return S_OK;
 }
-long ff_dshow_filter_EnumPins(DShowFilter *this, IEnumPins **enumpin)
+long WINAPI ff_dshow_filter_EnumPins(DShowFilter *this, IEnumPins **enumpin)
 {
     DShowEnumPins *new;
     dshowdebug("ff_dshow_filter_EnumPins(%p)\n", this);
@@ -99,7 +99,7 @@ long ff_dshow_filter_EnumPins(DShowFilter *this, IEnumPins **enumpin)
     *enumpin = (IEnumPins *) new;
     return S_OK;
 }
-long ff_dshow_filter_FindPin(DShowFilter *this, const wchar_t *id, IPin **pin)
+long WINAPI ff_dshow_filter_FindPin(DShowFilter *this, const wchar_t *id, IPin **pin)
 {
     DShowPin *found = NULL;
     dshowdebug("ff_dshow_filter_FindPin(%p)\n", this);
@@ -116,7 +116,7 @@ long ff_dshow_filter_FindPin(DShowFilter *this, const wchar_t *id, IPin **pin)
 
     return S_OK;
 }
-long ff_dshow_filter_QueryFilterInfo(DShowFilter *this, FILTER_INFO *info)
+long WINAPI ff_dshow_filter_QueryFilterInfo(DShowFilter *this, FILTER_INFO *info)
 {
     dshowdebug("ff_dshow_filter_QueryFilterInfo(%p)\n", this);
 
@@ -128,7 +128,7 @@ long ff_dshow_filter_QueryFilterInfo(DShowFilter *this, FILTER_INFO *info)
 
     return S_OK;
 }
-long ff_dshow_filter_JoinFilterGraph(DShowFilter *this, IFilterGraph *graph,
+long WINAPI ff_dshow_filter_JoinFilterGraph(DShowFilter *this, IFilterGraph *graph,
                             const wchar_t *name)
 {
     dshowdebug("ff_dshow_filter_JoinFilterGraph(%p)\n", this);
@@ -139,7 +139,7 @@ long ff_dshow_filter_JoinFilterGraph(DShowFilter *this, IFilterGraph *graph,
 
     return S_OK;
 }
-long ff_dshow_filter_QueryVendorInfo(DShowFilter *this, wchar_t **info)
+long WINAPI ff_dshow_filter_QueryVendorInfo(DShowFilter *this, wchar_t **info)
 {
     dshowdebug("ff_dshow_filter_QueryVendorInfo(%p)\n", this);
 
diff --git a/libavdevice/dshow_pin.c b/libavdevice/dshow_pin.c
index 2d1fa0e882..f846b68918 100644
--- a/libavdevice/dshow_pin.c
+++ b/libavdevice/dshow_pin.c
@@ -29,13 +29,13 @@ DECLARE_QUERYINTERFACE(pin, DShowPin,
 DECLARE_ADDREF(pin, DShowPin)
 DECLARE_RELEASE(pin, DShowPin)
 
-long ff_dshow_pin_Connect(DShowPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
+long WINAPI ff_dshow_pin_Connect(DShowPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
 {
     dshowdebug("ff_dshow_pin_Connect(%p, %p, %p)\n", this, pin, type);
     /* Input pins receive connections. */
     return S_FALSE;
 }
-long ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin,
+long WINAPI ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin,
                            const AM_MEDIA_TYPE *type)
 {
     enum dshowDeviceType devtype = this->filter->type;
@@ -62,7 +62,7 @@ long ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin,
 
     return S_OK;
 }
-long ff_dshow_pin_Disconnect(DShowPin *this)
+long WINAPI ff_dshow_pin_Disconnect(DShowPin *this)
 {
     dshowdebug("ff_dshow_pin_Disconnect(%p)\n", this);
 
@@ -75,7 +75,7 @@ long ff_dshow_pin_Disconnect(DShowPin *this)
 
     return S_OK;
 }
-long ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
+long WINAPI ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
 {
     dshowdebug("ff_dshow_pin_ConnectedTo(%p)\n", this);
 
@@ -88,7 +88,7 @@ long ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
 
     return S_OK;
 }
-long ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
+long WINAPI ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
 {
     dshowdebug("ff_dshow_pin_ConnectionMediaType(%p)\n", this);
 
@@ -99,7 +99,7 @@ long ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
 
     return ff_copy_dshow_media_type(type, &this->type);
 }
-long ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
+long WINAPI ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
 {
     dshowdebug("ff_dshow_pin_QueryPinInfo(%p)\n", this);
 
@@ -115,7 +115,7 @@ long ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
 
     return S_OK;
 }
-long ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
+long WINAPI ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
 {
     dshowdebug("ff_dshow_pin_QueryDirection(%p)\n", this);
     if (!dir)
@@ -123,7 +123,7 @@ long ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
     *dir = PINDIR_INPUT;
     return S_OK;
 }
-long ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
+long WINAPI ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
 {
     dshowdebug("ff_dshow_pin_QueryId(%p)\n", this);
 
@@ -134,12 +134,12 @@ long ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
 
     return S_OK;
 }
-long ff_dshow_pin_QueryAccept(DShowPin *this, const AM_MEDIA_TYPE *type)
+long WINAPI ff_dshow_pin_QueryAccept(DShowPin *this, const AM_MEDIA_TYPE *type)
 {
     dshowdebug("ff_dshow_pin_QueryAccept(%p)\n", this);
     return S_FALSE;
 }
-long ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
+long WINAPI ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
 {
     const AM_MEDIA_TYPE *type = NULL;
     DShowEnumMediaTypes *new;
@@ -154,31 +154,31 @@ long ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
     *enumtypes = (IEnumMediaTypes *) new;
     return S_OK;
 }
-long ff_dshow_pin_QueryInternalConnections(DShowPin *this, IPin **pin,
+long WINAPI ff_dshow_pin_QueryInternalConnections(DShowPin *this, IPin **pin,
                                   unsigned long *npin)
 {
     dshowdebug("ff_dshow_pin_QueryInternalConnections(%p)\n", this);
     return E_NOTIMPL;
 }
-long ff_dshow_pin_EndOfStream(DShowPin *this)
+long WINAPI ff_dshow_pin_EndOfStream(DShowPin *this)
 {
     dshowdebug("ff_dshow_pin_EndOfStream(%p)\n", this);
     /* I don't care. */
     return S_OK;
 }
-long ff_dshow_pin_BeginFlush(DShowPin *this)
+long WINAPI ff_dshow_pin_BeginFlush(DShowPin *this)
 {
     dshowdebug("ff_dshow_pin_BeginFlush(%p)\n", this);
     /* I don't care. */
     return S_OK;
 }
-long ff_dshow_pin_EndFlush(DShowPin *this)
+long WINAPI ff_dshow_pin_EndFlush(DShowPin *this)
 {
     dshowdebug("ff_dshow_pin_EndFlush(%p)\n", this);
     /* I don't care. */
     return S_OK;
 }
-long ff_dshow_pin_NewSegment(DShowPin *this, REFERENCE_TIME start, REFERENCE_TIME stop,
+long WINAPI ff_dshow_pin_NewSegment(DShowPin *this, REFERENCE_TIME start, REFERENCE_TIME stop,
                     double rate)
 {
     dshowdebug("ff_dshow_pin_NewSegment(%p)\n", this);
@@ -250,43 +250,43 @@ DECLARE_DESTROY(pin, DShowPin, ff_dshow_pin_Free)
 /*****************************************************************************
  * DShowMemInputPin
  ****************************************************************************/
-long ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *this, const GUID *riid,
+long WINAPI ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *this, const GUID *riid,
                                 void **ppvObject)
 {
     DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
     dshowdebug("ff_dshow_meminputpin_QueryInterface(%p)\n", this);
     return ff_dshow_pin_QueryInterface(pin, riid, ppvObject);
 }
-unsigned long ff_dshow_meminputpin_AddRef(DShowMemInputPin *this)
+unsigned long WINAPI ff_dshow_meminputpin_AddRef(DShowMemInputPin *this)
 {
     DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
     dshowdebug("ff_dshow_meminputpin_AddRef(%p)\n", this);
     return ff_dshow_pin_AddRef(pin);
 }
-unsigned long ff_dshow_meminputpin_Release(DShowMemInputPin *this)
+unsigned long WINAPI ff_dshow_meminputpin_Release(DShowMemInputPin *this)
 {
     DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
     dshowdebug("ff_dshow_meminputpin_Release(%p)\n", this);
     return ff_dshow_pin_Release(pin);
 }
-long ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *this, IMemAllocator **alloc)
+long WINAPI ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *this, IMemAllocator **alloc)
 {
     dshowdebug("ff_dshow_meminputpin_GetAllocator(%p)\n", this);
     return VFW_E_NO_ALLOCATOR;
 }
-long ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *this, IMemAllocator *alloc,
+long WINAPI ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *this, IMemAllocator *alloc,
                                  BOOL rdwr)
 {
     dshowdebug("ff_dshow_meminputpin_NotifyAllocator(%p)\n", this);
     return S_OK;
 }
-long ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *this,
+long WINAPI ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *this,
                                           ALLOCATOR_PROPERTIES *props)
 {
     dshowdebug("ff_dshow_meminputpin_GetAllocatorRequirements(%p)\n", this);
     return E_NOTIMPL;
 }
-long ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
+long WINAPI ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
 {
     DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
     enum dshowDeviceType devtype = pin->filter->type;
@@ -354,7 +354,7 @@ long ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
 
     return S_OK;
 }
-long ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this,
+long WINAPI ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this,
                                  IMediaSample **samples, long n, long *nproc)
 {
     int i;
@@ -366,7 +366,7 @@ long ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this,
     *nproc = n;
     return S_OK;
 }
-long ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *this)
+long WINAPI ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *this)
 {
     dshowdebug("ff_dshow_meminputpin_ReceiveCanBlock(%p)\n", this);
     /* I swear I will not block. */
-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [FFmpeg-devel] [PATCH v2 4/5] avdevice/dshow: only set pin format if wanted
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
                   ` (2 preceding siblings ...)
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 3/5] avdevice/dshow: fix crash on x86 Diederick Niehorster
@ 2022-01-02  9:49 ` Diederick Niehorster
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 5/5] avdevice/dshow: ensure pin's default format is set Diederick Niehorster
  2022-01-03 23:32 ` [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Roger Pack
  5 siblings, 0 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/dshow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 4b6887881d..f2d95fa470 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -1046,7 +1046,7 @@ next:
     // format based on the VIDEOINFOHEADER format.
     // NB: this never applies to an audio format because
     // previous_match_type always NULL in that case
-    if (!format_set && previous_match_type) {
+    if (pformat_set && !format_set && previous_match_type) {
         if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK)
             format_set = 1;
     }
-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [FFmpeg-devel] [PATCH v2 5/5] avdevice/dshow: ensure pin's default format is set
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
                   ` (3 preceding siblings ...)
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 4/5] avdevice/dshow: only set pin format if wanted Diederick Niehorster
@ 2022-01-02  9:49 ` Diederick Niehorster
  2022-01-03 23:32 ` [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Roger Pack
  5 siblings, 0 replies; 12+ messages in thread
From: Diederick Niehorster @ 2022-01-02  9:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Diederick Niehorster

Fixes regression in a1c4929f: there apparently are devices out there
that expose a pin default format that has parameters outside the
capabilities of any of the formats exposed on the pin (sic?). The
VirtualCam plugin (v 2.0.5) of OBS-Studio (v 27.1.3) is such a device.
Now when a default format was found, but not selected when iterating all
formats, fall back to directly setting the default format.

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
---
 libavdevice/dshow.c | 88 +++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 34 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index f2d95fa470..a435ae1807 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -758,6 +758,31 @@ static struct dshow_format_info *dshow_get_format_info(AM_MEDIA_TYPE *type)
     return fmt_info;
 }
 
+static void dshow_get_default_format(IPin *pin, IAMStreamConfig *config, enum dshowDeviceType devtype, AM_MEDIA_TYPE **type)
+{
+    HRESULT hr;
+
+    if ((hr = IAMStreamConfig_GetFormat(config, type)) != S_OK) {
+        if (hr == E_NOTIMPL || !IsEqualGUID(&(*type)->majortype, devtype == VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) {
+            // default not available or of wrong type,
+            // fall back to iterating exposed formats
+            // until one of the right type is found
+            IEnumMediaTypes* types = NULL;
+            if (IPin_EnumMediaTypes(pin, &types) != S_OK)
+                return;
+            IEnumMediaTypes_Reset(types);
+            while (IEnumMediaTypes_Next(types, 1, type, NULL) == S_OK) {
+                if (IsEqualGUID(&(*type)->majortype, devtype == VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) {
+                    break;
+                }
+                CoTaskMemFree(*type);
+                *type = NULL;
+            }
+            IEnumMediaTypes_Release(types);
+        }
+    }
+}
+
 /**
  * Cycle through available formats available from the specified pin,
  * try to set parameters specified through AVOptions, or the pin's
@@ -813,32 +838,11 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
     use_default = !dshow_should_set_format(avctx, devtype);
     if (use_default && pformat_set)
     {
-        HRESULT hr;
-
         // get default
-        if ((hr = IAMStreamConfig_GetFormat(config, &type)) != S_OK) {
-            if (hr == E_NOTIMPL || !IsEqualGUID(&type->majortype, devtype==VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) {
-                // default not available or of wrong type,
-                // fall back to iterating exposed formats
-                // until one of the right type is found
-                IEnumMediaTypes *types = NULL;
-                if (IPin_EnumMediaTypes(pin, &types) != S_OK)
-                    goto end;
-                IEnumMediaTypes_Reset(types);
-                while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK) {
-                    if (IsEqualGUID(&type->majortype, devtype==VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) {
-                        break;
-                    }
-                    CoTaskMemFree(type);
-                    type = NULL;
-                }
-                IEnumMediaTypes_Release(types);
-            }
-
-            if (!type)
-                // this pin does not expose any formats of the expected type
-                goto end;
-        }
+        dshow_get_default_format(pin, config, devtype, &type);
+        if (!type)
+            // this pin does not expose any formats of the expected type
+            goto end;
 
         if (type) {
             // interrogate default format, so we know what to search for below
@@ -1040,15 +1044,31 @@ next:
         CoTaskMemFree(type);
         type = NULL;
     }
-    // previously found a matching VIDEOINFOHEADER format and stored
-    // it for safe keeping. Searching further for a matching
-    // VIDEOINFOHEADER2 format yielded nothing. So set the pin's
-    // format based on the VIDEOINFOHEADER format.
-    // NB: this never applies to an audio format because
-    // previous_match_type always NULL in that case
-    if (pformat_set && !format_set && previous_match_type) {
-        if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK)
-            format_set = 1;
+
+    // set the pin's format, if wanted
+    if (pformat_set && !format_set) {
+        if (previous_match_type) {
+            // previously found a matching VIDEOINFOHEADER format and stored
+            // it for safe keeping. Searching further for a matching
+            // VIDEOINFOHEADER2 format yielded nothing. So set the pin's
+            // format based on the VIDEOINFOHEADER format.
+            // NB: this never applies to an audio format because
+            // previous_match_type always NULL in that case
+            if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK)
+                format_set = 1;
+        }
+        else if (use_default) {
+            // default format returned by device apparently was not contained
+            // in the capabilities of any of the formats returned by the device
+            // (sic?). Fall back to directly setting the default format
+            dshow_get_default_format(pin, config, devtype, &type);
+            if (IAMStreamConfig_SetFormat(config, type) == S_OK)
+                format_set = 1;
+            if (type && type->pbFormat)
+                CoTaskMemFree(type->pbFormat);
+            CoTaskMemFree(type);
+            type = NULL;
+        }
     }
 
 end:
-- 
2.28.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
                   ` (4 preceding siblings ...)
  2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 5/5] avdevice/dshow: ensure pin's default format is set Diederick Niehorster
@ 2022-01-03 23:32 ` Roger Pack
  2022-01-04  4:10   ` Gyan Doshi
  5 siblings, 1 reply; 12+ messages in thread
From: Roger Pack @ 2022-01-03 23:32 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Diederick Niehorster

These LGTM.  Feel free to add yourself as a dshow maintainer if so
interested, as well! :)

On Sun, Jan 2, 2022 at 2:50 AM Diederick Niehorster <dcnieho@gmail.com> wrote:
>
> These five patches fix two regressions (one crashing bug making dshow
> unusable on x86, and one regression introduced by my recent patches due
> to which devices that seem to not behave according to spec but worked
> fine before my patches could no longer be used.
> They furthermore fix three small issues i found looking through the dshow code: 2x needed cleanup not being done, and one where to skip setting format for a pin when its useless.
>
> new in v2 is fixing of the x86 crash
>
> Diederick Niehorster (5):
>   avdevice/dshow: tv_tuner_audio_dialog cleanup missing
>   avdevice/dshow: proper cleanup of queried media types
>   avdevice/dshow: fix crash on x86
>   avdevice/dshow: only set pin format if wanted
>   avdevice/dshow: ensure pin's default format is set
>
>  libavdevice/dshow.c                |  93 +++++++++++++---------
>  libavdevice/dshow_capture.h        | 120 ++++++++++++++---------------
>  libavdevice/dshow_crossbar.c       |   4 +
>  libavdevice/dshow_enummediatypes.c |   8 +-
>  libavdevice/dshow_enumpins.c       |   8 +-
>  libavdevice/dshow_filter.c         |  24 +++---
>  libavdevice/dshow_pin.c            |  48 ++++++------
>  7 files changed, 165 insertions(+), 140 deletions(-)
>
> --
> 2.28.0.windows.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-03 23:32 ` [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Roger Pack
@ 2022-01-04  4:10   ` Gyan Doshi
  2022-01-04 10:36     ` Diederick C. Niehorster
  0 siblings, 1 reply; 12+ messages in thread
From: Gyan Doshi @ 2022-01-04  4:10 UTC (permalink / raw)
  To: ffmpeg-devel



On 2022-01-04 05:02 am, Roger Pack wrote:
> These LGTM.  Feel free to add yourself as a dshow maintainer if so
> interested, as well! :)

I assume these need to be pushed too.

Gyan

>
> On Sun, Jan 2, 2022 at 2:50 AM Diederick Niehorster <dcnieho@gmail.com> wrote:
>> These five patches fix two regressions (one crashing bug making dshow
>> unusable on x86, and one regression introduced by my recent patches due
>> to which devices that seem to not behave according to spec but worked
>> fine before my patches could no longer be used.
>> They furthermore fix three small issues i found looking through the dshow code: 2x needed cleanup not being done, and one where to skip setting format for a pin when its useless.
>>
>> new in v2 is fixing of the x86 crash
>>
>> Diederick Niehorster (5):
>>    avdevice/dshow: tv_tuner_audio_dialog cleanup missing
>>    avdevice/dshow: proper cleanup of queried media types
>>    avdevice/dshow: fix crash on x86
>>    avdevice/dshow: only set pin format if wanted
>>    avdevice/dshow: ensure pin's default format is set
>>
>>   libavdevice/dshow.c                |  93 +++++++++++++---------
>>   libavdevice/dshow_capture.h        | 120 ++++++++++++++---------------
>>   libavdevice/dshow_crossbar.c       |   4 +
>>   libavdevice/dshow_enummediatypes.c |   8 +-
>>   libavdevice/dshow_enumpins.c       |   8 +-
>>   libavdevice/dshow_filter.c         |  24 +++---
>>   libavdevice/dshow_pin.c            |  48 ++++++------
>>   7 files changed, 165 insertions(+), 140 deletions(-)
>>
>> --
>> 2.28.0.windows.1
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-04  4:10   ` Gyan Doshi
@ 2022-01-04 10:36     ` Diederick C. Niehorster
  2022-01-04 12:05       ` Gyan Doshi
  0 siblings, 1 reply; 12+ messages in thread
From: Diederick C. Niehorster @ 2022-01-04 10:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi <ffmpeg@gyani.pro> wrote:
> On 2022-01-04 05:02 am, Roger Pack wrote:
> > These LGTM.  Feel free to add yourself as a dshow maintainer if so
> > interested, as well! :)
>
> I assume these need to be pushed too.

Yes thanks, please push. Would be good to get in before the release
branch, fixing the regressions.

Thanks!
Dee
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-04 10:36     ` Diederick C. Niehorster
@ 2022-01-04 12:05       ` Gyan Doshi
  2022-01-04 16:28         ` Diederick C. Niehorster
  0 siblings, 1 reply; 12+ messages in thread
From: Gyan Doshi @ 2022-01-04 12:05 UTC (permalink / raw)
  To: ffmpeg-devel



On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:
> On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>> On 2022-01-04 05:02 am, Roger Pack wrote:
>>> These LGTM.  Feel free to add yourself as a dshow maintainer if so
>>> interested, as well! :)
>> I assume these need to be pushed too.
> Yes thanks, please push. Would be good to get in before the release
> branch, fixing the regressions.

Too late for that. But I will backport to 5.0

Regards,
Gyan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-04 12:05       ` Gyan Doshi
@ 2022-01-04 16:28         ` Diederick C. Niehorster
  2022-01-04 17:12           ` Gyan Doshi
  0 siblings, 1 reply; 12+ messages in thread
From: Diederick C. Niehorster @ 2022-01-04 16:28 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi Gyan,

On Tue, Jan 4, 2022 at 1:05 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>
> On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:
> > On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi <ffmpeg@gyani.pro> wrote:
> >> On 2022-01-04 05:02 am, Roger Pack wrote:
> >>> These LGTM.  Feel free to add yourself as a dshow maintainer if so
> >>> interested, as well! :)
> >> I assume these need to be pushed too.
> > Yes thanks, please push. Would be good to get in before the release
> > branch, fixing the regressions.
>
> Too late for that. But I will backport to 5.0

Super! Its still on time for the actual release, thats what matters.

Thanks and cheers,
Dee
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups
  2022-01-04 16:28         ` Diederick C. Niehorster
@ 2022-01-04 17:12           ` Gyan Doshi
  0 siblings, 0 replies; 12+ messages in thread
From: Gyan Doshi @ 2022-01-04 17:12 UTC (permalink / raw)
  To: ffmpeg-devel



On 2022-01-04 09:58 pm, Diederick C. Niehorster wrote:
> Hi Gyan,
>
> On Tue, Jan 4, 2022 at 1:05 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>> On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:
>>> On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>>>> On 2022-01-04 05:02 am, Roger Pack wrote:
>>>>> These LGTM.  Feel free to add yourself as a dshow maintainer if so
>>>>> interested, as well! :)
>>>> I assume these need to be pushed too.
>>> Yes thanks, please push. Would be good to get in before the release
>>> branch, fixing the regressions.
>> Too late for that. But I will backport to 5.0
> Super! Its still on time for the actual release, thats what matters.

Done in both master and release/5.0

Pushed to master as 
d1f7700133312929d64aaa69ab3a08b5ae171390...e84d8ba44141b55f2b28e0ad3b597d2e7d422336

Regards,
Gyan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-01-04 17:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-02  9:49 [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Diederick Niehorster
2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 1/5] avdevice/dshow: tv_tuner_audio_dialog cleanup missing Diederick Niehorster
2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 2/5] avdevice/dshow: proper cleanup of queried media types Diederick Niehorster
2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 3/5] avdevice/dshow: fix crash on x86 Diederick Niehorster
2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 4/5] avdevice/dshow: only set pin format if wanted Diederick Niehorster
2022-01-02  9:49 ` [FFmpeg-devel] [PATCH v2 5/5] avdevice/dshow: ensure pin's default format is set Diederick Niehorster
2022-01-03 23:32 ` [FFmpeg-devel] [PATCH v2 0/5] avdevice/dshow fixups Roger Pack
2022-01-04  4:10   ` Gyan Doshi
2022-01-04 10:36     ` Diederick C. Niehorster
2022-01-04 12:05       ` Gyan Doshi
2022-01-04 16:28         ` Diederick C. Niehorster
2022-01-04 17:12           ` Gyan Doshi

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git