Commit Graph

98 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Andreas Rheinhardt 56450a0ee4 avformat: Constify the API wrt AV(In|Out)putFormat
Also constify AVProbeData.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:08 -03:00
Anton Khirnov 8918a3dfa2 lavfi/src_movie: switch to new decoding API 2020-11-20 15:25:26 +01:00
Andreas Rheinhardt 0086432fc7 fftools, libavcodec, libavfilter: Add const to some AVCodec *
The user has no business modifying the underlying AVCodec.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-11 14:42:36 +02:00
Andreas Rheinhardt d91756c1b5 avfilter/src_movie: Fix leak of packet upon error
If allocating the AVFrame to contain a decoded frame fails, the AVPacket
containing the data intended to be decoded leaks. This commit fixes
this.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-10 22:25:34 +02:00
Andreas Rheinhardt 41e0058b48 avfilter/src_movie: Remove unnecessary secondary AVPacket
The movie and amovie filters currently use two packets. One of the two,
pkt0, is the owner of the returned packet; it is also the destination
packet for av_read_frame(). The other one pkt is initially (i.e. after
av_read_frame()) a copy of pkt0; copy means that the contents of both
are absolutely the same: They both point to the same AVBufferRef and the
same side data. This violation of the refcounted packet API is only
possible because pkt is not considered to own its data. Only pkt0 is
ever unreferenced.
The reason for pkt's existence seems to be historic:
The API used for decoding audio (namely avcodec_decode_audio4()) could
consume frames partially, i.e. it could return multiple frames for one
packet and therefore it returned how much of the input buffer had been
consumed. The caller was then supposed to update the packet's data and
size pointer to reflect this and call avcodec_decode_audio4() again with
the updated packet to get the next frame.
But before the introduction of refcounted AVPackets where knowledge and
responsibility about what to free lies with the underlying AVBuffer such
a procedure required a spare packet (or one would need to record the
original data and size fields separately to restore them before freeing
the packet; notice that this code has been written when AVPackets still
had a destruct field). But these times are long gone, so just remove the
secondary AVPacket.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-10 22:25:28 +02:00
Andreas Rheinhardt c97d91ecae avfilter/src_movie: Remove unneeded resetting of AVPacket
av_read_frame() already returns clean packets on error.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-10 22:25:12 +02:00
Nicolas George d1f3d721df Revert "avfilter/src_movie: switch to activate"
This reverts commit abc884bcc0.

This patch was pushed without actual review.
An actual review would have revealed that the switch to activate
was not done correctly because the logic between request_frame()
and frame_wanted is not as direct with filters with multiple
outputs than with a single output.
2020-09-08 14:57:53 +02:00
Nicolas George 2f76476549 lavfi: regroup formats lists in a single structure.
It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
2020-09-08 14:02:40 +02:00
Paul B Mahol abc884bcc0 avfilter/src_movie: switch to activate
Allow to set the EOF timestamp.
2020-09-04 19:37:29 +02:00
Andreas Rheinhardt a97d8469a6 avfilter/src_movie: Avoid intermediate buffer for writing string
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-31 03:41:38 +02:00
Andreas Rheinhardt ae5026c905 avfilter/formats: Schedule avfilter_make_format64_list() for removal
Despite its name, this function is not part of the public API, as
formats.h, the header containing its declaration, is a private header.
The formats API was once public API, but that changed long ago
(b74a1da49d, the commit scheduling it to
become private, is from 2012). That avfilter_make_format64_list() was
forgotten is probably a result of the confusion resulting from the
libav-ffmpeg split.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-12 21:10:59 +02:00
Paul B Mahol d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Carl Eugen Hoyos 7ffa458d60 lavfi/movie: Use filter thread count for decoding threads.
Fixes ticket #7542.
2019-10-01 21:54:53 +02:00
Josh de Kock 89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Paul B Mahol 48ddd8ddec avfilter/src_movie: check ff_insert_outpad() for failure
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-08-25 10:29:50 +02:00
Muhammad Faiz 6af050d7d0 avfilter: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:40:30 +07:00
James Almer 655418014c Merge commit 'ce6f780bc6656ad3895f81a988b239ad3c8af4b8'
* commit 'ce6f780bc6656ad3895f81a988b239ad3c8af4b8':
  configure: Add missing asyncts filter, movie filter, and output example deps

Merged-by: James Almer <jamrial@gmail.com>
2017-04-04 16:15:02 -03:00
Michael Niedermayer fdd8aac7e1 avfilter/src_movie: Add option to remove timestamp discontinuities
This can also be extended to remove discontiuities caused by seek commands

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-26 00:20:00 +02:00
Muhammad Faiz 2991d93520 avfilter/src_movie: call open_stream after guess_channel_layout
fix error 'Channel layout change is not supported' when
opening wav file

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-09 02:00:10 +07:00
Muhammad Faiz defab0825f avfilter/src_movie: add various commands
add seek command
add get_duration command

Update to codecpar by commiter

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-25 17:19:41 +02:00
Derek Buitenhuis 8cae006c56 Merge commit '1138eb5509d3db7f6d565cb45f137a786d22beb9'
* commit '1138eb5509d3db7f6d565cb45f137a786d22beb9':
  vsrc_movie: convert to codecpar

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-11 14:42:30 +01:00
Marios Titas c1f9734f97 avfilter/src_movie: fix how we check for overflows with seek_point
Currently, if the movie source filter is used and a seek_point is
specified on a file that has a negative start time, ffmpeg will fail.

An easy way to reproduce this is as follows:
$ ffmpeg -vsync passthrough -filter_complex 'color=d=10,setpts=PTS-1/TB' test.mp4
$ ffmpeg -filter_complex 'movie=filename=test.mp4:seek_point=2' -f null -

The problem is caused by checking for int64_t overflow the wrong way.
In general, to check whether a + b overflows, it is not enough to do:
    a > INT64_MAX - b
because b might be negative; the correct way is:
    b > 0 && > a > INT64_MAX - b

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-03 01:50:08 +02:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Ganesh Ajjanagadde 6aaac24d72 avfilter/all: propagate errors of functions from avfilter/formats
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM).
This propagates the return values.

All of these were found by using av_warn_unused_result, demonstrating its utility.

Tested with FATE. I am least sure of the changes to avfilter/filtergraph,
since I don't know what/how reduce_format is intended to behave and how it should
react to errors.

Fixes: CID 1325680, 1325679, 1325678.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Previous version Reviewed-by: Nicolas George <george@nsup.org>
Previous version Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-14 10:04:01 -04:00
Hendrik Leppkes 144fb06806 Remove left-over FF_API_AVFILTERBUFFER cruft 2015-09-05 16:27:19 +02:00
Ronald S. Bultje 229843aa35 Replace av_dlog with ff_dlog.
ff_dlog checks compilability, and is non-public. av_dlog is deprecated
and no longer exists if FF_API_DLOG=0.
2015-08-18 10:24:01 -04:00
Paul B Mahol 145a84717b lavfi: check av_strdup() return value
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-06 10:02:11 +00:00
Lukasz Marek f753956252 lavfi/src_movie: minor simplifications
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 04:50:32 +02:00
Lukasz Marek 9739255365 lavfi/src_movie: remove frame from priv context
This variable is used only inside one function.
There is no need to store it in context.

This also may prevent crush by double free frame.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 04:48:49 +02:00
Michael Niedermayer 74a8dbe1c4 Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'
* commit '58400ac133bcfb6bf8196b4e5208bc178307739b':
  lavfi: name anonymous structs

Conflicts:
	libavfilter/buffersink.c
	libavfilter/f_select.c
	libavfilter/src_movie.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_overlay.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_unsharp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-19 18:20:17 +02:00
Michael Niedermayer 48f7d5f0cf avfilter/src_movie: Check that the pixel format hasnt changed
Fixes assertion failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 03:59:20 +01:00
Stefano Sabatini e756effd58 lavfi/movie: fix display of pushed frame information
It was broken since 7e350379f8.

Also fix warnings:
libavfilter/src_movie.c: In function ‘describe_frame_to_str’:
libavfilter/src_movie.c:392:5: warning: ‘type’ is deprecated (declared at ./libavutil/frame.h:313) [-Wdeprecated-declarations]
libavfilter/src_movie.c:408:9: warning: ‘type’ is deprecated (declared at ./libavutil/frame.h:313) [-Wdeprecated-declarations]
2014-02-02 15:54:26 +01:00
Michael Niedermayer ccdfa3e271 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add missing #includes for *INT64_MAX and *INT64_C

Conflicts:
	ffmpeg.c
	ffmpeg_filter.c
	ffplay.c
	libavformat/assdec.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-24 05:21:19 +01:00
Michael Niedermayer 325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Michael Niedermayer ee97982408 avfilter/src_movie: Fix handling of packet size for video
See Ticket2556

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-26 13:46:19 +02:00
Michael Niedermayer 87bc648930 libavfilter/src_movie: fix which packet is reset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-26 13:06:11 +02:00
Michael Niedermayer 015cc3239a lavfi/movie: free packet on decoder error
Prevents infinite loop, see Ticket2556

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-25 13:37:40 +02:00
Michael Niedermayer 5d509fbdcf Merge commit 'eeeb5c291d3f78eaade5b99c2614c7cab0e9be79'
* commit 'eeeb5c291d3f78eaade5b99c2614c7cab0e9be79':
  vsrc_movie: do not free avoption variables in uninit()

Conflicts:
	libavfilter/src_movie.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-21 10:41:41 +02:00
Alexander Strasser ac604e446b lavfi/src_movie: Use movie_common_init instead individual wrappers
Makes it easier to understand that there is no difference in init
callback for movie and amovie. Also saves a few lines of code.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-06-18 00:02:30 +02:00
Alexander Strasser c679a1c358 lavfi/src_movie: Check pointer is not NULL before deref
Also do not check against empty string, the lower levels should
be able to deal with it.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-06-18 00:02:30 +02:00
Michael Niedermayer efc08e00cc Merge commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110'
* commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110':
  vf_aspect: use the name 's' for the pointer to the private context
  Remove commented-out debug #define cruft

Conflicts:
	libavcodec/4xm.c
	libavcodec/dvdsubdec.c
	libavcodec/ituh263dec.c
	libavcodec/mpeg12.c
	libavfilter/avfilter.c
	libavfilter/vf_aspect.c
	libavfilter/vf_fieldorder.c
	libavformat/rtmpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-16 09:56:43 +02:00
Michael Niedermayer a8ff830b79 Merge commit '093804a93cc5da3f95f98265a5df116912443cec'
* commit '093804a93cc5da3f95f98265a5df116912443cec':
  avfilter: Add av_cold attributes to init/uninit functions

Conflicts:
	libavfilter/af_ashowinfo.c
	libavfilter/af_volume.c
	libavfilter/src_movie.c
	libavfilter/vf_lut.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 11:42:18 +02:00
Michael Niedermayer adaa7743f5 src_movie: fix scanf string
Fixes out of array accesses

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 00:56:39 +02:00
Clément Bœsch 73180f5b0e lavfi: flag more dynamic i/o filters. 2013-04-13 19:43:17 +02:00
Michael Niedermayer 292f68154b avfilter: Filter options that are used for both video and audio should have both flags
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-12 15:45:28 +02:00
Michael Niedermayer fd6228e657 lavfi: remove now unused args parameter from AVFilter.init and init_opaque
This is mostly automated global search and replace

The deprecated aconvert filter is disabled, if it still has users
it should be updated

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-12 11:54:39 +02:00
Michael Niedermayer 3a3d984445 Merge commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303'
* commit 'a42d6e6c4c19912b73cae8ca9133b4202667c303':
  vsrc_movie: switch to an AVOptions-based system.

Conflicts:
	doc/filters.texi
	libavfilter/src_movie.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-11 03:41:08 +02:00
Clément Bœsch 05854f5505 lavfi/movie: raise filter_frame() error. 2013-03-13 19:00:09 +01:00