Commit Graph

97 Commits

Author SHA1 Message Date
James Almer 20dade27d9 fftools/ffprobe: print crop_* frame fields
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-26 16:39:59 -03:00
James Almer 6ee6dd93eb fftools/ffprobe: add support for HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-25 13:27:20 -03:00
Anton Khirnov e6126abc69 fftools/ffprobe: stop using AVFrame.pkt_{pos,size}
These fields are ad-hoc and will be deprecated. Use the recently-added
AV_CODEC_FLAG_COPY_OPAQUE to pass arbitrary user data from packets to
frames.

Changes the result of the flcl1905 test, which uses ffprobe to decode
wmav2 with multiple frames per packet. Such packets are handled
internally by calling the decoder's decode callback multiple times,
offsetting the internal packet's data pointer and decreasing its size
after each call. The output pkt_size value before this commit is then
the remaining internal packet size at the time of each internal decode
call.

After this commit, output pkt_size is simply the size of the full packet
submitted by the caller to the decoder. This is more correct, since
internal packets are never seen by the caller and should have no
observable outside effects.
2023-03-20 10:42:09 +01:00
Zhao Zhili 13deb775cf fftools/ffprobe: fix print_dynamic_hdr_vivid
Don't print tone_mapping_param_num if tone_mapping_mode_flag is
disabled.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-03-17 18:52:36 +08:00
Zhao Zhili 8de8f1df77 fftools/ffprobe: fix HDR vivid info
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-03-17 18:52:31 +08:00
Marton Balint 2296078397 avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number
Their usefulness is questionable, very few decoders set them, and their type
should have been int64_t. A replacement field can be added later if a valid use
case is found.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:37:50 +01:00
James Almer 0a95e4af99 avutil/version: postpone the remaining API deprecations
They are too recent.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
Andreas Rheinhardt 868a31b42d avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
rcombs 18cd65998b ffprobe: report the corrupt flag on packets
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 12:45:53 +01:00
Stefano Sabatini 843a446713 ffprobe: fix data hash rendering
Print data hash before side data list, fix wrong nesting level of data hash
element.

In particular, fix trac issue:
http://trac.ffmpeg.org/ticket/7217
2023-01-24 23:58:00 +01:00
Stefano Sabatini b6219c9114 ffprobe: use pkt->dts to compute interval ts when pts is missing
For some samples the pkt->pts is always missing, use the pkt->dts
instead.

Fix trac issue:
http://trac.ffmpeg.org/ticket/4427
2023-01-24 23:58:00 +01:00
Jan Ekström be76a9bd32 ffprobe: expose AVAmbientViewingEnvironment side data in AVFrames 2023-01-13 21:26:27 +02:00
Zhao Zhili 244f3cfbe3 fftools/ffprobe: prefer fd over pipe for seek support
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Marvin Scholz f1907faab4 fftools: use av_dict_iterate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:21:14 +01:00
James Almer b119b3da1e fftools/ffprobe: support 2D arrays in print_list_fmt()
Should fix undefined behavior.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-15 23:18:48 -03:00
Derek Buitenhuis d1366c4167 fftools/ffprobe: Loop over correct number of streams when flushing decoders
Some formats like FLV can dynamically add streams during packet reading.
FFprobe does check for this and reallocates the global stream info, but does
not reallocate InputFrame's streams and decoders when this happens, which,
as a result, could have caused flushing to occur on an out of bounds stream
index, since the flush loop iterates over fmt_ctx's nb_streams, and not
ifile's, despite using ifile's streams.

This fixes an out of bounds read and segfult.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-11-07 16:13:45 +00:00
Marvin Scholz 88635c7f95 fftools/ffprobe: Use av_err2str
av_err2str which is a wrapper for av_strerror already calls
strerror_r if available and if not has a fallback for the other
error codes that would be handled by that, so manually calling
strerror again if it fails is not necessary.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-14 12:19:13 +02:00
Derek Buitenhuis f5cd00bf52 ffprobe: Check for invalid matrix error when printing rotation
av_display_rotation_get will return NAN when the display matrix is invalid,
which would end up printing NAN as an integer in the rotation field. This
is poor for multiple reasons:

* Users of ffprobe have no way of discerning "valid but ugly rotation from
  display matrix" from "invalid display matrix".
* It can have unintended consequences on some platforms, such as Linux x86_64,
  where NAN is equal to INT64_MIN, which, for example, when printed as JSON,
  which uses floating point for all numbers, can end up as invalid JSON or wit
  a number that cannot be reserialized as an integer at all.

Since NAN is av_display_rotation_get's error case, just print 0 (no rotation)
when that happens.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-09-27 17:37:21 +01:00
Andreas Rheinhardt 5c16df1b92 fftools/ffprobe: Report initial and trailing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-05 20:32:12 +02:00
Andreas Rheinhardt 601faaed92 fftools: Use report_error_then_exit_program() for allocation failures
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:26:00 +02:00
Gyan Doshi d5544f6457 ffprobe: restore reporting error code for failed inputs
c11fb46731 led to a regression whereby the return code for missing
input or input probe is overridden by writer close return code and
hence not conveyed in the exit code.
2022-08-17 16:46:05 +05:30
Anton Khirnov ccb94ec5cf ffprobe: print AVFrame.duration 2022-07-19 12:27:18 +02:00
Andreas Rheinhardt c6134ce65f fftools/ffprobe: Improve description of AFD side data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-09 20:21:31 +02:00
Andreas Rheinhardt dc977f94d5 fftools/ffprobe: Add const to AVPacket data pointers
These packets need not be writable (and are not modified by us),
so it is best to access them via const uint8_t*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-09 19:37:53 +02:00
Marton Balint c11fb46731 fftools/ffprobe: report avio errors
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 23:51:54 +02:00
Stefano Sabatini ff07492cd8 ffprobe: add -o option
This enables printing to a resource specified with -o OUTPUT.

In case the output is not specified, prints to stdout as usual.

Address issue: http://trac.ffmpeg.org/ticket/8024

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-13 22:42:55 +02:00
Stefano Sabatini 7adeeff91f ffprobe: update entry index after printing packet/media type
Fix JSON output in case a frame or packet section contains a nested section.

Fix trac issue http://trac.ffmpeg.org/ticket/8680.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-09 00:10:17 +02:00
Stefano Sabatini 83e1a1de88 doc/ffprobe: clarify that the input file is not optional
Fix trac issue http://trac.ffmpeg.org/ticket/9562
2022-04-21 12:34:04 +05:30
Anton Khirnov bd0cbebf3e fftools: drop the fake "default" option from ffplay/ffprobe
It tries to process any unhandled options as AVOptions. Handle this
directly in cmdutils.c, without resorting to a confusing fake option
definition (which is currently visible to the users in -help output).
2022-03-22 18:49:43 +01:00
Anton Khirnov 1dd6363581 fftools/ffprobe: drop -show_format_entry
Deprecated since 2012.
2022-03-22 18:49:43 +01:00
Anton Khirnov a545cb2b9d fftools/cmdutils: split common option handlers into their own file 2022-03-22 18:49:43 +01:00
Martin Storsjö 288313a8b2 libavfilter: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 6cd2ac388d libswscale: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 4332d6c4d5 libswresample: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 0f8b0b9ce2 libpostproc: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 884c597659 libavdevice: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 4eb9232c6e libavformat: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö f2da2e1458 libavcodec: Split version.h
This avoids including version.h in all source files, avoiding
unnecessary rebuilds when the version number is bumped. Only
version_major.h is included by the main header, which defines
availability of e.g. FF_API_* macros, and which is bumped much
less often.

This isn't done for libavutil/version.h, because that header needs
to be included essentially everywhere due to LIBAVUTIL_VERSION_INT
being used wherever an AVClass is constructed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:04:35 +02:00
James Almer a8b885f294 ffprobe: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
Limin Wang 316e0ff752 fftool/ffprobe: support for CUVA HDR Vivid metadata
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-03-01 09:08:43 +08:00
Andreas Rheinhardt 047a4e580e fftools/ffprobe: Remove redundant checks
A decoder is only opened if there is a decoder for the codec,
so every AVCodecContext here has AVCodecContext.codec set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-23 11:50:48 +01:00
Andreas Rheinhardt 26cce232d7 fftools/ffprobe: Flush decoder after draining
This is a prerequisite to continue using the decoder at all
to decode the next interval (if any).
This fixes a regression introduced in commit
2a88ebd096 and reported in ticket #8657.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-23 11:50:48 +01:00
Gyan Doshi e1a14479a8 ffprobe: allow side-data selection by element
At present, side data printing forces display for all levels i.e.
stream, packets and frames. This can bloat output and also force
decode of all frames in selected streams.

Now, stream_side_data[=type], packet_side_data[=type] &
frame_side_data[=type] can be used with -show_entries to specify carrier
element.
2022-02-03 16:04:24 +05:30
Jan Ekström a3f4148319 ffprobe: Support AV_FRAME_DATA_DOVI_METADATA
Co-authored-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 11:59:41 +01:00
James Almer 131dbb9a7a ffprobe: add missing separator when printing side data in compact output
Should fix ticket #7153

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-22 09:41:13 -03:00
softworkz 939711905a fftools/ffprobe: print size of attachment streams (extradata_size)
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-29 21:30:11 +01:00
Chad Fraleigh a185b526a9 fftools: Constify values from av_dict_get()
Treat values returned from av_dict_get() as const, since they are
internal to AVDictionary.

Signed-off-by: Chad Fraleigh <chadf@triularity.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-18 19:43:32 +01:00
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 6b08ed9f95 fftools/ffprobe: Don't access AVProgram.(start|end)_time
These are internal fields.

Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-14 19:17:19 +02:00
James Almer 590a7e02f0 avcodec: add a Film Grain codec property flag
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-24 10:00:06 -03:00