Commit Graph

1072 Commits

Author SHA1 Message Date
David McPaul
51d9b4fe14 correct yuv422 planar conversion. Seperate sse, sse2 and ssse3 asm code. Add packed convertor
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-21 07:25:40 +00:00
François Revol
1828f3d72c Add a function to register media codec descriptions for the usual format families using the tag lists from libavformat itself. Untested. the plugin will also have to use av_codec_get_id() to get the codec ID from the tag.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-19 04:26:46 +00:00
Marcus Overhagen
699dc0e367 Very ugly hack to make DVB addon find the MPEG and AC3 codecs.
Something appeards to be very wrong with codec registration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39885 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-17 23:17:21 +00:00
Marcus Overhagen
4da4784afa added come debugging code
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39884 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-17 22:35:44 +00:00
Marcus Overhagen
bcdc4db3e5 adjust file path to channel setting files
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-17 21:54:53 +00:00
Jérôme Duval
3ae6771c5f merged ffmpeg 0.6.1 into trunk
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-21 17:51:21 +00:00
Jérôme Duval
ebe3c563da Fills frame variable even when not seeking to frame. This fixes bug #6828.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39540 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-20 16:49:34 +00:00
Jérôme Duval
cf85a555b0 * added some missing bits and removed obsolete files in ffmpeg-0.6
* replaced .. with $(DOTDOT) in Jamfiles
* added __STDC_CONSTANT_MACROS define for C++ files (required for UINT64_C)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-20 15:59:05 +00:00
Philippe Houdoin
801843aed6 Patch by Barrett:
Initialize the stream's IO buffer, otherwise it could crash in ~StreamBase().
It's only initialized when the media format was actually successfully probed.
Fix #6595. Thanks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39374 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-09 15:46:23 +00:00
Stephan Aßmus
4c9da6dc09 Applied patch by kaliber from ticket #6349. which fixes quite a
few warnings. Thanks! I did not apply the hunks about moving
a logging function in the common accelerant code to be static.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39320 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-06 10:17:41 +00:00
Matt Madia
ca093f29a9 Use ffmpeg's ogg headers to allow matroska to compile.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-31 15:42:21 +00:00
Clemens Zeidler
1672b85c40 Use some more meaningful names in the metadata message. Used the names from the id3v2.c ffmpeg file. Stippi does this really fix the TODO?
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39225 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-31 09:56:02 +00:00
Stephan Aßmus
657983b8c2 * Introduce some currently disabled code to store the AVCodecContext
pointer in the media_format user data section.
 * In the AVCodecEncoder, optionally use the AVCodecContext pointer
   from the AVFormatWriter instead of its own instance. The problems
   I am investigating are not improved by this, but it may be needed
   anyway.
 * Map the bitrate for audio to a fixed table. Certain encoders will
   refuse to use a non-standard bitrate, like the currently enabled
   AC-3 encoder.
 * Fixed tracing output in _EncodeAudio().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39039 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-21 10:29:20 +00:00
Stephan Aßmus
bb188e4d73 Fix crash introduced as a last minute change... need to
find a way to do this properly, though. The pixel format
selected by AVCodecEncoder should match here.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39037 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 22:01:24 +00:00
Stephan Aßmus
69372b5545 * Change the signature of the Writer plugins setup methods such
that they can modify the media_format passed in. For example they
   can store information in the user_data section. I don't actually
   use this anymore, but it may come in handy again.

AVFormatWriter:
 * Adjust the AVCodecContext flags not only for video, but also
   for audio streams (as the API example does). This mechanism
   may not yet work, since the AVCodecEncoder actually uses a
   different AVCodecContext instance.
 * Use the encodeInfo->flags and specify the key frame flag
   for the AVPacket. This finally makes videos encoded on Haiku
   seekable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 21:36:23 +00:00
Stephan Aßmus
6e544b050e Enable the MJPEG encoder.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39034 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 21:29:16 +00:00
Stephan Aßmus
7d5bc29832 * Removed a big chunk of dead or outdated code. It was really
hard to see the big picture and tell what actually works
   in the higher levels of the code.
 * Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39033 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 21:28:18 +00:00
Stephan Aßmus
88eddd3d71 * Specify length of Group of Pictures as in API example.
* Don't hardcode PIX_FMT_YUV420P, but use the color space
   from the list of codec supported ones which has the best
   quality.
 * Maintain media_encode_info->flags by specifying whether
   a chunk contains a keyframe. According to the libavformat
   API example, all audio chunks are keyframes. For video
   chunks, use the fContext->coded_frame->key_frame flag.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39032 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 21:25:43 +00:00
Stephan Aßmus
eca9668a4a Enable DV format (muxer) and DV encoder. It works, but only for
certain video sizes (720x576 for example) and with 48 kHz raw
audio. Clockwerk actually uses a mechanism which worked on BeOS
to check if an encoder would accept a certain media_format, but
this does not yet work on Haiku and thus the format is available
even when trying to render later will fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-15 15:27:16 +00:00
Stephan Aßmus
fb39b6c84d Enable compilation of some files necessary for FLAC and AAC encoding.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-15 15:23:49 +00:00
Stephan Aßmus
c0803bc585 My "fix" to the MPEG4 encoder was wrong. The h263 encoder had to
be enabled in config.h. That's the case now, but I did this change
later and didn't realize it would fix MPEG4 encoding.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-15 15:17:32 +00:00
Stephan Aßmus
ec3e003296 * Refactored calculating the bitrate based on raw bitrate
and quality in audio and video AVCodecContext setup code
   paths.
 * Disabled some debug output


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38975 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-15 15:12:25 +00:00
Stephan Aßmus
7c143ae93e Long overdue coding style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-15 15:04:24 +00:00
Stephan Aßmus
41457111ec * Try harder to seek somewhere and fall back to seeking
to the beginning of the stream by bytes, if all else
   fails.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 15:20:12 +00:00
Stephan Aßmus
06d9236554 Enable H263 encoders.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38852 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 15:18:30 +00:00
Stephan Aßmus
96590b5bf7 * Do no manually allocate the buffer for the
ByteIOContext. libavformat may reallocate it
   on demand, we need to use the matching allocation
   methods.
 * Init the ByteIOContext with the proper "write flag".
   This solves a busy loop when writing the trailer of
   MKV files, since the first buffer was initially skipped
   and the MKV muxer can not seek back in the stream
   where it wants.
 * Get rid of the fCalculatePTS member, and calculate
   PTS of audio packets as well. I don't remember why
   I prevented that, however VLC complains about audio
   packets having wrong PTS (with or without this change)
   Our own MediaPlayer plays videos generated by (a modified)
   Clockwerk at least once, but seeking subsequently fails.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38851 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 15:17:35 +00:00
Stephan Aßmus
8218710526 Do not write an audio packet if the encoder has not produced
any encoded data yet. Fixes encoding of Vorbis audio.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38850 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 15:11:28 +00:00
Stephan Aßmus
8be096e0f7 Fix codec initialization. The mpeg4 and h263 codecs were split,
and there is also ituh263enc.c, of which I am unsure how it
fits into the picture. However the mpeg4 encoder is using a "RL"
table of the h263 encoder, and it appears it was forgotten to
make sure it's initialized when splitting these files. Should
be upstreamed. Fixes a crash when trying to use the MPEG4 encoder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38847 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 10:07:14 +00:00
Stephan Aßmus
73dcf86fdc * Don't create Stream cookies for unsupported media formats.
Some test clips with sub-title tracks would hang MediaPlayer
   without this fix here.
 * Optimize FindKeyFrame() and Seek(), check the range between
   last requested/reported frame and bail out early with the
   same result. Seems to fix MediaPlayer starting to drop frames
   when it got caught up in a keyframe finding party...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38808 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-24 20:14:10 +00:00
Stephan Aßmus
af0f809b75 Rewrote finding keyframes and seeking. The problem was that
in many situations, FindKeyframe() was unable to reliably
predict what frame Seek() would be able to seek to.
 * Refactored a new base class StreamBase from the old
   StreamCookie, renamed StreamCookie to just Stream.
 * In FindKeyframe(), Stream will create a "ghost" StreamBase
   instance. That one will be used to actually seek in the
   stream without modifying the AVFormatContext of the real
   Stream. From that we can tell what position we can /really/
   seek to. For AVIs mostly, it is important to still use
   av_index_search_timestamp(), since for many AVIs I tested,
   reading the next packet after seeking did not produce a
   timestamp, however the index entry contained just the correct
   one. If the next packet does contain a PTS, it will still
   override the index timestamp, though.
 * Contrary to my previous belief, there was still a locking
   problem with how MediaPlayer used the BMediaTracks. The video
   decoding thread and the playback manager both used
   FindKeyframe() without holding the same lock. We support this
   now by using one BLocker per Stream. (The source BDataIO is
   still protected by another single lock.) With the new ghost
   stream stuff, the locking problem became much more of a problem,
   previously the FindKeyframe() had a much rarer race condition
   which would only trip when the decoding thread would cause new
   index entries to be inserted into the index.
 * Use the same ByteIOContext buffer size that avformat would be
   using if it initialized the ByteIOContext through other API.
 * Don't leak the probe buffer in case of error.
 * Don't leak the ByteIOContext buffer in the end.
 * Do not discard other stream packets anymore, this makes the
   ASF demuxer happy and ASF files can now be seeked as well as
   with ffplay itself.

With these changes, all my MPEG test streams work. Some could be seeked
before, but would show bad artifacts. Some streams would completely loose
video after seeking once. My MPEG2 test stream works much better now,
although audio is slightly out of sync, unfortunately. All my test AVIs
work as good as before, MP4 and MKV still work perfectly. The single
test ASF I got is now perfectly seekable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-24 16:54:42 +00:00
Stephan Aßmus
954d70d8c0 * Renamed fAudioTempPacket to fTempPacket and use it for calling
the new video decoding function. This just avoids a warning
   generated from the libavcodec sources. The function used before
   did the exact same thing...
 * Maintain fStartTime correctly in _DecodeVideo(). Don't overwrite
   it with a calculated starttime in Decode(). This will allow drift
   to bubble up to the higher layers.
 * Do not use the previously required hack to close and reopen the
   AVCodec after seeking. avcodec_flush_buffers() seems to work
   fine now, and for certain stream types (MPEG1, MPEG2 video for
   example) the keyframe is correctly used after seeking.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-24 16:40:56 +00:00
Stephan Aßmus
c1e73fbf52 Enabled any and all decoders and demuxers which are currently compiled into
FFmpeg. It's a bit sad, but this obsoletes pretty much all other decoder
and reader plugins. Some of them were built on external libraries as well
(AC3 (not part of default image anyway, since it's GPL), APE, MusePack),
so it's not really a big difference to using FFmpeg as external library.
The format matching is greatly simplified by using B_MISC_FORMAT_FAMILY
for everything but raw audio, and the actual FFmpeg CodecID as codec tag.
The downside of this is that the AVFormatReader can no longer be used with
other decoder plugins, but it would be easy to add special cases for native
decoders we wish to support. Obviously the out of the box support for file
formats and decoders has greatly increased with this change, so there has
to be a pretty good reason now for writing a "native" decoder or reader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-22 11:10:51 +00:00
Stephan Aßmus
d62aaeb68d * Changed pretty extractor names to sentence casing.
* Enabled SWF demuxer in FFmpeg (though the one test file
   I have is compressed, which is not supported by the FFmpeg
   SWF demuxer...).
 * Removed testing TODOs for demuxers that I tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38761 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-21 16:00:50 +00:00
Stephan Aßmus
5051e989f6 Committed more than I intended to in the last commit. Sorry.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-20 19:05:06 +00:00
Stephan Aßmus
b145959bdd * Use the same GCC flags for GCC4 that configure in the FFmpeg source
itself generates.
 * For GCC2, FFmpeg uses -fPIC instead of -DPIC. Also disable SSE for
   GCC2, since that fixes a crash in the SSE version of clear_block().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38747 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-20 19:03:03 +00:00
Stephan Aßmus
d3aadcff6c In FFmpeg SVN r22715 (I suppose), there was an optimization done to
speed up VLC table (whatever it is) initialization. Somehow the code
does not work on GCC2. Use the old code we had previously in SVN
minus a flag (INIT_VLC_USE_STATIC) which is no longer used in FFmpeg.
This fixes the GCC2 build of FFmpeg and closes Ã#6643, #6582 and #656.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38746 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-20 18:24:31 +00:00
Stephan Aßmus
e111b1c12f For GCC2, the FFmpeg configure script is generating a slightly
different config.h, of which I am adapting the differences in this
commit. Does not change a thing for the broken GCC2 build of FFmpeg.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38745 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-20 18:01:22 +00:00
Stephan Aßmus
6df16a01ed * Seeking by bytes works mostly correctly now. In some
mpgs, the video does not recover, though.
 * Remember the last reported keyframe information, so we
   avoid rounding artifacts. Not as effective, since we
   cannot use stream time-base for seeking, but have to use
   it for finding the keyframes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38706 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-18 15:11:50 +00:00
Stephan Aßmus
2e54e93fbf Finall changed the Seek() method of Decoder plug-ins to
SeekedTo(), since it's only informative to decoders. They
can't modify the seeked frame/time. This also mirrors what
all existing decoders were doing in Seek(). BMediaTrack
is simplified accordingly (resolved two TODOs).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38705 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-18 14:44:22 +00:00
Stephan Aßmus
3c0f00c5ec * Theoretically implemented seeking by bytes,
if the input format requires it. Practically,
   it does not work.
 * Implement the new meta-data API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-17 08:06:55 +00:00
Stephan Aßmus
8a7cbd8350 Always ignore found index entries after we detect
the stream is building the index on the fly once.
This allows to seek back to earlier positions, since
then the index will contain entries for later in the
stream and the logic to detect auto-generated indices
was broken.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38678 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-16 15:27:16 +00:00
Stephan Aßmus
7b61b6b8e4 Finally: Seeking audio in MKV files works when seeking the
muxer by the "default" stream. When I previously tried this,
I mistakenly remembered AV_TIME_BASE to be 1000, but it's
1000000, the same as the native bigtime_t time representation.
Luckily, we can still set all other streams (including the
"default" stream) to be discarded when obtaining chunks
packets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38677 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-16 15:13:24 +00:00
Stephan Aßmus
6936b3ba4f Added support for bz2 compressed stuff in Matroska containers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-16 13:57:33 +00:00
Stephan Aßmus
51802669a5 Fixed a warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38673 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-16 13:56:12 +00:00
Stephan Aßmus
2baccbd9fb Fix retrieving the frame rate for real. Apparently
it can be any of these values, hope the priority is right.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38659 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-15 16:32:44 +00:00
Stephan Aßmus
31879da81c Use the correct field of the AVStream for the video
frame rate (perhaps it changed in 0.6?). This fixes
playback of several MP4 clips I have for testing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38658 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-15 08:35:47 +00:00
Stephan Aßmus
5a6b18e914 * Print the performance stats every five frames, and reset
the counters, so it's not the average for the entire
   decoding time, but for the last five frames. This gives
   a more accurate picture of what's going on.
 * Added NOTE about possibly removing the SWS version of the
   colorspace conversion code unless it's used for otherwise
   unsupported conversions. David's code is about 40% faster
   in my tests (nice job!).
 * Free the sws context in NegotiateVideoFormat, if necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38651 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-14 18:43:58 +00:00
Stephan Aßmus
5021eb2421 Removed the "native" ogg, vorbis, theora and speex plugins in favor
of support for these codecs and demuxer in the FFmpeg plugin. The
ogg test streams I downloaded play fine now. For example, Big Buck Bunny
would play without video before and ogg files natively encoded with the
FFmpeg plugin wouldn't play at all. Since the removed plugins were not
maintained and were based on external libs themselves, I didn't see the
point in keeping them.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38646 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-14 12:32:04 +00:00
Stephan Aßmus
594039f10d Imported libspeex 1.2rc1 for use in libavcodec's libspeexdec.c.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-14 12:24:09 +00:00
Stephan Aßmus
73e5249c79 * Enabled libvorbis and libtheora encoders in FFmpeg
* Enabled ogg muxer in MuxerTable.

ogg/vorbis creation successfully tested with MediaConverter.
ogg/theora needs more testing, it seems to work, but I need
to switch from the other vorbis/theora/ogg plugins to the
FFmpeg built-in support, otherwise the current theora stream
is not supported by the old plugin.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38641 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-13 20:25:24 +00:00