Commit Graph

8305 Commits

Author SHA1 Message Date
Martin Storsjö 705eeb5eca rtsp: Fix a typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-12 16:27:00 +02:00
Diego Biurrun ffae713a5b Fix a bunch of common typos. 2012-03-09 22:02:49 +01:00
Alex Converse 100c3fb2d1 mpegts: Always honor a registration descriptor if present and there is no other codec information. 2012-03-09 09:48:14 -08:00
Martin Storsjö 6294d708b8 rtsp: Only set the ttl parameter if the server actually gave a value
Passing ttl=0 to the rtp/udp url contexts makes packets never
leave the host machine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:04:32 +02:00
Martin Storsjö 2bfd92b330 udp: Set ttl for read-write streams, too, not only for write-only ones
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:04:05 +02:00
Martin Storsjö c700fdb00f udp: Only bind to the multicast address if in read-only mode
This fixes sending back RTCP RR packets if receiving RTP over
multicast.

If the multicast stream is sent on demand (set up and signalled
via RTSP), the sender might depend on getting RTCP RR packets
knowing that there are listeners, otherwise the stream can be
closed after a certain timeout.

This fixes receiving RTSP streams over multicast on unix, from
certain Axis cameras.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:03:46 +02:00
Martin Storsjö 1b89bcdd7f udp: Clarify the comment about binding the multicast address
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:03:11 +02:00
Martin Storsjö 113d3e106d udp: Reorder comments
When this code was added in 36b532815c, the new code was added
between the existing comment and the existing line of code, making
the old comment seem to refer to the new code. This makes it read
correctly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:03:10 +02:00
Dale Curtis ef0d779706 Fix uninitialized reads on malformed ogg files.
The ogg decoder wasn't padding the input buffer with the appropriate
FF_INPUT_BUFFER_PADDING_SIZE bytes. Which led to uninitialized reads in
various pieces of parsing code when they thought they had more data than
they actually did.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-03-08 11:52:15 -08:00
Martin Storsjö 94f1b11a6f rtpenc: Fix the AVRational used for av_rescale_q_rnd
The current one has a zero denominator - this is what was
intended in 14aecc50fa.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-08 01:15:28 +02:00
Martin Storsjö a887c87c23 udp: Print an error message if bind fails
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-07 21:52:19 +02:00
Ronald S. Bultje a93b572ae4 smacker: error out if palette copy-with-offset overruns palette size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-07 09:35:03 -08:00
Carl Eugen Hoyos a294a7a1b3 mov: Allow last chunk to have an arbitrary number of samples.
Fixes ticket #673.
(cherry picked from commit 8dcd2a41ec)

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:25:34 -08:00
Reimar Döffinger 632eb1bbae cdxl demux: do not create packets with uninitialized data at EOF.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-03-05 16:27:31 -05:00
Justin Ruggles 94cf64b81f cosmetics: reindent 2012-03-05 13:08:19 -05:00
Justin Ruggles 8c1d6ac66a avformat: do not require a pixel/sample format if there is no decoder
Also, do not keep trying to find and open a decoder in try_decode_frame() if
we already tried and failed once.

Fixes always searching until max_analyze_duration in
avformat_find_stream_info() when demuxing codecs without a decoder.
2012-03-05 13:08:18 -05:00
Justin Ruggles a7fa75684d avformat: do not fill-in audio packet duration in compute_pkt_fields()
Use the estimated duration only to calculate missing timestamps if needed.
2012-03-05 13:08:18 -05:00
Justin Ruggles 6c65cf58fd lavf: Use av_get_audio_frame_duration() in get_audio_frame_size()
Also, do not give AVCodecContext.frame_size priority for muxing.

Updated 2 FATE references:
dxa-feeble - adds 1 audio frame that is still within 2 seconds as specified
             by -t 2 in the FATE test
wmv8-drm-nodec - durations are not needed. previously they were estimated
                 using the packet size and average bit rate.
2012-03-05 13:08:18 -05:00
Justin Ruggles f1e73100d9 siff: do not set AVCodecContext.frame_size
also, properly set AVCodecContext.bits_per_coded_sample, AVStreasm.start_time,
and AVPacket.duration.
2012-03-05 13:08:17 -05:00
Justin Ruggles ec2e767bf3 amr demuxer: do not set AVCodecContext.frame_size.
it is not necessary.
2012-03-05 13:08:17 -05:00
Justin Ruggles 8d1a20aa7c aiffdec: do not set AVCodecContext.frame_size
It is unnecessary. Also, for some codecs we're reading more than 1 frame per
packet. Instead we use a private context variable to calculate the bit rate,
stream duration, and packet durations.

Updated FATE seek test, which has slightly different timestamps due to a
more accurate bit rate calculation.
2012-03-05 13:08:17 -05:00
Justin Ruggles 237a855caf mov: do not set AVCodecContext.frame_size
It is not necessary.
2012-03-05 13:08:17 -05:00
Justin Ruggles 9727264220 ape: do not set AVCodecContext.frame_size.
prevents lavf from setting incorrect packet durations.
2012-03-05 13:08:17 -05:00
Justin Ruggles 2dd18d4435 rdt: remove workaround for infinite loop with aac
avformat_find_stream_info() no longer hangs while waiting for AAC frame_size
2012-03-05 13:08:16 -05:00
Justin Ruggles 9c365fe8ae avformat: do not require frame_size in avformat_find_stream_info() for CELT
In Ogg/CELT, frame_size is found in the same place as the sample_rate and
channels, so we do not need to force the frame_size to be parsed.
2012-03-05 13:08:16 -05:00
Justin Ruggles fbc8c59679 avformat: do not require frame_size in avformat_find_stream_info() for MP1/2/3
It was only needed to avoid a bad time base (and thus non-monotone timestamps)
for stream copy to avi.
2012-03-05 13:08:16 -05:00
Justin Ruggles 84b6ae0808 avformat: do not require frame_size in avformat_find_stream_info() for AAC
We already will get the needed info because of CODEC_CAP_CHANNEL_CONF
2012-03-05 13:08:16 -05:00
Justin Ruggles 620b88a302 swfenc: use av_get_audio_frame_duration() instead of AVCodecContext.frame_size
This way we can do stream copy without having the demuxer wait until
frame_size has been set.
2012-03-05 13:08:16 -05:00
Justin Ruggles 14aecc50fa rtpenc: use av_get_audio_frame_duration() for max_frames_per_packet
It is more reliable than AVCodecContext.frame_size for codecs with constant
packet duration.
2012-03-05 13:08:16 -05:00
Justin Ruggles c019070fda riffenc: use av_get_audio_frame_duration()
For encoding, frame_size is not a reliable indicator of packet duration.
Also, we don't want to have to force the demuxer to find frame_size for
stream copy to work.
2012-03-05 13:08:15 -05:00
Anton Khirnov 27c7ca9c12 lavf: deobfuscate read_frame_internal().
Split off packet parsing into a separate function. Parse full packets at
once and store them in a queue, eliminating the need for tracking
parsing state in AVStream.

The horrible unreadable loop in read_frame_internal() now isn't weirdly
ordered and doesn't contain evil gotos, so it should be much easier to
understand.

compute_pkt_fields() now invents slightly different timestamps for two
raw vc1 tests, due to has_b_frames being set a bit later. They shouldn't
be more wrong (or right) than previous ones.
2012-03-05 18:47:05 +01:00
Anton Khirnov dcee811505 lavf: make read_from_packet_buffer() more flexible.
Make packet buffer a parameter, don't hardcode it to be
AVFormatContext.packet_buffer.

Also move the function higher in the file, since it will be called from
read_frame_internal().
2012-03-05 18:44:45 +01:00
Anton Khirnov 52b0943f10 lavf: factorize freeing a packet buffer. 2012-03-05 18:44:30 +01:00
Diego Biurrun 0a41f47dc1 dv: Do not redundantly initialize struct members to zero. 2012-03-05 17:02:59 +01:00
Justin Ruggles b7beabab4b tiertexseq: set correct block_align for audio 2012-03-03 17:03:27 -05:00
Justin Ruggles f9cf91d822 tiertexseq: set audio stream start time to 0
Update FATE test to reflect delayed video due to the file having audio-only
frames prior to the first frame with video.
2012-03-03 17:03:27 -05:00
Justin Ruggles 0883109b27 voc/avs: Do not change the sample rate mid-stream.
Also, set the time base based on the sample rate.
lavf-voc seek test updated to reflect slightly different seek points.
2012-03-03 17:03:27 -05:00
Justin Ruggles 4da374f8a9 segafilm: use the sample rate as the time base for audio streams 2012-03-03 17:03:27 -05:00
Justin Ruggles ea289186f0 ea: fix audio pts
The time base is 1 / sample_rate, not 90000.
Several more codecs encode the sample count in the first 4 bytes of the
chunk, so we set the durations accordingly. Also, we can set start_time and
packet duration instead of keeping track of the sample count in the demuxer.
2012-03-03 17:03:27 -05:00
Justin Ruggles 01be6fa926 psx-str: fix audio pts
Each packet has 18 sectors with 224/channels samples in each sector.
2012-03-03 17:03:27 -05:00
Justin Ruggles d0ab585074 vqf: set packet duration
Fixes timestamp calculation.
The FATE reference is updated because timestamp calculations are now more
accurate. Previous timestamps were based on average bit rate.
2012-03-03 17:03:26 -05:00
Justin Ruggles 101c369b7c tta demuxer: set packet duration 2012-03-03 17:03:26 -05:00
Justin Ruggles 5a9b952201 thp: set audio packet durations 2012-03-03 16:58:45 -05:00
Justin Ruggles 5602a464c9 avcodec: add a Vorbis parser to get packet duration
This also allows for removing some of the Vorbis-related hacks.
2012-03-03 16:43:11 -05:00
Alex Converse 1aa708988a mpegts: Pad the packet buffer in handle_packet().
This allows it to be used with get_bits without the thread of overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-02 15:44:42 -08:00
Alex Converse 4df369692e mpegts: Do not call read_sl_header() when no bytes remain in the buffer.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-02 15:44:42 -08:00
Ronald S. Bultje 9c239f6026 matroska: check buffer size for RM-style byte reordering.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-02 10:32:22 -08:00
Alex Converse 1697c29d75 rmdec: Honor .RMF tag size rather than assuming 18. 2012-03-02 09:31:32 -08:00
Anton Khirnov 56bf24ad78 r3d: don't set codec timebase.
It's not supposed to be set by demuxers.

Set avg_frame_rate and r_frame_rate instead.
2012-03-02 17:21:45 +01:00
Anton Khirnov efec3bc65a electronicarts: set timebase for tgv video.
The container has no timestamps and the framerate isn't stored in the
data either.
The decoder sets codec timebase to experimentally found value 1/15. Do
the same for the demuxer too, it should at least be better than the
default 1/90000.
2012-03-02 11:11:38 +01:00
Anton Khirnov e39400c3a8 electronicarts: parse the framerate for cmv video. 2012-03-02 11:11:38 +01:00
Anton Khirnov 1bb3990b56 ogg: don't set codec timebase
Demuxers are not supposed to set it.
2012-03-02 11:11:38 +01:00
Anton Khirnov 1d3144c318 electronicarts: don't set codec timebase
Demuxers are not supposed to set it.
Set stream timebase and framerates instead (this is a cfr container with
no timestamps).
2012-03-02 11:11:38 +01:00
Anton Khirnov 10a6e0c346 avs: don't set codec timebase
Demuxers are not supposed to set it.
Set r_frame_rate and avg_frame_rate instead.
2012-03-02 11:11:38 +01:00
Ingo Brückl c05e2be9a2 mp3dec: Fix reading file size and frames in VBRI headers
The fields "Number of Bytes" and "Number of Frames" are mixed up. "Bytes"
come first, "Frames" behind.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-01 15:32:28 -08:00
Diego Biurrun 75c553eb26 rmdec: adjust printf format string specifier to fix warning
libavformat/rmdec.c:383: warning: format ‘%d’ expects type ‘int’, but argument 7 has type ‘int64_t’
2012-03-01 23:11:14 +01:00
Martin Storsjö 984b914c55 rtpenc: Use MB info side data for splitting H263 packets for RFC 2190
This makes the packetization spec compliant for cases where one single
GOB doesn't fit into an RTP packet.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-01 16:08:32 +02:00
Justin Ruggles 929dd8c108 dxa: set audio stream time base using the sample rate 2012-02-29 15:45:50 -05:00
Justin Ruggles aa831c4093 psx-str: do not allow seeking by bytes 2012-02-29 15:45:50 -05:00
Justin Ruggles bdbf1fa405 asfdec: Do not set AVCodecContext.frame_size 2012-02-29 15:45:50 -05:00
Justin Ruggles 4bf6775e9d vqf: set packet parameters after av_new_packet()
Otherwise the values are overwritten.
2012-02-29 15:45:50 -05:00
Martin Storsjö 07ec1f2140 rtpenc: Fix setting the max packet size
This fixes cases where the user had specified one desired MTU
via an option, and the protocol indicates another one.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-29 16:48:01 +02:00
Anton Khirnov 322537478b Add a minor bump, changelog/APIchanges entry and some documentation for APIC support. 2012-02-29 14:44:22 +01:00
Anton Khirnov 2dfea12058 mp3enc: write attached pictures (APIC). 2012-02-29 14:37:00 +01:00
Anton Khirnov c68148b1ea mp3enc: move mp3_write_xing() further up in the file.
It will be need by new functions called from mp3_write_trailer().
2012-02-29 14:36:45 +01:00
Anton Khirnov ba445f5557 id3v2enc: add a function for writing attached pictures.
Unused so far.
2012-02-29 14:31:17 +01:00
Anton Khirnov 24fe1a3b16 id3v2enc: fix writing frame sizes for ID3v2.3
Frame sizes in ID3v2.3 are not synchsafe, they are simply 32be numbers.

In practice this bug is not noticeable unless the frame size takes more
than 7 bits (which is almost never for text frames).
2012-02-29 14:30:14 +01:00
Anton Khirnov 411225aabc id3v2enc: split ff_id3v2_write().
This will allow writing the tag in several steps, needed for writing
attached pictures.
2012-02-29 14:26:14 +01:00
Anton Khirnov c199817748 id3v2enc: make id3v2_put_size take only an AVIOContext.
It has no need of full AVFormatContext.
2012-02-29 14:25:33 +01:00
Anton Khirnov 393fd0d89e id3v2: remove unused ff_id3v2_read().
Rename ff_id3v2_read_all to ff_id3v2_read().
2012-02-29 14:19:42 +01:00
Anton Khirnov 079ea6ca5f lavf: export id3v2 attached pictures as streams. 2012-02-29 14:16:32 +01:00
Anton Khirnov dd2a4bcfd7 lavf: generic code for exporting attached pictures. 2012-02-29 14:16:25 +01:00
Anton Khirnov a93b09cb45 id3v2: read attached pictures and export them in ID3v2ExtraMeta. 2012-02-29 14:14:48 +01:00
Anton Khirnov b73ad74660 lavf: move CodecMime from matroska.h to internal.h
it will be useful for attached pictures in ID3v2
2012-02-29 13:57:59 +01:00
Anton Khirnov eaea76d72c swfdec: do not set codec timebase.
It is not supposed to be set outside of lavc.

Fixes a divide by zero when the stored framerate is 0.
2012-02-29 13:52:55 +01:00
Anton Khirnov 4f07f8196c lavc: deprecate AVCodecContext.color_table_id.
It's currently only used as temporary storage by the mov demuxer. Make
it use a local variable instead.
2012-02-29 07:25:00 +01:00
Anton Khirnov 63efd83ae1 mpegvideo_enc: add chroma/luma_elim_threshold private options.
Deprecate corresponding AVCodecContext fields.
2012-02-29 07:23:31 +01:00
Ronald S. Bultje bb6d5411e1 asf: don't seek back on EOF.
Seeking back on EOF will reset the EOF flag, causing us to re-enter
the loop to find the next marker in the ASF file, thus potentially
causing an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-28 16:25:05 -08:00
Ronald S. Bultje 6e57a02b9f asf: error out on ridiculously large minpktsize values.
They cause various issues further down in demuxing.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-28 14:32:34 -08:00
Ronald S. Bultje 934cd18a43 oma: don't read beyond end of leaf_table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-28 11:58:13 -08:00
Diego Biurrun cfac648e6a doxygen: Remove documentation for non-existing parameters; misc small fixes. 2012-02-28 20:48:43 +01:00
Luca Barbato 0c1759ac4b segment: implement wrap around
Provide a way to wrap around the segment index so pseudostreaming
live through a web server and html5 browser is simpler.

Also ensure that 0 (disable) is a valid value across the options
providing wrap around.
2012-02-28 15:01:20 +01:00
Luca Barbato ee42df8a35 avf: reorder AVStream and AVFormatContext 2012-02-28 15:01:20 +01:00
Michael Niedermayer e60bdb7e5c flvdec: Remove the now redundant check for known broken metadata creator
The index validation identifies these indexes as broken.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-27 12:07:24 +02:00
Martin Storsjö 7e297a46db flvdec: Validate index entries added from metadata while reading
By validating the index entries while reading, we don't need to
seek at startup to validate the entries. If the error in the
index entries is not pointing to (our definition of) the start
of packets, and there is an index entry pointing at some of the
first packets after the metadata, the invalid index can be discarded
almost immediately.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-27 12:07:24 +02:00
Tommy Winther 1a6b9a98ce rtsp: Handle requests from server to client
This returns 200 OK for OPTIONS requests and 501 Not Implemented
for all other requests.

Even though this doesn't do much actual handling of the requests,
it makes the code properly identify server requests as such, instead
of interpreting it as a reply to the client's request as it did
before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-27 12:04:11 +02:00
Justin Ruggles f234e8a32e movenc: use timestamps instead of frame_size for samples-per-packet
For encoding, AVCodecContext.frame_size is the number of input samples to
send to the encoder and does not necessarily correspond directly to the
timestamps of the output packets.
2012-02-27 04:33:37 -05:00
Justin Ruggles f3dab5fb6d movenc: use the first cluster duration as the tfhd default duration 2012-02-27 04:33:37 -05:00
Justin Ruggles 681d17264f movenc: factorize calculation of cluster duration into a separate function 2012-02-27 04:33:37 -05:00
Anton Khirnov 7929e22bde lavf: don't guess r_frame_rate from either stream or codec timebase.
Neither of those is guaranteed to be connected to framerate in any way
(if it even exists).

Fixes bug 56.
2012-02-26 19:32:33 +01:00
Anton Khirnov d3783f47ee lavf: don't set codec timebase in avformat_find_stream_info().
It's not supposed to be set outside of lavc.
2012-02-26 07:51:12 +01:00
Anton Khirnov 87d7a92b62 rawdec: set timebase to 1/fps. 2012-02-26 07:30:21 +01:00
Ronald S. Bultje cd40c31ee9 matroska: don't overwrite string values until read/alloc was succesful.
This prevents certain tags with a default value assigned to them (as per
the EBML syntax elements) from ever being assigned a NULL value. Other
parts of the code rely on these being non-NULL (i.e. they don't check for
NULL before e.g. using the string in strcmp() or similar), and thus in
effect this prevents crashes when reading of such specific tags fails,
either because of low memory or because of targeted file corruption.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-25 07:53:23 -08:00
Anton Khirnov 655b24c01c lavf: move the packet keyframe setting code.
compute_pkt_fields() is for unreliable estimates or guessing. The
keyframe information from the parser is (at least in theory) reliable,
so it should be used even when the other guessing is disabled with the
AVFMT_FLAG_NOFILLIN flag.

Therefore, move setting the packet keyframe flag based on parser
information from compute_pkt_fields() to read_frame_internal().
2012-02-24 19:43:02 +01:00
Justin Ruggles 9677247b0a oggenc: free comment header for all codecs
fixes a memleak for Vorbis and Theora, where the comment header from
avpriv_split_xiph_headers() is replaced by a buffer that must be freed
separately.
2012-02-24 13:15:41 -05:00
Anton Khirnov 5ff42e3138 lavf/output-example: use new audio encoding API correctly. 2012-02-24 09:44:18 +01:00
Anton Khirnov 6e9ed7c7ae lavf/output-example: more proper usage of the new API.
Passing the codec into avformat_new_stream() is preferred.
2012-02-24 09:44:17 +01:00
Paul B Mahol 14c98973f5 apetag: do not leak memory if avio_read() fails
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-02-23 16:16:37 -08:00
Ronald S. Bultje 6d11057006 apetag: propagate errors.
Fixes crashes if reading the tag value fails.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 15:53:26 -08:00
Ronald S. Bultje 31632e73f4 swf: check return values for av_get/new_packet().
Prevents crashers when using the packet if allocation failed.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 12:24:58 -08:00