History log of /haiku/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.cpp
Revision Date Author Comments
# 7804ba60 29-Dec-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: use new AVFifo API

Change-Id: I5712acc78087c00d066695eab6b2625316153f41
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7277
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 1774dd5e 29-Dec-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: channels and channel_layout are deprecated

Use ch_layout instead

Change-Id: I6a07870eae42836d3fd993c253613bc0f33b1598
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7252
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 9bf436a2 29-Dec-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: av_init_packet is deprecated

https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=3189

Change-Id: I5ac25141ce76b2f7737e2f1b7ce5c8eac4a90082
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7249
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# a5bcb6e0 21-Jan-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: fix incorrect error check

The function returns a positive nonzero value when it works.

Change-Id: I99ee3e2f8f60dff960a07fefc1cf42dc3b3969cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6013
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# e35a296e 21-Jan-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: fix missing initialization of AVFrame

ffmpeg API reference does not allow to allocate AVFrame on the stack,
and especially not without initializing anything in the frame. Calling
av_frame_unref then attempts to free some non-existing data, and
crashes.

The code for video was already using a correctly allocated frame, which
we can reuse here.

Fixes #17415

Probably fixes #16831

Change-Id: I9d6ee7724ab9f22547b0030de12542ef3a650640

fix avframe

Change-Id: I170597ec323ac67be460ccbab9dae5ee3e6e1b71
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6015
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 5500d616 21-Jan-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: fix build with tracing enabled

Change-Id: Ib563d45ea144c957aeb176dbb2c381a00a55b19e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6012
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 90e87426 22-Dec-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: enable Werror and fix all warnings

Warnings fixed include usage of various deprecated functions, structures
and fields of ffmpeg.

Change-Id: I8d6338ad282f214a805b8d746ce22e2f0895fb25
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5954
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# beff8fa7 22-Dec-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

ffmpeg: leak when re-allocating ffmpeg context

The _Setup method can be called several times if the parameters are
changed (for example when calling SetQuality). But it always allocated a
new context without freeinthe previous one, resulting in a leak.

Part of #9458, it fixes the largest leak there (10K bytes for each loop
of the provided test) but there are other leaks left as well, some of
which apparently need an update to a newer ffmpeg version removing some
deprecated fields.

Change-Id: Iad119dbda9cff1ce023b602a1978b100a1263f7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5953
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 3cf50159 05-Sep-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

ffmpeg: improve context allocation

The context can be better allocated if it knows which codec it will be
used with (preallocating things with the correct size). To do this we
need to delay allocation from the constructor to the Init method.


# a11a58d4 05-Aug-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

ffmpeg: avoid assert in ffmpeg

The input colorspace must be set.


# 218a8c03 17-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

Revert the Codec Kit.

All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.

Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0


# cd564566 24-Nov-2018 Barrett17 <b.vitruvio@gmail.com>

ffmpeg: Update class names


# 1da12a78 16-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

Reintroduced keeping the state of failed initialization.
As Stephan said, some apps ignore the return value of Encode(),
and since _OpenCodecIfNeeded() is called from there, this could
cause wasting of cpu cycles.

Change-Id: I80e1464d8532ebf80c514685ef3a25d98d8142fb


# 53086e43 14-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

AVCodecEncoder: avcodec_close() is deprecated.
A codec context cannot be reopened, anymore.
Reorganize code accordingly.
Remove usage of the AVFormat context (which was not enabled, anyway) since it's no longer possible to do that.
Use av_frame_free() instead of av_free()


# 1d404e45 14-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

ffmpeg plugin: use avformat/codec_free_context() where applicable


# ee3e1cbe 14-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

Use the constant instead of the numeric value


# 373832ae 09-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

Commented calling _EncodeVideoFrame() with NULL.
As Adrian suggested, it's not only inefficient to do that there, but also wrong.
Modified the TODO comment
Added a new TODO comment


# f049e59f 09-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

Try to use the ffmpeg api more correctly:
call avcodec_receive_packet() in a loop, drain and flush the internal buffers.
Introduced private method to improve code readability (hopefully).


# 740114b8 07-Aug-2018 stefano <stefano@nb0001.iacpud.local>

Allocate the packet via ffmpeg.
Seems we aren't allowed anymore to handle it ourselves.


# c85dd27c 07-Aug-2018 JackBurton79 <stefano.ceccherini@gmail.com>

AVCodecEncoder: Use new API

Change-Id: I5b985cebf241e67f901e93a5a4bb61a67a659cdf


# 42cc4631 05-Aug-2018 Barrett17 <b.vitruvio@gmail.com>

ffmpeg: Fix typo and copyright notice


# 201707ae 05-Aug-2018 Barrett17 <b.vitruvio@gmail.com>

AVCodecEncoder: Skip frames

* Fix garbage put into videos while encoding.
* Testing welcome.
* Various fixes are still waiting to be merged into Haiku.
* Fixes sponsored by the V\OS project.


# b5d0ce85 05-Aug-2018 Barrett17 <b.vitruvio@gmail.com>

AVCodecEncoder/AVFormatReader: Remove kNoPTSValue hack


# 03437cd7 04-Aug-2018 Barrett17 <b.vitruvio@gmail.com>

AVCodecEncoder: Rename fContext to fCodecContext


# 334b8f3f 03-Aug-2018 Barrett17 <b.vitruvio@gmail.com>

ffmpeg: Remove obsolete code


# ea5cc699 29-May-2017 Dario Casalinuovo <b.vitruvio@gmail.com>

ffmpeg: Set frame's format, width and height from current context.

Fixes 12953.


# f97f2394 19-Feb-2016 Jérôme Duval <jerome.duval@gmail.com>

ffmpeg: update build with version 3.0.

* untested.


# 7f3ca22e 03-Dec-2015 Dario Casalinuovo <b.vitruvio@gmail.com>

AVCodecEncoder: Solve a crash at personalStudio startup

* This makes the app to start, but it's not enough
to have it show the window.


# c3b461d8 03-Dec-2015 Dario Casalinuovo <b.vitruvio@gmail.com>

AVCodecEncoder should not know the format


# 2b514992 02-Dec-2015 Dario Casalinuovo <b.vitruvio@gmail.com>

Initial implementation of BMediaEncoder

* People interested, please review!
* This is based on the patch from Fredrik Moden which was based on
the Oleg Krysenkov one.
* The original patch has been reworked by myself.
* Adapted the code to work with the new PluginManager API which
differently than before doesn't need to contact the media_server.


# 9e5c6946 30-Aug-2015 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: remove more deprecated functions.

These were all deprecated between releases 0.6 and 0.10 of ffmpeg,
except for one change (renaming of CodecID to AVCodecID) which we can
work around with a typedef. The deprecated functions were still
available in 0.11, but were removed later on after several years of
deprecation.

This makes it possible to build our plugin with any ffmpeg version
between 0.10 and 2.7, so we can now experiment with updating to 2.7 at
least for the gcc4 builds.


# 0717601a 29-Aug-2015 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg encoder: do not use deprecatred function

Replace avcodec_encode_audio with avcodec_encode_audio2. The latter
provides us with more information on the encoded data, so we can avoid
guessing things on our own. It also handles memory allocations on its
own, which fix some cases where we would provide a too small buffer.


# 5e0e1689 23-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: improve encoding format negociation

The ffmpeg encoders are restricted on which raw formats they accept
(each with different constraints). When asked to encode something, the
ffmpeg encoder now checks the codec capabilities and if the suggested
input format does not match, modifies it to something the codec can
actually handle.

Enable "experimental" codecs, as this is needed for AAC support in ffmpeg 0.10.

This allows format negociation to work properly, and as a result we can
enable several new audio formats: AAC (for MPEG family only), AC3, and
raw audio. Declare MKV as B_ANY_FORMAT_FAMILY since it is designed to be
a generic container (so it is possible to put AAC in MKV). Also remove
duplicate entries for AC3.


# 84e70401 24-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: update to 0.11.5.


# 51014b9e 14-Aug-2012 Matt Madia <mattmadia@gmail.com>

Revert "ffmpeg: switch to 0.11.1" (hrev44483)

This reverts commit 14b654326dc9c4b4ff38811672eb53e6723eece3.

Unfortunately that changeset causes a regression on GCC 2, which
makes playback of (some?) video impossible. This is due to Libavcodec
being miscompiled, which requires gcc >= 4.2

Resolves the regression of #8856, but does not fix the root issue.


# 14b65432 06-Aug-2012 Jérôme Duval <jerome.duval@gmail.com>

ffmpeg: switch to 0.11.1


# 5b93b447 21-Mar-2012 Jérôme Duval <jerome.duval@gmail.com>

ffmpeg: updated gcc2 package and fixed crashes on exit.

* replaced calls to free() with calls to av_free().
* updated gcc2 package to disable SSE and a few options like we had
before with 0.6.


# 657983b8 21-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# 88eddd3d 20-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# ec3e0032 15-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# 82187105 29-Sep-2010 Stephan Aßmus <superstippi@gmx.de>

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


# eb01f516 30-Aug-2010 Stephan Aßmus <superstippi@gmx.de>

The CodecID for raw-audio actually depends on the sample format
and can't be hard-coded in the EncoderTable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38464 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1679be 27-Aug-2010 Stephan Aßmus <superstippi@gmx.de>

* Improved some comments.
* When writing encoded audio, we were leaking one
temporary buffer per chunk.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59ec4d2f 06-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Disabled tracing.
* Use the configured source color space when converting instead of hardcoding
B_RGB32. (Resolved TODO)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0bdc769 21-Aug-2009 Jérôme Duval <korli@users.berlios.de>

* synced with ffmpeg-r19678, keeping gcc2 compiler #ifdef we introduced, build only tested on Haiku gcc2
* activated ac3 audio file format support
* uses format metadata to keep the codec context extra data (now needed for flac)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b9b5bf07 05-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed bugs when freeing the AVCodecEncoder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6780c24d 05-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Encoder:
* Fleshed out the Encoder API to support parameter setters/getters and returning
a BView for configuration. (Not yet sure if this is a good idea.)

BMediaTrack:
* Implemented all but one of the unimplemented methods in BMediaTrack. It should
be working as far as that class is concerned, unless I missed some of the
vision. ReplaceFrames() remains a stub, added a comment on why it probably
stays that way.
* Release the Encoder reference in the destructor.

FFmpeg plugin:
* Refactoring to delay opening the AVCodec until encoding the first chunk,
so that we can still adjust parameters.
* Support adjusting parameters via [Set|Get]EncodeParameters(). Currently,
only quality is supported, added TODOs about supporting the bit_rate setup
versus the automatically calculated bit_rate.
* Extended EncoderDescription by a bit_rate scale. The Encoder calculates the
raw bitrate needed by the current media format, and then divides that
number by the specific codec's bit_rate_scale, while taking into account the
desired quality. This seems to work very well already (tested with MPEG4),
although a lot more parameters could be specified for libavcodec, depending
on the desired quality.
* Enabled the ogg muxer in libavformat, although it is currently still disabled
in MuxerTable.cpp, because it rejects unknown codecs. Added TODO to this
effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32124 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7858701 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Free the AVFifoBuffer data in the destructor...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e567425 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Now supports encoded audio. Added Dolby Digital (AC-3) encoding to test this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32105 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c72a8ae 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

* AVWriter::StreamCookie::~StreamCookie() incorrectly freed packet data that it
didn't own.
* We are supposed to open the AVCodecContext in the writer, even though we never
use it. According to libav-users mailing list, this is necessary, since that
will allocate and initialize some structures that are later needed in
av_write_header(). How this is supposed to work for encoders that libavcodec
does not support, or which we don't know how to map, I do not yet know. For
now it doesn't matter and resolves the problem that audio tracks report the
wrong stream duration.
* Some more improvements with regards to what information we need to fill out
and which we don't.
* Use more sensible defaults for the stream bitrate, so that we get better
quality video by default. This and other parameters can be calculated when
we implement setting the quality.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32103 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ca4a7b1 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented audio track encoding. There is something wrong with the PTS
generation for the packets and how I set the time_base in the AVStream and
AVStream->codec structures. This results in the audio streams of the written
files to report a much too long duration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32064 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1e3ef613 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Quiet down some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32052 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54897d5c 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Also pass the media_codec_info to the Writer::AllocateCookie(), since that
info is not part of the media_format otherwise.
* Finished enough in the AVFormatWriter and AVCodecEncoder that we can now
actually create AVIs and MPGs and encode MPEG1, MPEG2 and MPEG4 video.
But no audio as of yet. Also, there is no bit-rate/quality setup, so it seems
libavformat is using the least possible bit-rate/quality.
* Enable some more muxers and encoders in the FFmpeg libs.
* Uses pixel format conversion from libswsscale, need to read the documentation
again, but I think it makes the plugin GPL.
* Fixed includes in libswscale/swscale.h, this is now an unmodified FFmpeg 0.5
header again (AFAICT).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32043 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 313fedac 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Let the Encoders use the media_codec_info.sub_id field for their own purposes.
* Implemented some of AVCodecEncoder. Maybe video encoding already works, but
we don't know until the AVFormatWriter is more than just stubs... but I doubt
it. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32016 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa770e4c 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Writer::WriteChunk() takes media_encode_info* instead of flags.
* Improved Encoder API towards what we need for the get_next_encoder() variants
and the BMediaTrack API.
* Implemented the rest of MediaWriter. Still undecided what to make of
AddTrackInfo(). BMediaEncoder has that as well, which hints that this is
something the Encoder needs to support. But it could also be that this is
only possible to support in Writer.
* Wired a lot of previously unimplemented methods in BMediaFile and BMediaTrack
needed for write support. If I have not overlooked anything, only the
parameter stuff is still unimplemented now.

This is all untested, since the FFMpeg Encoder and Writer are still only stubs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32013 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0876f8d0 30-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Stubbed out implementation of an Encoder and EncoderPlugin. This will probably
need to work differently, such that supported media_formats come into play,
I will know soon when I implement some of the stuff from MediaFormats.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31994 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e5c694668556b60e49a49e6708bfb550fc6ce1b 30-Aug-2015 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: remove more deprecated functions.

These were all deprecated between releases 0.6 and 0.10 of ffmpeg,
except for one change (renaming of CodecID to AVCodecID) which we can
work around with a typedef. The deprecated functions were still
available in 0.11, but were removed later on after several years of
deprecation.

This makes it possible to build our plugin with any ffmpeg version
between 0.10 and 2.7, so we can now experiment with updating to 2.7 at
least for the gcc4 builds.


# 0717601a7f0ae5185e857c8da2bb6f888d36e4c2 29-Aug-2015 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg encoder: do not use deprecatred function

Replace avcodec_encode_audio with avcodec_encode_audio2. The latter
provides us with more information on the encoded data, so we can avoid
guessing things on our own. It also handles memory allocations on its
own, which fix some cases where we would provide a too small buffer.


# 5e0e16894d67e220b4684809b154b85db4229381 23-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: improve encoding format negociation

The ffmpeg encoders are restricted on which raw formats they accept
(each with different constraints). When asked to encode something, the
ffmpeg encoder now checks the codec capabilities and if the suggested
input format does not match, modifies it to something the codec can
actually handle.

Enable "experimental" codecs, as this is needed for AAC support in ffmpeg 0.10.

This allows format negociation to work properly, and as a result we can
enable several new audio formats: AAC (for MPEG family only), AC3, and
raw audio. Declare MKV as B_ANY_FORMAT_FAMILY since it is designed to be
a generic container (so it is possible to put AAC in MKV). Also remove
duplicate entries for AC3.


# 84e70401cd02f134e87d758785d5a5f252b3b1ab 24-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

ffmpeg plugin: update to 0.11.5.


# 51014b9eb6b27a1311bccc52eadc8265bfb15ae6 14-Aug-2012 Matt Madia <mattmadia@gmail.com>

Revert "ffmpeg: switch to 0.11.1" (hrev44483)

This reverts commit 14b654326dc9c4b4ff38811672eb53e6723eece3.

Unfortunately that changeset causes a regression on GCC 2, which
makes playback of (some?) video impossible. This is due to Libavcodec
being miscompiled, which requires gcc >= 4.2

Resolves the regression of #8856, but does not fix the root issue.


# 14b654326dc9c4b4ff38811672eb53e6723eece3 06-Aug-2012 Jérôme Duval <jerome.duval@gmail.com>

ffmpeg: switch to 0.11.1


# 5b93b4477e61e42e4f5cc9a938bf8b1f06145d88 21-Mar-2012 Jérôme Duval <jerome.duval@gmail.com>

ffmpeg: updated gcc2 package and fixed crashes on exit.

* replaced calls to free() with calls to av_free().
* updated gcc2 package to disable SSE and a few options like we had
before with 0.6.


# 657983b8c215b60694fad0f469a15ae2d84f343b 21-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# 88eddd3d716a9601a277428cf78b35a4dac8f482 20-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# ec3e00329616ca41539cc1405bc066869ec31ef2 15-Oct-2010 Stephan Aßmus <superstippi@gmx.de>

* 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


# 8218710526be85df749080c21e080560e3f43209 29-Sep-2010 Stephan Aßmus <superstippi@gmx.de>

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


# eb01f516a3b44adfda231e814b65ddb79fe11d64 30-Aug-2010 Stephan Aßmus <superstippi@gmx.de>

The CodecID for raw-audio actually depends on the sample format
and can't be hard-coded in the EncoderTable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38464 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff1679bee83843884f75af23775064adaed4b376 27-Aug-2010 Stephan Aßmus <superstippi@gmx.de>

* Improved some comments.
* When writing encoded audio, we were leaking one
temporary buffer per chunk.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59ec4d2f76edbea5cb7f8baf66e728a6fe6408ea 06-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Disabled tracing.
* Use the configured source color space when converting instead of hardcoding
B_RGB32. (Resolved TODO)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0bdc7699c590eb99f05b6eb5a048bee73966335 21-Aug-2009 Jérôme Duval <korli@users.berlios.de>

* synced with ffmpeg-r19678, keeping gcc2 compiler #ifdef we introduced, build only tested on Haiku gcc2
* activated ac3 audio file format support
* uses format metadata to keep the codec context extra data (now needed for flac)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b9b5bf07db1b7b96ead7e5bcfbefa77db86c3e55 05-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed bugs when freeing the AVCodecEncoder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6780c24d36ada936c1d3a1095d2ed9730ef1e0c7 05-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Encoder:
* Fleshed out the Encoder API to support parameter setters/getters and returning
a BView for configuration. (Not yet sure if this is a good idea.)

BMediaTrack:
* Implemented all but one of the unimplemented methods in BMediaTrack. It should
be working as far as that class is concerned, unless I missed some of the
vision. ReplaceFrames() remains a stub, added a comment on why it probably
stays that way.
* Release the Encoder reference in the destructor.

FFmpeg plugin:
* Refactoring to delay opening the AVCodec until encoding the first chunk,
so that we can still adjust parameters.
* Support adjusting parameters via [Set|Get]EncodeParameters(). Currently,
only quality is supported, added TODOs about supporting the bit_rate setup
versus the automatically calculated bit_rate.
* Extended EncoderDescription by a bit_rate scale. The Encoder calculates the
raw bitrate needed by the current media format, and then divides that
number by the specific codec's bit_rate_scale, while taking into account the
desired quality. This seems to work very well already (tested with MPEG4),
although a lot more parameters could be specified for libavcodec, depending
on the desired quality.
* Enabled the ogg muxer in libavformat, although it is currently still disabled
in MuxerTable.cpp, because it rejects unknown codecs. Added TODO to this
effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32124 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b78587010191b2d6e0e5a7e71b8f4d2befded063 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Free the AVFifoBuffer data in the destructor...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e567425c6a93bcaa7dc7f6c8afa8a497007d142 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Now supports encoded audio. Added Dolby Digital (AC-3) encoding to test this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32105 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c72a8aed40d93cebb8a69f08e2449888913f6bf 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

* AVWriter::StreamCookie::~StreamCookie() incorrectly freed packet data that it
didn't own.
* We are supposed to open the AVCodecContext in the writer, even though we never
use it. According to libav-users mailing list, this is necessary, since that
will allocate and initialize some structures that are later needed in
av_write_header(). How this is supposed to work for encoders that libavcodec
does not support, or which we don't know how to map, I do not yet know. For
now it doesn't matter and resolves the problem that audio tracks report the
wrong stream duration.
* Some more improvements with regards to what information we need to fill out
and which we don't.
* Use more sensible defaults for the stream bitrate, so that we get better
quality video by default. This and other parameters can be calculated when
we implement setting the quality.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32103 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ca4a7b1beb866ba584816103f66031d22b7c003 03-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented audio track encoding. There is something wrong with the PTS
generation for the packets and how I set the time_base in the AVStream and
AVStream->codec structures. This results in the audio streams of the written
files to report a much too long duration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32064 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1e3ef6135fa79b97d037a9fbba70413d399c8916 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Quiet down some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32052 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54897d5c06df0e0384e0b59b23a1d926762cc078 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Also pass the media_codec_info to the Writer::AllocateCookie(), since that
info is not part of the media_format otherwise.
* Finished enough in the AVFormatWriter and AVCodecEncoder that we can now
actually create AVIs and MPGs and encode MPEG1, MPEG2 and MPEG4 video.
But no audio as of yet. Also, there is no bit-rate/quality setup, so it seems
libavformat is using the least possible bit-rate/quality.
* Enable some more muxers and encoders in the FFmpeg libs.
* Uses pixel format conversion from libswsscale, need to read the documentation
again, but I think it makes the plugin GPL.
* Fixed includes in libswscale/swscale.h, this is now an unmodified FFmpeg 0.5
header again (AFAICT).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32043 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 313fedacc1eb748844a7434f6c3d900fdba5b919 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Let the Encoders use the media_codec_info.sub_id field for their own purposes.
* Implemented some of AVCodecEncoder. Maybe video encoding already works, but
we don't know until the AVFormatWriter is more than just stubs... but I doubt
it. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32016 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa770e4c84d6b6e9721a6072041aba4468e79b98 31-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

* Writer::WriteChunk() takes media_encode_info* instead of flags.
* Improved Encoder API towards what we need for the get_next_encoder() variants
and the BMediaTrack API.
* Implemented the rest of MediaWriter. Still undecided what to make of
AddTrackInfo(). BMediaEncoder has that as well, which hints that this is
something the Encoder needs to support. But it could also be that this is
only possible to support in Writer.
* Wired a lot of previously unimplemented methods in BMediaFile and BMediaTrack
needed for write support. If I have not overlooked anything, only the
parameter stuff is still unimplemented now.

This is all untested, since the FFMpeg Encoder and Writer are still only stubs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32013 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0876f8d08e7d0011c4f130bf121ba0de9e94b6e9 30-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Stubbed out implementation of an Encoder and EncoderPlugin. This will probably
need to work differently, such that supported media_formats come into play,
I will know soon when I implement some of the stuff from MediaFormats.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31994 a95241bf-73f2-0310-859d-f6bbb57e9c96