Commit Graph

10397 Commits

Author SHA1 Message Date
Vittorio Giovara
bacc92b59b rtpdec_vp9: Drop extra sanity check for size of input packet
In this case len is always at least 1, since it is checked against
RTP_VP9_DESC_REQUIRED_SIZE + 1 and then it is reduced by
RTP_VP9_DESC_REQUIRED_SIZE before entering the has_pic_id check.

Bug-Id: CID 1270811
2015-03-11 18:01:25 +00:00
Vittorio Giovara
fe99c52fa9 mp3: Properly use AVCodecContext API
Rather than having an unitialized context on the stack, allocate it with
defaults and free it when unneeded.

CC: libav-stable@libav.org
2015-03-11 17:57:56 +00:00
Vittorio Giovara
9272c965d9 matroskaenc: Fix type used for chapter timestamps 2015-03-11 17:56:51 +00:00
Martin Storsjö
448c8cfe4c movenc: Support setting fragment_index before the moov atom is written
This way, the caller doesn't need to coordinate setting the option
after the moov atom has been written. The downside is that it is
no longer possible to use the option for checking whether the moov
atom already has been written, but a caller is able to keep track
of that by other means anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 10:41:06 +02:00
Martin Storsjö
0c5e380c2c movenc: Don't rely on the fragment index for vc1 info gathering
The previous use of the mov->fragments field, for determining whether
written packets were part of the first fragment or not, didn't
work as intended when using the empty_moov flag.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 10:41:03 +02:00
Martin Storsjö
cf402d6fa8 rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
By making sure we at each time only have one pointer set, either a
local variable or one in the context, we avoid potential double frees
in the cleanup routines. If chain->rtp_ctx is set, it is closed by
calling avformat_write_trailer, but that shouldn't be called unless
avformat_write_header succeeded.

This issue was pointed out by Andreas Cadhalpun.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 09:58:41 +02:00
Martin Storsjö
c83dd2d2a4 rtpenc_mpegts: Free the right ->pb in the error path in the init function
This fixes a typo from 8e32b1f096.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 09:58:37 +02:00
Vittorio Giovara
ad94c6ca0b siff: Use the correct type for packet size variables
The avio functions used here return an unsigned value.
Also reduce a variable scope.

CC: libav-stable@libav.org
Bug-Id: CID 1258461
2015-03-09 12:58:17 +00:00
Vittorio Giovara
9f25a10992 matroskaenc: Also validate chapter end time
This prevents it to be written as unsigned. Also add an error message.

CC: libav-stable@libav.org
Bug-Id: CID 1265717
2015-03-09 12:57:19 +00:00
Vittorio Giovara
bfeb83a8b7 rtpdec_hevc: Drop extra sanity check for size of input packet
In this case len is always at least 3, since it is checked against
RTP_HEVC_PAYLOAD_HEADER_SIZE + 1 before entering the switch block.

Bug-Id: CID 1238784
2015-03-09 12:57:01 +00:00
Martin Storsjö
46d4d85759 movenc: Avoid writing separate flags for the first sample if not necessary
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-09 10:36:12 +02:00
Martin Storsjö
00d751d4fc movenc: Set tfhd default sample flags based on actual samples, if possible
This avoids assuming that e.g. audio samples are marked as
sync samples.

This allows omitting the sample flags from trun, if the default
flags happen to be right for all the samples.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-09 10:36:02 +02:00
Martin Storsjö
6448f15af0 mxfdec: Fix the error handling for when strftime fails
The str variable is a char ** here.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-08 18:40:43 +02:00
Carl Eugen Hoyos
0f9f7969ef rmdec: Improve message for demux error
Use correct context, reduce log level, don't assume it is a video stream,
and print the tag of the unknown stream.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-03-08 02:35:04 +00:00
Martin Storsjö
9731cf4001 movenc: Keep writing zero-entry stts atoms as intended
a876585215 had the unintended side effect of returning AVERROR(ENOMEM)
when track->entry is zero, while the code intentionally wants to
continue in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-06 16:17:48 +02:00
Timo Rothenpieler
5aef535a64 dashenc: Update extradata for mov muxer
The mov muxer already supports picking up extradata that wasn't
present during the avformat_write_header call - we just need to
propagate it. Since the dash muxer uses delay_moov, we have time
up until the first segment is written to get extradata filled in.

Also update the codec description string when the extradata becomes
available.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-06 10:07:17 +02:00
Timo Rothenpieler
6cf7f30655 dashenc: Simplify code by using a local variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-06 10:07:11 +02:00
Andreas Cadhalpun
c73c3c34fe avformat/adxdec: set avctx->channels in adx_read_header
It is used in adx_read_packet, which currently depends on the
decoder/parser setting this value between reading the file header and
demuxing the first packet.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-03-05 15:57:48 +01:00
Andreas Cadhalpun
bb4edddd93 rmenc: limit packet size
The chunk size is limited to UINT16_MAX (written by avio_wb16), so make
sure that the packet size is not too large.

Such large frames need to be split into slices smaller than 64 kB, but
that is currently supported neither by the rv10/rv20 encoders nor the rm
muxer.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-03-05 15:51:05 +01:00
Thomas Volkert
9c09fbd805 rtpdec: experimental VP9 depacketizer (draft 0)
The code was tested with live555 server.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-05 10:05:44 +02:00
Martin Storsjö
b72b212a4c rdt: Use a separate variable to clarify the different value namespaces
The original flags variable contains rtpdec flags, while the
rmflags variable contains RM flag bits which have a completely
different definition.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-05 00:26:42 +02:00
Martin Storsjö
c13ab42a0a rtpdec_qt: Use a local variable instead of RTP_FLAG_KEY
The only case where RTP_FLAG_KEY actually is needed is
in RDT, where such a flag needs to be passed via the
rtpdec parse function's flags parameter.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-05 00:26:42 +02:00
Martin Storsjö
15621cbbe4 rtpdec_asf: Don't set RTP_FLAG_KEY
Nothing in the framework nor in the rest of the depacketizer actually
uses this flag - the chained demuxer sets the keyframe flag properly on
demuxed packets already.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-05 00:26:24 +02:00
Luca Barbato
e767c9e8f2 flv: Validate and reject unsupported codecs
And provide a more informative message in case of failure.

CC: libav-stable@libav.org
2015-03-04 18:28:40 +01:00
Diego Biurrun
25f613f8be dca: Move syncword definitions to a separate header 2015-03-04 13:29:33 +01:00
Martin Storsjö
1dc19729e9 rtpdec_asf: Don't free the payload context in the .close function
This was missed in bb4a310bb. This fixes a double free on close.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-04 13:12:09 +02:00
Martin Storsjö
2a66a58067 rtpdec_mpa_robust: Fix incrementing split_pos
This fixes an oversight in 96084251, in a refactoring done on top
of Gilles' original patch.

Pointed out by Gilles Chanteperdrix.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-04 09:34:14 +02:00
Vittorio Giovara
0af3b65880 asf: do not export XMP metadata by default
Similarly to what has been done for MOV, display XMP metadata only when
users explicitly require it.

The Extensible Metadata Platform tag can contain various kind of data
which are not strictly related to the video file, such as history of
edits and saves from the project file.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-03-03 15:30:52 +00:00
Martin Storsjö
33d412eb4a dashenc: Simplify code by using a local variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-02 20:34:43 +02:00
Martin Storsjö
91eee2af87 Revert "mov: Change DTS-based seek into CTS-based seek."
This reverts commit 4abfa387b8.

This commit broke playback of fragmented mp4 files with b-frames.
While investigating this, it turned out that the general framework
isn't ready for a PTS-based index yet. Revert this change until
a better thought out solution is in place.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-02 14:15:12 +02:00
Martin Storsjö
4f6cd883f0 rtpenc: Don't set max_frames_per_packet based on the packet frame size or frame rate
Instead check the timestamps while muxing, to avoid buffering a
too long timestamp range into one single packet.

This makes the AMR and AAC packetization slightly less efficient,
since we set a possibly unnecessarily high max_frames_per_packet.
(These packetizers end up doing a memmove of the TOC bytes if
sending a packet before max_frames_per_packet is achieved, and
we end up setting max_frames_per_packet to a value that should
be high enough for most uses.)

All packetizers that use max_frames_per_packet now set it either
to a default value, or to a value calculated based on other
parameters, so none of them rely on the previous default setting.

For iLBC, copy one frame at a time, to allow checking the timestamp
range for each of them - basically doing potentially multiple
loops to simplify the code instead of trying to calculate the
number of frames to buffer while honoring s1->max_delay.

This is in preparation for reducing the coupling between libavformat
and libavcodec, by not having the muxers use the encoder field
frame_size (which may not be available during e.g. stream copy).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:31 +02:00
Martin Storsjö
bde2bba45c rtpenc: Restructure if statements in packetizers to simplify adding more conditions
Factorize out the s->num_frames check at the start of the if statements,
simplifying adding more alternative causes for sending the buffered
frames.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:26 +02:00
Martin Storsjö
d4c7fc02f9 rtpenc: Skip redundant initialization
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:22 +02:00
Martin Storsjö
f8c01257f9 rtpenc: Always do the default initialization regardless of codecs
This avoids having to jump to the defaultcase in the switch. Manually
override the stream time base back to 90 kHz for the few audio codecs
that don't use the sample rate as time base (mp2, mp3).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:11 +02:00
Martin Storsjö
11edeaea32 rtpenc_xiph: Don't exclude headers from max_payload_size
This makes things more consistent by using the variable in the same
way as in all other packetizers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:04 +02:00
Martin Storsjö
7c1e2e6466 rtpenc_xiph: Use AV_WB16 instead of manual bitshifts
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:54:00 +02:00
Martin Storsjö
d16c8d28d4 rtpenc_aac: Use AV_WB16 instead of manual bitshifts
This makes the code slightly more readable and understandable.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:57 +02:00
Martin Storsjö
9c9b0218e8 rtpenc_aac: Merge a definition with a declaration
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:54 +02:00
Martin Storsjö
1fc64e2e07 rtpenc: Write conditional statements on separate lines
Intentionally keeping some conditional statements on single lines
in rtpenc_h263.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:51 +02:00
Martin Storsjö
0662440b99 rtpenc_aac: Set a default value for max_frames_per_packet at init
This avoids having to conditionally set the default within the
packetizer function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:46 +02:00
Martin Storsjö
12b3459979 rtpenc_amr: Use s->num_frames instead of s->buf_ptr - s->buf
This doesn't fix any bug, but makes the code simpler for later
patches, and more straightforward to read as is.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:42 +02:00
Martin Storsjö
9856395344 rtpenc_aac: Fix sending fragmented frames
After sending a fragmented frame, len (s->buf_ptr - s->buf) isn't
zero, while s->num_frames is zero as intended. Using s->num_frames
makes it work as intended, and is less convoluted than keeping track
of (resetting) s->buf_ptr.

This avoids sending stray data after sending a fragmented aac packet.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:53:38 +02:00
Martin Storsjö
b9d2d6843a tls: Pass AVOptions dictionaries through to the chained protocol
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:08:19 +02:00
Martin Storsjö
e14f98c62f tcp: Clarify the units for the timeout avoptions
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:07:24 +02:00
Martin Storsjö
c86d8aed74 avio: Rename avclass symbols relating to avio
Don't prefix them ffio_url, which is misleading, sounding too
much like the urlprotocol layer (like ffurl_*).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:07:04 +02:00
John Stebbins
da7e561964 matroskaenc: Allow writing track "forced" flag
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-24 22:28:51 +01:00
Martin Storsjö
d594dbecce rtpdec: Rename the free method to close
Many of these functions were named foo_free_context, and since
the functions no longer should free the context itself, only
allocated elements within it, the previous naming was slightly
misleading.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:50 +02:00
Martin Storsjö
8e32b1f096 libavformat: Use ffio_free_dyn_buf where applicable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:47 +02:00
Martin Storsjö
199fb40278 rtpdec: Use ffio_free_dyn_buf
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:44 +02:00
Martin Storsjö
8a273a7460 avio: Add an internal utility function for freeing dynamic buffers
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:41 +02:00