Commit Graph

43 Commits

Author SHA1 Message Date
Andreas Rheinhardt 9bf31f6096 avutil/samplefmt: Constify some pointees
This is the samplefmt analog of the imgutils changes
from the preceding commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:17:28 +02:00
Andreas Rheinhardt 8e7d2e4621 avutil/samplefmt: Don't include attributes.h, avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
James Almer 8a6103326e avutil/samplefmt: don't add offsets to NULL pointers
Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-13 16:10:37 -03:00
Paul B Mahol 9876d8fc6d swresample: add int64 sample format 2016-08-18 15:30:05 +02:00
James Almer 3e57520982 avutil: remove obsolete FF_API_SAMPLES_UTILS_RETURN_ZERO cruft
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-05 17:09:56 -03:00
James Almer 1abb77285c avutil: remove obsolete FF_API_GET_BITS_PER_SAMPLE_FMT cruft
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-05 17:09:49 -03:00
Michael Niedermayer d80b9ea11d Merge commit '0e830094ad0dc251613a0aa3234d9c5c397e02e6'
* commit '0e830094ad0dc251613a0aa3234d9c5c397e02e6':
  samplefmt: avoid integer overflow in av_samples_get_buffer_size()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-05 01:30:24 +01:00
Justin Ruggles 0e830094ad samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
2014-02-04 12:32:47 -05:00
Michael Niedermayer 63090842df av_samples_alloc_array_and_samples: Fix sizeof type.
Fixes CID1005317
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-21 00:26:17 +02:00
Stefano Sabatini 5c73645d91 lavu/samplefmt: add av_samples_alloc_array_and_pointers() 2013-03-31 18:00:44 +02:00
Stefano Sabatini b473c9937e lavu/samplefmt: return the size of the allocated samples buffer at the next bump
Make the functions av_samples_fill_arrays, av_samples_alloc, and
avcodec_fill_audio_frame return a buffer size rather than 0 in case of
success. This will be enabled at the next libavutil major bump, in order
to preserve backward compatibility.

Returning the size allows to simplify the code, avoiding a few function
calls.
2012-11-25 23:23:24 +01:00
Michael Niedermayer 0f1446a4d0 Merge commit 'ab35ec29a4071871934856c00da7d6ebcc0c095b'
* commit 'ab35ec29a4071871934856c00da7d6ebcc0c095b':
  vf_overlay: get rid of pointless messing with timebase.
  samplefmt: make av_samples_alloc() initialize the data to silence.
  libspeexdec: handle NULL return value from speex_packet_to_header()
  h264probe: Don't error out on bits that no longer are reserved
  mpegvideo: set extended_data in ff_update_duplicate_context()
  libspeexdec: properly handle DTX for multiple frames-per-packet
  libspeexdec: move the SpeexHeader from LibSpeexContext to where it is used
  libspeexdec: simplify setting of frame_size
  libspeexdec: set channel_layout

Conflicts:
	libavfilter/vf_overlay.c
	libavformat/h264dec.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-04 13:11:45 +02:00
Anton Khirnov cd15b7c03d samplefmt: make av_samples_alloc() initialize the data to silence.
Right now the buffer is zeroed, which does not represent silence for U8(P).
2012-10-04 08:05:21 +02:00
Michael Niedermayer c581cb4e4f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Fix even more missing includes after the common.h removal
  build: Factor out rangecoder dependencies to CONFIG_RANGECODER
  build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE
  x86: avcodec: Consistently name all init files
  Add more missing includes after removing the implicit common.h
  Add some more missing includes after removing the implicit common.h
  Don't include common.h from avutil.h
  rtmp: Automatically compute the hash for SWFVerification

Conflicts:
	configure
	doc/APIchanges
	doc/examples/decoding_encoding.c
	libavcodec/Makefile
	libavcodec/assdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/avpacket.c
	libavcodec/dv_profile.c
	libavcodec/dwt.c
	libavcodec/libtheoraenc.c
	libavcodec/rawdec.c
	libavcodec/rv40dsp.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c
	libavcodec/v210dec.h
	libavcodec/vc1dsp.c
	libavcodec/x86/Makefile
	libavfilter/asrc_anullsrc.c
	libavfilter/avfilter.c
	libavfilter/buffer.c
	libavfilter/formats.c
	libavfilter/vf_ass.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_select.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavformat/version.h
	libavutil/audioconvert.c
	libavutil/error.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 16:20:30 +02:00
Martin Storsjö 1d9c2dc89a Don't include common.h from avutil.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03:00
jamal 753a1b0988 samplefmt: Fix warning about discarded qualifier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-30 03:50:43 +02:00
Michael Niedermayer 375c0f74d1 av_samples_copy: support overlapping copies
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-12 22:25:25 +02:00
Michael Niedermayer 61930bd0d7 Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
  libxvid: Give more suitable names to libxvid-related files.
  libxvid: Separate libxvid encoder from libxvid rate control code.
  jpeglsdec: Remove write-only variable in ff_jpegls_decode_lse().
  fate: cosmetics: lowercase some comments
  fate: Give more consistent names to some RealVideo/RealAudio tests.
  lavfi: add avfilter_get_audio_buffer_ref_from_arrays().
  lavfi: add extended_data to AVFilterBuffer.
  lavc: check that extended_data is properly set in avcodec_encode_audio2().
  lavc: pad last audio frame with silence when needed.
  samplefmt: add a function for filling a buffer with silence.
  samplefmt: add a function for copying audio samples.
  lavr: do not try to copy to uninitialized output audio data.
  lavr: make avresample_read() with NULL output discard samples.
  fate: split idroq audio and video into separate tests
  fate: improve dependencies
  fate: add convenient shorthands for ea-vp6, libavcodec, libavutil tests
  fate: split some combined tests into separate audio and video tests
  fate: fix dependencies for probe tests
  mips: intreadwrite: fix inline asm for gcc 4.8
  mips: intreadwrite: remove unnecessary inline asm
  ...

Conflicts:
	cmdutils.h
	configure
	doc/APIchanges
	doc/filters.texi
	ffmpeg.c
	ffplay.c
	libavcodec/internal.h
	libavcodec/jpeglsdec.c
	libavcodec/libschroedingerdec.c
	libavcodec/libxvid.c
	libavcodec/libxvid_rc.c
	libavcodec/utils.c
	libavcodec/version.h
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/buffersink.h
	tests/Makefile
	tests/fate/aac.mak
	tests/fate/audio.mak
	tests/fate/demux.mak
	tests/fate/ea.mak
	tests/fate/image.mak
	tests/fate/libavutil.mak
	tests/fate/lossless-audio.mak
	tests/fate/lossless-video.mak
	tests/fate/microsoft.mak
	tests/fate/qt.mak
	tests/fate/real.mak
	tests/fate/screen.mak
	tests/fate/video.mak
	tests/fate/voice.mak
	tests/fate/vqf.mak
	tests/ref/fate/ea-mad
	tests/ref/fate/ea-tqi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-10 02:25:41 +02:00
Anton Khirnov 6d7f617700 samplefmt: add a function for filling a buffer with silence. 2012-05-09 17:44:56 +02:00
Anton Khirnov 142e740d1e samplefmt: add a function for copying audio samples. 2012-05-09 17:43:26 +02:00
Michael Niedermayer b4178a3f13 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream.
  av_samples_fill_array: Mark unmodified function argument as const.
  lagarith: add YUY2 decoding support
  Support decoding unaligned rgb24 lagarith.
  dv: Split profile handling code into a separate file.
  flvenc: use AVFormatContext, not AVCodecContext for logging.
  mov: Remove write-only variable in mov_read_chan().
  fate: Change the probe-format refs to match the final text format committed.
  fate: Add avprobe as a make dependency
  Add probe fate tests to test for regressions in detecting media types.
  fate: Add oneline comparison method
  qdm2: clip array indices returned by qdm2_get_vlc().
  avplay: properly close/reopen AVAudioResampleContext on channel layout change
  avcodec: do not needlessly set packet size to 0 in avcodec_encode_audio2()
  avcodec: for audio encoding, reset output packet when it is not valid
  avcodec: refactor avcodec_encode_audio2() to merge common branches
  avcodec: remove fallbacks for AVCodec.encode() in avcodec_encode_audio2()

Conflicts:
	ffplay.c
	libavcodec/Makefile
	libavcodec/dvdata.c
	libavcodec/dvdata.h
	libavcodec/qdm2.c
	libavcodec/utils.c
	libavformat/flvenc.c
	libavformat/mov.c
	tests/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-08 22:02:59 +02:00
Diego Biurrun ce473de921 av_samples_fill_array: Mark unmodified function argument as const.
libavcodec/utils.c:274: warning: passing argument 3 of ‘av_samples_fill_arrays’ discards qualifiers from pointer target type
./libavutil/samplefmt.h:151: note: expected ‘uint8_t *’ but argument is of type ‘const uint8_t *’
2012-05-08 11:35:49 +02:00
Michael Niedermayer 3bbf3f7e42 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  matroska: Clear prev_pkt between seeks.
  avutil: change default buffer size alignment for sample buffer functions
  audemux: Add a sanity check for the number of channels
  Remove libdirac decoder.
  matroska: Add incremental parsing of clusters.
  avconv: fix off by one check in complex_filter
  mpegts: Try seeking back even for nonseekable protocols
  swscale: K&R formatting cosmetics (part III)

Conflicts:
	configure
	doc/general.texi
	doc/platform.texi
	ffmpeg.c
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/libdirac.h
	libavcodec/libdiracdec.c
	libavformat/au.c
	libavformat/mpegts.c
	libswscale/input.c
	tests/ref/seek/lavf_mkv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-24 02:30:41 +02:00
Justin Ruggles 83b26046fc avutil: change default buffer size alignment for sample buffer functions
Aligning nb_samples will give both correct plane pointer alignment and enough
padding for SIMD-optimized functions.
2012-04-23 14:06:45 -04:00
Michael Niedermayer 6bfb3042b3 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avconv: use default alignment for audio buffer
  avcodec: use align == 0 for default alignment in avcodec_fill_audio_frame()
  avutil: use align == 0 for default alignment in audio sample buffer functions
  avutil: allow NULL linesize in av_samples_fill_arrays() and av_samples_alloc()
  avconv: remove OutputStream.picref.
  avconv: only set SAR once on the decoded frame.
  avcodec: validate the channel layout vs. channel count for decoders
  audioconvert: make av_get_channel_layout accept composite names.
  avutil: add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()

Conflicts:
	doc/APIchanges
	ffmpeg.c
	libavcodec/utils.c
	libavcodec/version.h
	libavutil/audioconvert.c
	libavutil/audioconvert.h
	libavutil/avutil.h
	libavutil/samplefmt.c
	libavutil/samplefmt.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-09 23:02:33 +02:00
Justin Ruggles 0109a09dc3 avutil: use align == 0 for default alignment in audio sample buffer functions 2012-04-09 10:20:35 -04:00
Justin Ruggles 18ed3788b0 avutil: allow NULL linesize in av_samples_fill_arrays() and av_samples_alloc() 2012-04-09 10:20:35 -04:00
Justin Ruggles 4d693b023c avutil: add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()
Based on a patch by Clément Bœsch <ubitux@gmail.com>
2012-04-08 15:13:28 -04:00
Giorgio Vazzana 208bcc6b5b libavutil: increase struct SampleFmtInfo member 'name' length to 8
This is necessary since some sample format names are longer than 3 characters.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-03 00:35:20 +01:00
Clément Bœsch 573ffbb3b5 lavu: add av_get_alt_sample_fmt(). 2011-11-24 16:55:45 +01:00
Michael Niedermayer 8e576d5830 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libavutil: add utility functions to simplify allocation of audio buffers.
  libavutil: add planar sample formats and av_sample_fmt_is_planar()
  avconv: fix segfault at EOF with delayed pictures
  pcmdec: remove unneeded resetting of samples pointer
  avconv: remove a now unused parameter from output_packet().
  avconv: formatting fixes in output_packet()
  avconv: declare some variables in blocks where they are used
  avconv: use the same behavior when decoding audio/video/subs
  bethsoftvideo: return proper consumed size for palette packets.
  cdg: skip packets that don't contain a cdg command.
  crcenc: add flags
  avconv: use vsync 0 for AVFMT_NOTIMESTAMPS formats.
  tiffenc: add a private option for selecting compression algorithm
  md5enc: add flags
  ARM: remove needless .text/.align directives

Conflicts:
	doc/APIchanges
	libavcodec/tiffenc.c
	libavutil/avutil.h
	libavutil/samplefmt.c
	libavutil/samplefmt.h
	tests/ref/fate/bethsoft-vid
	tests/ref/fate/cdgraphics
	tests/ref/fate/film-cvid-pcm-stereo-8bit
	tests/ref/fate/mpeg2-field-enc
	tests/ref/fate/nuv
	tests/ref/fate/tiertex-seq
	tests/ref/fate/tscc-32bit
	tests/ref/fate/vmnc-32bit

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-24 03:32:24 +01:00
Justin Ruggles bbb46f3ec7 libavutil: add utility functions to simplify allocation of audio buffers.
Based on code by Stefano Sabatini.
2011-11-23 18:39:28 -05:00
Justin Ruggles 8889cc4f5b libavutil: add planar sample formats and av_sample_fmt_is_planar() 2011-11-23 18:39:28 -05:00
Reimar Döffinger 5639793be9 Put strings inside struct instead of extra indirection.
Saves a bit on space and relocations.
Also makes the (very hackish) lossless conversion check
in ffmpeg.c work reliably.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2011-11-05 11:30:46 +01:00
Stefano Sabatini 5fba761f6e samplefmt: remove deprecated use of av_get_bits_per_sample_fmt()
Use av_get_bytes_per_sample() instead.

Fix deprecation warning:
samplefmt.c: In function ‘av_samples_fill_arrays’:
samplefmt.c:88: warning: ‘av_get_bits_per_sample_fmt’ is deprecated (declared at samplefmt.c:76)
2011-06-25 22:06:30 +02:00
Michael Niedermayer d552f616a2 Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
  Remove some non-compiling debug messages.
  ffplay: Fix non-compiling debug printf and replace it by av_dlog.
  H264: x86 predict init cosmetics.
  ac3enc: Fix linking of AC-3 encoder without the E-AC-3 encoder.
  Move E-AC-3 encoder functions to a separate eac3enc.c file.
  ac3enc: remove convenience macro, #define DEBUG
  ac3enc: remove unused #define
  vc1: re-initialize tables after width/height change.
  APIchanges: fill-in git commit hash for av_get_bytes_per_sample() addition
  samplefmt: add av_get_bytes_per_sample()
  iirfilter: fix biquad filter coefficients.
  swscale: remove duplicate conversion routine in swScale().
  swscale: add yuv2planar/packed function typedefs.
  swscale: integrate yuv2nv12X_C into yuv2yuvX() function pointers.
  swscale: reindent x86 init code.
  swscale: extract SWS_FULL_CHR_H_INT conditional into init code.
  swscale: cosmetics.
  swscale: remove alp/chr/lumSrcOffset.
  swscale: un-special-case yuv2yuvX16_c().
  shorten: Remove stray DEBUG #define and corresponding av_dlog statement.
  ...

Conflicts:
	doc/APIchanges
	libavcodec/ac3enc.c
	libavutil/avutil.h
	libavutil/samplefmt.c
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-08 05:25:28 +02:00
Stefano Sabatini a6703faa15 samplefmt: add av_get_bytes_per_sample()
Deprecate av_get_bits_per_sample_fmt(), which was a misnamed function.

For the moment we don't have sample formats with a non-integer number
of bytes, in that case we may need to create a new
av_get_bits_per_sample() function. In the meanwhile we prefer to adopt
this variant, since avoids divisions by 8 all over the place.
2011-06-07 13:06:41 -04:00
Stefano Sabatini 0bc2cca12f samplefmt: switch nb_channels/nb_samples params order in av_samples_alloc()
This is consistent with the order of parameters in
av_samples_fill_arrays().
2011-06-06 10:12:46 +02:00
Stefano Sabatini e1c7414812 samplefmt: change layout for arrays created by av_samples_alloc() and _fill_arrays()
The new layout is consistent with that of the av_image_() API, and
simplifies understanding and copy operations, it also preserves
alignment information which was lost with the previous layout.

This breaks API/ABI, but since the function was never referenced in
the code (and it isn't unlikely already used by someone) then this
should not be a problem.
2011-06-06 10:11:48 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Reinhard Tartler 7ffe76e540 Merge libavcore into libavutil
Done to keep ABI compatible. Otherwise this is just silly
2011-02-16 23:00:30 +01:00
Reinhard Tartler 737eb5976f Merge libavcore into libavutil
It is pretty hopeless that other considerable projects will adopt
libavutil alone in other projects. Projects that need small footprint
are better off with more specialized libraries such as gnulib or rather
just copy the necessary parts that they need. With this in mind, nobody
is helped by having libavutil and libavcore split. In order to ease
maintenance inside and around FFmpeg and to reduce confusion where to
put common code, avcore's functionality is merged (back) to avutil.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-02-15 16:18:21 +01:00
Anton Khirnov 8207c67a24 lavu: remove disabled FF_API_GET_BITS_PER_SAMPLE_FMT cruft 2012-10-23 07:33:05 +02:00