Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Rename transforms/Apple/H264Encode.{h,mm} to H264EncodeApple #310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/iOS/VCSimpleSession.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ of this software and associated documentation files (the "Software"), to deal
#ifdef __APPLE__
# include <videocore/mixers/Apple/AudioMixer.h>
# include <videocore/transforms/Apple/MP4Multiplexer.h>
# include <videocore/transforms/Apple/H264Encode.h>
# include <videocore/transforms/Apple/H264EncodeApple.h>
# include <videocore/sources/Apple/PixelBufferSource.h>
# ifdef TARGET_OS_IPHONE
# include <videocore/sources/iOS/CameraSource.h>
Expand Down Expand Up @@ -814,7 +814,7 @@ - (void) addEncodersAndPacketizers
m_aacEncoder = std::make_shared<videocore::iOS::AACEncode>(self.audioSampleRate, self.audioChannelCount, 96000);
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
// If >= iOS 8.0 use the VideoToolbox encoder that does not write to disk.
m_h264Encoder = std::make_shared<videocore::Apple::H264Encode>(self.videoSize.width,
m_h264Encoder = std::make_shared<videocore::Apple::H264EncodeApple>(self.videoSize.width,
self.videoSize.height,
self.fps,
self.bitrate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

namespace videocore { namespace Apple {

class H264Encode : public IEncoder
class H264EncodeApple : public IEncoder
{
public:
H264Encode( int frame_w, int frame_h, int fps, int bitrate, bool useBaseline = true, int ctsOffset = 0 );
~H264Encode();
H264EncodeApple( int frame_w, int frame_h, int fps, int bitrate, bool useBaseline = true, int ctsOffset = 0 );
~H264EncodeApple();

CVPixelBufferPoolRef pixelBufferPool();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#endif

#include <stdio.h>
#include <videocore/transforms/Apple/H264Encode.h>
#include <videocore/transforms/Apple/H264EncodeApple.h>
#include <videocore/mixers/IVideoMixer.hpp>

#if VERSION_OK==1
Expand Down Expand Up @@ -88,29 +88,29 @@ void vtCallback(void *outputCallbackRefCon,
ppsSize += 4;
memcpy(&pps_buf[0], &ppsSize, 4);

((H264Encode*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)sps_buf.get(),spsSize, pts.value, dts.value);
((H264Encode*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)pps_buf.get(),ppsSize, pts.value, dts.value);
((H264EncodeApple*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)sps_buf.get(),spsSize, pts.value, dts.value);
((H264EncodeApple*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)pps_buf.get(),ppsSize, pts.value, dts.value);
}

char* bufferData;
size_t size;
CMBlockBufferGetDataPointer(block, 0, NULL, &size, &bufferData);

((H264Encode*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)bufferData,size, pts.value, dts.value);
((H264EncodeApple*)outputCallbackRefCon)->compressionSessionOutput((uint8_t*)bufferData,size, pts.value, dts.value);

}
#endif
H264Encode::H264Encode( int frame_w, int frame_h, int fps, int bitrate, bool useBaseline, int ctsOffset)
H264EncodeApple::H264EncodeApple( int frame_w, int frame_h, int fps, int bitrate, bool useBaseline, int ctsOffset)
: m_frameW(frame_w), m_frameH(frame_h), m_fps(fps), m_bitrate(bitrate), m_forceKeyframe(false), m_ctsOffset(ctsOffset)
{
setupCompressionSession( useBaseline );
}
H264Encode::~H264Encode()
H264EncodeApple::~H264EncodeApple()
{
teardownCompressionSession();
}
void
H264Encode::pushBuffer(const uint8_t *const data, size_t size, videocore::IMetadata &metadata)
H264EncodeApple::pushBuffer(const uint8_t *const data, size_t size, videocore::IMetadata &metadata)
{
#if VERSION_OK
if(m_compressionSession) {
Expand Down Expand Up @@ -145,7 +145,7 @@ void vtCallback(void *outputCallbackRefCon,
#endif
}
void
H264Encode::setupCompressionSession( bool useBaseline )
H264EncodeApple::setupCompressionSession( bool useBaseline )
{
m_baseline = useBaseline;

Expand Down Expand Up @@ -264,7 +264,7 @@ void vtCallback(void *outputCallbackRefCon,

}
void
H264Encode::teardownCompressionSession()
H264EncodeApple::teardownCompressionSession()
{
#if VERSION_OK
if(m_compressionSession) {
Expand All @@ -274,7 +274,7 @@ void vtCallback(void *outputCallbackRefCon,
#endif
}
void
H264Encode::compressionSessionOutput(const uint8_t *data, size_t size, uint64_t pts, uint64_t dts)
H264EncodeApple::compressionSessionOutput(const uint8_t *data, size_t size, uint64_t pts, uint64_t dts)
{
#if VERSION_OK
auto l = m_output.lock();
Expand All @@ -286,12 +286,12 @@ void vtCallback(void *outputCallbackRefCon,

}
void
H264Encode::requestKeyframe()
H264EncodeApple::requestKeyframe()
{
m_forceKeyframe = true;
}
void
H264Encode::setBitrate(int bitrate)
H264EncodeApple::setBitrate(int bitrate)
{
#if VERSION_OK
if(bitrate == m_bitrate) {
Expand Down Expand Up @@ -347,7 +347,7 @@ void vtCallback(void *outputCallbackRefCon,
}

CVPixelBufferPoolRef
H264Encode::pixelBufferPool() {
H264EncodeApple::pixelBufferPool() {
if(m_compressionSession) {
return VTCompressionSessionGetPixelBufferPool((VTCompressionSessionRef)m_compressionSession);
}
Expand Down