summaryrefslogtreecommitdiff
path: root/libavdevice
Commit message (Collapse)AuthorAge
...
* avdevice/dshow: fix crash on x86Diederick Niehorster2022-01-04
| | | | | | | | | | | 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> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: proper cleanup of queried media typesDiederick Niehorster2022-01-04
| | | | | Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: tv_tuner_audio_dialog cleanup missingDiederick Niehorster2022-01-04
| | | | | | | | Cleanup was missing for when the show_analog_tv_tuner_audio_dialog is true. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* Makefile: Redo duplicating object files in shared buildsAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of shared builds, some object files containing tables are currently duplicated into other libraries: log2_tab.c, golomb.c, reverse.c. The check for whether this is duplicated is simply whether CONFIG_SHARED is true. Yet this is crude: E.g. libavdevice includes reverse.c for shared builds, but only needs it for the decklink input device, which given that decklink is not enabled by default will be unused in most libavdevice.so. This commit changes this by making it more explicit about what to duplicate from other libraries. To do this, two new Makefile variables were added: SHLIBOBJS and STLIBOBJS. SHLIBOBJS contains the objects that are duplicated from other libraries in case of shared builds; STLIBOBJS contains stuff that a library has to provide for other libraries in case of static builds. These new variables provide a way to enable/disable with a finer granularity than just whether shared builds are enabled or not. E.g. lavd's Makefile now contains: SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o Another example is provided by the golomb tables. These are provided by lavc for static builds, even if one uses a build configuration that makes only lavf use them. Therefore lavc's Makefile contains STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o, whereas lavf's Makefile has a corresponding SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o. E.g. in case the MXF muxer is the only component needing these tables only libavformat.so will contain them for shared builds; currently libavcodec.so does so, too. (There is currently a CONFIG_EXTRA group for golomb. But actually one would need two groups (golomb_avcodec and golomb_avformat) in order to know when and where to include these tables. Therefore this commit uses a Makefile-based approach for this and stops using these groups for the users in libavformat.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lib*/version.h: Bump Versions after release/5.0 branchMichael Niedermayer2022-01-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lib*/version.h: Bump Versions before release/5.0 branchMichael Niedermayer2022-01-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice/dshow: don't mix declarations and codeJames Almer2021-12-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: remove unused variablesJames Almer2021-12-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: select format with extended color infoDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | | | | | | | Some DirectShow devices (Logitech C920 webcam) expose each DirectShow format they support twice, once without and once with extended color information. During format selection, both match, this patch ensures that the format with extended color information is selected if it is available, else it falls back to a matching format without such information. This also necessitated a new code path taken for default formats of a device (when user didn't request any specific video size, etc), because the default format may be one without extended color information when a twin with extended color information is also available. Getting the extended color information when available is important as it allows setting the color space, range, primaries, transfer characteristics and chroma location of the stream provided by dshow, enabling users to get more correct color automatically out of their device. Closes: #9271 Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: discover source color range/space/etcDiederick Niehorster2021-12-24
| | | | | | | | | | Enabled discovering a DirectShow device's color range, space, primaries, transfer characteristics and chroma location, if the device exposes that information. Sets them in the stream's codecpars. Co-authored-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com> Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: add media type info to get_device_listDiederick Niehorster2021-12-24
| | | | | | | | The list returned by get_device_list now contains info about what media type(s), if any, can be provided by each device. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice: add info about media types(s) to AVDeviceInfoDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | An avdevice, regardless of whether its category says its an audio or video device, may provide access to devices providing different media types, or even single devices providing multiple media types. Also, some devices may provide no media types. dshow is an example encompassing all of these cases. Users should be provided with this information, so AVDeviceInfo is extended to provide it. Bump avdevice version Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: list_devices: show media type(s) per deviceDiederick Niehorster2021-12-24
| | | | | | | | | | | | the list_devices option of dshow didn't indicate whether a specific device provides audio or video output. This patch iterates through all media formats of all pins exposed by the device to see what types it provides for capture, and prints this to the console for each device. Importantly, this now allows to find devices that provide both audio and video, and devices that provide neither. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: implement get_device_listDiederick Niehorster2021-12-24
| | | | | | | Needed to enable programmatic discovery of DirectShow devices Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: set no-seek flagsDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | avdevice/dshow is a realtime device and as such does not support seeking. Therefore, its demuxer format should define the AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH and AVFMT_NO_BYTE_SEEK flags. With these flags set, attempting to seek (with, e.g., avformat_seek_file()) correctly yields -1 (operation not permitted) instead of -22 (invalid argument). This actually seems to apply to many other devices, at least the gdigrab, v4l2, vfwcap, x11grab, fbdev, kmsgrab and android_camera devices, from reading the source. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: handle unknown sample timeDiederick Niehorster2021-12-24
| | | | | | | | | | | | | GetTime may return an error indication that the sample has not timestamps, or may return a NULL start time. In those cases, fall back to graph time. Emit log when that happens. Improve logging in the frame receive function: now logged against correct avclass instead of NULL. Better debug message in case sample dropped: could now be audio or video frame. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: query graph and sample time only onceDiederick Niehorster2021-12-24
| | | | | | | | No need to query twice, use value we've already unconditionally got. Improve variable names Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: implement option to use device video timestampsDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | | | | | | The dshow avdevice ignores timestamps for video frames provided by the DirectShow device, instead using wallclock time, apparently because the implementer of this code had a device that provided unreliable timestamps. Me (and others) would like to use the device's timestamps. The new use_video_device_timestamps option for dshow device enables them to do so. Since the majority of video devices out there probably provide fine timestamps, this patch sets the default to using the device timestamps, which means best fidelity timestamps are used by default. Using the new option, the user can switch this off and revert to the old behavior, so a fall back remains available in case the device provides broken timestamps. add use_video_device_timestamps to docs. Closes: #8620 Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: prevent NULL accessDiederick Niehorster2021-12-24
| | | | | | | | | list_options true would crash when both a video and an audio device were specified as input. Crash would occur on line 784 because ctx->device_unique_name[otherDevType] would be NULL Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* lavd/v4l2: detect device name truncationAnton Khirnov2021-12-07
| | | | | | | | | | | | | | | | Silences the following warning with gcc 10: src/libavdevice/v4l2.c: In function ‘v4l2_get_device_list’: src/libavdevice/v4l2.c:1042:64: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 251 [-Wformat-truncation=] 1042 | ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name); | ^~ src/libavdevice/v4l2.c:1042:15: note: ‘snprintf’ output between 6 and 261 bytes into a destination of size 256 1042 | ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Previous patches intending to silence it have proposed increasing the buffer size, but doing that correctly seems to be tricky. Failing on truncation is simpler and just as effective (as excessively long device names are unlikely).
* lavd/v4l2: reduce variable scopeAnton Khirnov2021-12-07
| | | | | | device and cap are local to the loop iteration, there is no need for them to retain their values. Especially for device it may be dangerous, since it points to av_malloc'ed data.
* lavd/v4l2: do not clobber the context FD in v4l2_get_device_list()Anton Khirnov2021-12-07
| | | | | | The FD opened here is local to the loop iteration, there is no reason to store it in the context. Since read_header() may have already been called, this may ovewrite an existing valid FD.
* lavd/jack: increase buffer size for snprintf()Anton Khirnov2021-12-07
| | | | | | | | | | | | | | Maximum output size with a 32-bit int is 17 bytes, or 26 with a 64-bit int. Silences the following gcc 10 warning: src/libavdevice/jack.c: In function ‘audio_read_header’: src/libavdevice/jack.c:171:45: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] 171 | snprintf(str, sizeof(str), "input_%d", i + 1); | ^ src/libavdevice/jack.c:171:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size 16 171 | snprintf(str, sizeof(str), "input_%d", i + 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* avdevice/lavfi: Don't require AV_PIX_FMT_NONE == -1Andreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Simplify setting sample_fmtsAndreas Rheinhardt2021-12-03
| | | | | | | | | The length of this list is a compile-time constant, so there is no need to calculate it again at runtime. (This also avoids an implicit requirement of -1 == AV_SAMPLE_FMT_NONE.) Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Make array static constAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Avoid calling av_buffersink_get_* multiple timesAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Use dedicated pointer to access st->codecparAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Don't unnecessarily write '\0' to AVBPrintAndreas Rheinhardt2021-12-03
| | | | | | | | | An AVBPrint's internal string is always already zero-terminated; writing another '\0' is unnecessary as long as one treats the string only as a C-string. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Properly free an AVDictionaryAndreas Rheinhardt2021-12-03
| | | | | | | | It is not documented that freeing the last (and only) entry of an AVDictionary frees the dictionary. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/lavfi: Cleanup generically on read_header failureAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* av(codec|device): Don't cast pointers to intAndreas Rheinhardt2021-11-21
| | | | | | | | | | C99/C11 6.3.2.3 5: "Any pointer type may be converted to an integer type. [...] If the result cannot be represented in the integer type, the behavior is undefined." So stop casting pointers to int; use uintptr_t instead. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* */version.h: define FF_API macros unconditionallyAnton Khirnov2021-11-15
| | | | | | | There is no reason to wrap them in #ifndef guards, they should only be defined here and nowhere else. The define guards just add the possibility to accidentally use the same FF_API name in different libraries.
* avdevice/dshow: fix a unused variable warningJames Almer2021-11-13
| | | | | | | Unused if DSHOWDEBUG is not set since commit d9a9b4c877b85fea5a5bad74c3d592a756047f79. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: fix print format for some variablesJames Almer2021-11-13
| | | | | | | WAVEFORMATEX.nChannels and WAVEFORMATEX.wBitsPerSample are of type WORD, aka unsigned short. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: Fix missing PCM sample size option when it is used as the ↵Brad Isbell2021-11-05
| | | | | | | | lone option for DirectShow audio capture Signed-off-by: Brad Isbell <brad@audiopump.co> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice/dshow: Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device ↵Brad Isbell2021-11-05
| | | | | | | | capabilities. (Fixes #9420) Signed-off-by: Brad Isbell <brad@audiopump.co> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice/caca: Don't free AVOpt-enabled string manuallyAndreas Rheinhardt2021-10-09
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/caca: Make deinit function out of write_trailerAndreas Rheinhardt2021-10-09
| | | | | | | Fixes memleaks in case the trailer is never written. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/xv: Increase array sizeAndreas Rheinhardt2021-10-09
| | | | | | | | | | | | | av_image_copy() expects an array of four pointers according to its declaration; although it currently only touches pointers that are actually in use (depending upon the pixel format) this might change at any time (as has already happened for the linesizes in d7bc52bf456deba0f32d9fe5c288ec441f1ebef5). This fixes ticket #9264 as well as a warning from GCC 11. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavdevice/avfoundation.m: fix potential unreleased lock issueChengfeng Ye2021-09-17
| | | | | | | | | The problem here is that the lock ctx->frame_lock will become an unreleased lock if the program returns at patched lines. Bug tracker link: https://trac.ffmpeg.org/ticket/9386\#ticket Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
* libavdevice/avfoundation.m: fix protential unreleased lock issueChengfeng Ye2021-09-17
| | | | | | | | | | The problem here is that the lock ctx->frame_lock will become an unreleased lock if the program returns at line 697, line 735 and line744. Bug tracker link: https://trac.ffmpeg.org/ticket/9385\#ticket Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
* avdevice/decklink: support for more duplex mode for Decklink 8K ProLimin Wang2021-08-16
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avdevice/decklink: add level_a configuration optionLimin Wang2021-08-16
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avdevice/decklink: add sqd configuration optionLimin Wang2021-08-16
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avdevice/decklink: add link configuration optionLimin Wang2021-08-16
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* lavd/lavfi.c: Set time_base for 608 cc to container time_base.Yun Zhang2021-08-02
| | | | Suggested-By: ffmpeg@fb.com
* avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.hAndreas Rheinhardt2021-07-29
| | | | | | | | | | | | | It only uses an AVIOContext and an AVBPrint. When doing so, it turned out that several non-users of ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata() relied on libavformat/internal.h to include bprint.h or avstring.h for them. In order to avoid a repeat of this and in order to reduce unnecessary dependencies, a forward declaration of struct AVBPrint is used instead of including bprint.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove/replace some unnecessary avcodec.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | Also remove other unnecessary headers and include headers directly while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>