Commit Graph

55 Commits

Author SHA1 Message Date
Andreas Rheinhardt
ed9279afbd h264_mp4toannexb: Remove unnecessary check
There can be at most 31 SPS and 255 PPS in the mp4/Matroska extradata.
Given that each has a size of at most 2^16-1, the length of the output
derived from these parameter sets can never overflow an ordinary 32 bit
integer. So use a simple uint32_t instead of uint64_t and replace the
unnecessary check with an av_assert1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 23:43:49 +01:00
James Almer
390f156451 avcodec/h264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback
Signed-off-by: James Almer <jamrial@gmail.com>
2018-08-16 23:43:10 -03:00
James Almer
a9a433564d avcodec/h264_mp4toannexb_bsf: use enum constants for the NAL unit type values
Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-30 17:51:50 -03:00
Yusuke Nakamura
af7e953a59 h264_mp4toannexb_bsf: Fix start code size of parameter sets.
Any parameter set shall have start code of at least 4 byte size.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-13 01:34:42 +01:00
Derek Buitenhuis
97946b20b6 Merge commit 'f3ed484953b81856e40239d2410058a96188b2be'
* commit 'f3ed484953b81856e40239d2410058a96188b2be':
  h264_mp4toannexb_bsf: do not fail on annex B extradata

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-12 14:34:03 +01:00
Anton Khirnov
f3ed484953 h264_mp4toannexb_bsf: do not fail on annex B extradata
Just pass through the bitstream as is. This is the same as what is done
for HEVC already.
2016-04-24 10:06:23 +02:00
Derek Buitenhuis
af9cac1be1 Merge commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab'
* commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab':
  lavc: add a new bitstream filtering API

Conversions-by: Hendrik Leppkes <h.leppkes@gmail.com>
Conversions-by: Derek Buitenguis <derek.buitenhuis@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-17 18:47:40 +01:00
Anton Khirnov
33d18982fa lavc: add a new bitstream filtering API
Deprecate the current bitstream filtering API.
2016-03-20 08:15:01 +01:00
赵宇龙
cd847839f3 h264_mp4toannexb: fix the pps offset when there are more than one sps in avcc
the pps offset is used to locate pps in the spspps_buf; however, the
current calc method is wrong because it is the offset of the original
avctx->extradata;
when there is only one sps in the avcc; the value is correct by
coincidence, however, it will fail in avcc with multi sps

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 01:37:00 +02:00
Michael Niedermayer
3d126ef188 avcodec/h264_mp4toannexb_bsf: Use av_freep() to free spspps_buf
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 01:29:22 +02:00
Michael Niedermayer
2bb54b82b5 avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check
Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-21 03:37:32 +02:00
Michael Niedermayer
29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara
059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Ivan Uskov
1defff85cb libavcodec/h264_mp4toannexb_bsf.c: Optional argument "private_spspps_buf" to avoid extradata modification.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-26 01:44:41 +02:00
Benoit Fouet
904cfd257d avcodec/h264_mp4toannexb_bsf: reset the new IDR flag when SPS/PPS is seen.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-05 14:47:04 +02:00
Benoit Fouet
d5ddcb5f8e avcodec/h264_mp4toannexb_bsf: use the given padding in h264_extradata_to_annexb().
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-30 13:12:36 +02:00
Benoit Fouet
1cf4d2e9be avcodec/h264_mp4toannexb_bsf: add a case when only SPS/PPS is in the stream.
When only SPS or PPS is present in the stream, copy the missing one from
AVCC before insertion to the output stream.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-30 11:33:06 +02:00
Benoit Fouet
f9bd6d61bc h264_mp4toannexb_bsf: rename first_idr to new_idr
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 17:58:30 +02:00
Benoit Fouet
42f25fe009 h264_mp4toannexb_bsf: always set idr_sps_pps_seen when SPS/PPS is seen.
In order not to break a sequence like "SPS IDR SPS IDR", the boolean
telling that the SPS/PPS has been seen should always be set.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 12:20:14 +02:00
Benoit Fouet
bf428bb314 h264_mp4toannexb_bsf: account for consecutive IDR pictures.
If there are consecutive IDR pictures, then SPS/PPS should be prepended
to all of them, not only the first one.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 15:59:47 +02:00
Chris \"Koying\" Browet
ad91bf854b avcodec/h264_mp4toannexb_bsf: fix issue when sps/pps are already in the bistream 2014-07-27 03:36:24 +02:00
Michael Niedermayer
289b149cec avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets
Fixes h264_mp4toannexb_bsf_failure.mkv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 18:09:23 +01:00
Michael Niedermayer
8c677a9f06 Merge commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c'
* commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c':
  avcodec: Use av_reallocp where suitable

Conflicts:
	libavcodec/bitstream.c
	libavcodec/eatgv.c
	libavcodec/flashsv.c
	libavcodec/libtheoraenc.c
	libavcodec/libvpxenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-09 20:31:29 +01:00
Alexandra Khirnova
9b8d11a76a avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-09 12:27:51 +02:00
Paul B Mahol
2490996f38 avcodec: use designated initializers for bitstream filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-10-02 17:20:29 +00:00
Stefano Sabatini
53c853e049 lavc/h264_mp4toannexb: improve feedback in case of invalid bitstream 2013-07-17 01:17:32 +02:00
Michael Niedermayer
9f91e7deec Merge commit '9e80eda26d06c7c48dbec5dfe643c857c62c0ee7'
* commit '9e80eda26d06c7c48dbec5dfe643c857c62c0ee7':
  h264_mp4toannexb_bsf: return a padded buffer

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-16 23:01:41 +02:00
Michael Niedermayer
0a5d22a195 Merge commit '8d929afd256069aa881f2bf58ef9f0ffce2d6b7e'
* commit '8d929afd256069aa881f2bf58ef9f0ffce2d6b7e':
  h264_mp4toannexb_bsf: factor out extradata parsing

Conflicts:
	libavcodec/h264_mp4toannexb_bsf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-16 22:51:56 +02:00
Michael Niedermayer
46a5003a4a Merge commit '5d21ca45591bb1c1d2265f8ed972d18c563f145e'
* commit '5d21ca45591bb1c1d2265f8ed972d18c563f145e':
  h264_mp4toannexb_bsf: K&R formatting cosmetics

Conflicts:
	libavcodec/h264_mp4toannexb_bsf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-16 22:40:43 +02:00
Luca Barbato
9e80eda26d h264_mp4toannexb_bsf: return a padded buffer
The code using the returned buffer might expect it to be
FF_INPUT_BUFFER_PADDING_SIZE padded as any other avpacket.
2013-06-15 16:14:45 +02:00
Luca Barbato
8d929afd25 h264_mp4toannexb_bsf: factor out extradata parsing 2013-06-15 16:14:33 +02:00
Luca Barbato
5d21ca4559 h264_mp4toannexb_bsf: K&R formatting cosmetics 2013-06-15 09:11:13 +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
Michael Niedermayer
f1fdd208cc h264_mp4toannexb_bsf: use i instead of misusing unit_type.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-21 22:33:28 +01:00
gs_gail
361c4cdca9 h264_mp4toannexb_bsf: support 24bit lengths 2012-03-21 21:42:44 +01:00
Michael Niedermayer
c065255bba Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacenc: Fix LONG_START windowing.
  aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
  avplay: use the correct array size for stride.
  lavc: extend doxy for avcodec_alloc_context3().
  APIchanges: mention avcodec_alloc_context()/2/3
  avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS.
  aacsbr: ARM NEON optimised sbrdsp functions
  aacsbr: align some arrays
  aacsbr: move some simdable loops to function pointers
  cosmetics: Remove extra newlines at EOF

Conflicts:
	libavcodec/utils.c
	libavfilter/formats.c
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-29 00:34:59 +01:00
Alex Converse
7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Michael Niedermayer
7ae251b4d8 h264_mp4toannexb_filter: pass error code through.
Bug-Found-by and Suggested bugfix: Tanami, Ohad
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-29 21:01:41 +01:00
Michael Niedermayer
9d4cb45dbe Cleanup 'Fix spurious warning when stream has SPS and PPS units.'
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-08 12:29:30 +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
Philip Langdale
025225d7ee h264_mp4toannexb_bsf: Fix spurious warning when stream has SPS and PPS units.
Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-15 07:20:44 -04:00
Ronald S. Bultje
4e84f994d3 reindent. 2011-03-07 13:18:57 -05:00
Sean McGovern
02dd3666c2 h264_mp3toannexb_bsg: don't crash, but warn, if PPS/SPS not found.
Should an AVC-1 in MP4 stream not contain SPS or PPS NAL units,
this BSF is then unable to allocate an output buffer for the
modified stream. Warn that the resulting stream may be unplayable.

Fix roundup issue #2386.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-07 10:19:46 -05:00
Diego Elio Pettenò
d36beb3f69 Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf.
None of these symbols should be accessed directly, so declare them as
hidden.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-26 16:08:45 +00:00
Benoit Fouet
bb5cfc48f1 Cosmetics: alignment and long line break.
Originally committed as revision 23559 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-10 06:00:37 +00:00
Benoit Fouet
1f7d2f54c5 Cosmetics: use and place braces correctly in if ... else statements.
Originally committed as revision 23558 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-10 06:00:06 +00:00
Benoit Fouet
639c697c4f Sanitize av_realloc() use in h264 mp4toannexb bistream filter.
Originally committed as revision 23557 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-10 05:59:22 +00:00
Luca Abeni
d5cc1ed723 Improve the mp4toannexb BSF to convert the extradata.
Originally committed as revision 23545 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-09 06:47:01 +00:00
Thomas Devanneaux
52486603b5 Check NAL unit size to avoid reading past the buffer.
This fixes issue1907

Patch by Thomas Devanneaux gmail(thomdev)

Originally committed as revision 23078 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-10 07:08:57 +00:00