haiku/src/kits/media/EncoderPlugin.cpp
Stephan Aßmus 6780c24d36 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
2009-08-05 10:21:36 +00:00

138 lines
2.3 KiB
C++

/*
* Copyright 2009, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
* Copyright 2004, Marcus Overhagen. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "EncoderPlugin.h"
#include <stdio.h>
#include <string.h>
#include <MediaFormats.h>
Encoder::Encoder()
:
fChunkWriter(NULL),
fMediaPlugin(NULL)
{
}
Encoder::~Encoder()
{
delete fChunkWriter;
}
// #pragma mark - Convenience stubs
status_t
Encoder::AddTrackInfo(uint32 code, const void* data, size_t size, uint32 flags)
{
return B_NOT_SUPPORTED;
}
BView*
Encoder::ParameterView()
{
return NULL;
}
BParameterWeb*
Encoder::ParameterWeb()
{
return NULL;
}
status_t
Encoder::GetParameterValue(int32 id, void* value, size_t* size) const
{
return B_NOT_SUPPORTED;
}
status_t
Encoder::SetParameterValue(int32 id, const void* value, size_t size)
{
return B_NOT_SUPPORTED;
}
status_t
Encoder::GetEncodeParameters(encode_parameters* parameters) const
{
return B_NOT_SUPPORTED;
}
status_t
Encoder::SetEncodeParameters(encode_parameters* parameters)
{
return B_NOT_SUPPORTED;
}
// #pragma mark -
status_t
Encoder::WriteChunk(const void* chunkBuffer, size_t chunkSize,
media_encode_info* encodeInfo)
{
return fChunkWriter->WriteChunk(chunkBuffer, chunkSize, encodeInfo);
}
void
Encoder::SetChunkWriter(ChunkWriter* writer)
{
delete fChunkWriter;
fChunkWriter = writer;
}
// #pragma mark - FBC padding
status_t
Encoder::Perform(perform_code code, void* data)
{
return B_OK;
}
void Encoder::_ReservedEncoder1() {}
void Encoder::_ReservedEncoder2() {}
void Encoder::_ReservedEncoder3() {}
void Encoder::_ReservedEncoder4() {}
void Encoder::_ReservedEncoder5() {}
void Encoder::_ReservedEncoder6() {}
void Encoder::_ReservedEncoder7() {}
void Encoder::_ReservedEncoder8() {}
void Encoder::_ReservedEncoder9() {}
void Encoder::_ReservedEncoder10() {}
void Encoder::_ReservedEncoder11() {}
void Encoder::_ReservedEncoder12() {}
void Encoder::_ReservedEncoder13() {}
void Encoder::_ReservedEncoder14() {}
void Encoder::_ReservedEncoder15() {}
void Encoder::_ReservedEncoder16() {}
void Encoder::_ReservedEncoder17() {}
void Encoder::_ReservedEncoder18() {}
void Encoder::_ReservedEncoder19() {}
void Encoder::_ReservedEncoder20() {}
// #pragma mark - EncoderPlugin
EncoderPlugin::EncoderPlugin()
{
}