来源:https://github.com/galad87/HandBrake-QuickSync-Mac/commit/2c1332958f7095c640cbcbcb45ffc955739d5945#diff-72d938f71df3506b8ad74530b39e7a0bR83
Skip to content
This repository
forked from kallisti5/HaikuBrake
QuickSync encoder via VideoToolbox
Implements a new encoder in HandBrake that uses VideoToolbox.framework
to access the hardware h.264 encoder.
1 parent a13430b commit 2c1332958f7095c640cbcbcb45ffc955739d5945 galad87 committed on 20 Jun 2013
Showing
with 540 additions and 14 deletions.
- +10 −8 ?????
- test/module.defs
18 ????? libhb/common.c
@@ -185,15 +185,16 @@ hb_encoder_t *hb_video_encoders_last_item = NULL; |
hb_encoder_internal_t hb_video_encoders[] = |
// legacy encoders, back to HB 0.9.4 whenever possible (disabled) |
- { { "FFmpeg", "ffmpeg", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG4, }, |
- { { "MPEG-4 (FFmpeg)", "ffmpeg4", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG4, }, |
- { { "MPEG-2 (FFmpeg)", "ffmpeg2", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG2, }, |
- { { "VP3 (Theora)", "libtheora", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_THEORA, }, |
+ { { "FFmpeg", "ffmpeg", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG4, }, |
+ { { "MPEG-4 (FFmpeg)", "ffmpeg4", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG4, }, |
+ { { "MPEG-2 (FFmpeg)", "ffmpeg2", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_MPEG2, }, |
+ { { "VP3 (Theora)", "libtheora", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_VCODEC_THEORA, }, |
- { { "H.264 (x264)", "x264", HB_VCODEC_X264, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, |
- { { "MPEG-4", "mpeg4", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG4, }, |
- { { "MPEG-2", "mpeg2", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG2, }, |
- { { "Theora", "theora", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_THEORA, }, |
+ { { "H.264 (x264)", "x264", HB_VCODEC_X264, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, |
+ { { "H.264 (VideoToolbox)", "h264", HB_VCODEC_VT_H264, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_H264, }, |
+ { { "MPEG-4", "mpeg4", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG4, }, |
+ { { "MPEG-2", "mpeg2", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG2, }, |
+ { { "Theora", "theora", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_THEORA, }, |
int hb_video_encoders_count = sizeof(hb_video_encoders) / sizeof(hb_video_encoders[0]); |
static int hb_video_encoder_is_enabled(int encoder) |
@@ -202,6 +203,7 @@ static int hb_video_encoder_is_enabled(int encoder) |
// the following encoders are always enabled |
+ case HB_VCODEC_VT_H264: |
case HB_VCODEC_FFMPEG_MPEG4: |
case HB_VCODEC_FFMPEG_MPEG2: |
2 ????? libhb/common.h
@@ -403,6 +403,7 @@ struct hb_job_s |
#define HB_VCODEC_MASK 0x00000FF |
#define HB_VCODEC_X264 0x0000001 |
#define HB_VCODEC_THEORA 0x0000002 |
+#define HB_VCODEC_VT_H264 0x0000004 |
#define HB_VCODEC_FFMPEG_MPEG4 0x0000010 |
#define HB_VCODEC_FFMPEG_MPEG2 0x0000020 |
#define HB_VCODEC_FFMPEG_MASK 0x00000F0 |
@@ -1008,6 +1009,7 @@ extern hb_work_object_t hb_encvorbis; |
extern hb_work_object_t hb_muxer; |
extern hb_work_object_t hb_encca_aac; |
extern hb_work_object_t hb_encca_haac; |
+extern hb_work_object_t hb_encvt_h264; |
extern hb_work_object_t hb_encavcodeca; |
extern hb_work_object_t hb_reader; |
1 ?????
libhb/hb.c
@@ -1644,6 +1644,7 @@ int hb_global_init() |
hb_register(&hb_encca_aac);
|
hb_register(&hb_encca_haac);
|
+ hb_register(&hb_encvt_h264);
|
hb_register(&hb_encfaac);
|
1 ?????
libhb/internal.h
1 ?????
libhb/muxmkv.c
@@ -97,6 +97,7 @@ static int MKVInit( hb_mux_object_t * m ) |
+ case HB_VCODEC_VT_H264:
|
track->codecID = MK_VCODEC_MP4AVC;
|
/* Taken from x264 muxers.c */
|
avcC_len = 5 + 1 + 2 + job->config.h264.sps_length + 1 + 2 + job->config.h264.pps_length;
|
10 ?????
libhb/muxmp4.c
@@ -129,7 +129,7 @@ static int MP4Init( hb_mux_object_t * m ) |
- if( job->vcodec == HB_VCODEC_X264 )
|
+ if( job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_VT_H264 )
|
/* Stolen from mp4creator */
|
MP4SetVideoProfileLevel( m->file, 0x7F );
|
@@ -684,7 +684,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, |
if( mux_data == job->mux_data )
|
- if( job->vcodec == HB_VCODEC_X264 ||
|
+ if( job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_VT_H264 ||
|
( job->vcodec & HB_VCODEC_FFMPEG_MASK ) )
|
if ( buf && buf->s.start < buf->s.renderOffset )
|
@@ -706,7 +706,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, |
stop = buf->s.start + buf->s.duration;
|
- if( job->vcodec == HB_VCODEC_X264 ||
|
+ if( job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_VT_H264 ||
|
( job->vcodec & HB_VCODEC_FFMPEG_MASK ) )
|
// x264 supplies us with DTS, so offset is PTS - DTS
|
@@ -744,7 +744,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, |
- if( job->vcodec == HB_VCODEC_X264 ||
|
+ if( job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_VT_H264 ||
|
( job->vcodec & HB_VCODEC_FFMPEG_MASK ) )
|
// x264 supplies us with DTS
|
@@ -822,7 +822,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, |
/* Here‘s where the sample actually gets muxed. */
|
- if( ( job->vcodec == HB_VCODEC_X264 ||
|
+ if( ( job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_VT_H264||
|
( job->vcodec & HB_VCODEC_FFMPEG_MASK ) )
|
&& mux_data == job->mux_data )
|
498 ?????
libhb/platform/macosx/encvt_h264.c
+ Copyright (c) 2003-2013 HandBrake Team
|
+ This file is part of the HandBrake source code
|
+ Homepage: <http://handbrake.fr/>.
|
+ It may be used under the terms of the GNU General Public License v2.
|
+ For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
|
+#include <VideoToolbox/VideoToolbox.h>
|
+#include <CoreMedia/CoreMedia.h>
|
+#include <CoreVideo/CoreVideo.h>
|
+int encvt_h264Init( hb_work_object_t *, hb_job_t * );
|
+int encvt_h264Work( hb_work_object_t *, hb_buffer_t **, hb_buffer_t ** );
|
+void encvt_h264Close( hb_work_object_t * );
|
+hb_work_object_t hb_encvt_h264 =
|
+ "H.264 encoder (VideoToolbox)",
|
+struct hb_work_private_s
|
+ VTCompressionSessionRef session;
|
+ CMSimpleQueueRef queue;
|
+ int chap_mark; // saved chap mark when we‘re propagating it
|
+void pixelBufferReleasePlanarBytesCallback( void *releaseRefCon, const void *dataPtr, size_t dataSize, size_t numberOfPlanes, const void *planeAddresses[] )
|
+ hb_buffer_t * buf = (hb_buffer_t *) releaseRefCon;
|
+ hb_buffer_close( &buf );
|
+void pixelBufferReleaseBytesCallback( void *releaseRefCon, const void *baseAddress )
|
+ free( (void *) baseAddress );
|
+void myVTCompressionOutputCallback(
|
+void *outputCallbackRefCon,
|
+void *sourceFrameRefCon,
|
+VTEncodeInfoFlags infoFlags,
|
+CMSampleBufferRef sampleBuffer )
|
+ CVPixelBufferRef pixelbuffer = sourceFrameRefCon;
|
+ CVPixelBufferRelease(pixelbuffer);
|
+ hb_log("VTCompressionSession: myVTCompressionOutputCallback called error");
|
+ CFRetain(sampleBuffer);
|
+ CMSimpleQueueRef queue = outputCallbackRefCon;
|
+ err = CMSimpleQueueEnqueue(queue, sampleBuffer);
|
+ hb_log("VTCompressionSession: myVTCompressionOutputCallback queue full");
|
+OSStatus initVTSession(hb_work_object_t * w, hb_job_t * job, hb_work_private_t * pv)
|
+ CFStringRef key = kVTVideoEncoderSpecification_EncoderID;
|
+ CFStringRef value = CFSTR("com.apple.videotoolbox.videoencoder.h264.gva");
|
+ CFStringRef bkey = CFSTR("EnableHardwareAcceleratedVideoEncoder");
|
+ CFBooleanRef bvalue = kCFBooleanTrue;
|
+ CFStringRef ckey = CFSTR("RequireHardwareAcceleratedVideoEncoder");
|
+ CFBooleanRef cvalue = kCFBooleanTrue;
|
+ CFMutableDictionaryRef encoderSpecifications = CFDictionaryCreateMutable(
|
+ &kCFTypeDictionaryKeyCallBacks,
|
+ &kCFTypeDictionaryValueCallBacks);
|
+ // Comment out to disable QuickSync
|
+ CFDictionaryAddValue(encoderSpecifications, bkey, bvalue);
|
+ CFDictionaryAddValue(encoderSpecifications, ckey, cvalue);
|
+ CFDictionaryAddValue(encoderSpecifications, key, value);
|
+ err = VTCompressionSessionCreate(
|
+ kCMVideoCodecType_H264,
|
+ &myVTCompressionOutputCallback,
|
+ hb_log("Error creating a VTCompressionSession err=%"PRId64"", (int64_t)err);
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_AllowFrameReordering, kCFBooleanTrue);
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_AllowFrameReordering failed");
|
+ const int maxKeyFrameInterval = 10 * 30;
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_MaxKeyFrameInterval,
|
+ CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &maxKeyFrameInterval));
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_MaxKeyFrameInterval failed");
|
+ const int maxFrameDelayCount = 24;
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_MaxFrameDelayCount,
|
+ CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &maxFrameDelayCount));
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_MaxKeyFrameInterval failed");
|
+ const int frameRate = (int)( (double)job->vrate / (double)job->vrate_base + 0.5 );
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_ExpectedFrameRate,
|
+ CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &frameRate));
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_ExpectedFrameRate failed");
|
+ if( job->vquality < 0 )
|
+ const int averageBitRate = job->vbitrate * 1024;
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_AverageBitRate,
|
+ CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &averageBitRate));
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_AverageBitRate failed");
|
+ err = VTSessionSetProperty(pv->session, kVTCompressionPropertyKey_ProfileLevel, kVTProfileLevel_H264_High_5_0);
|
+ hb_log("VTSessionSetProperty: kVTCompressionPropertyKey_ProfileLevel failed");
|
+ CFRelease(encoderSpecifications);
|
+void setupMagicCookie(hb_work_object_t * w, hb_job_t * job, hb_work_private_t * pv)
|
+ CMFormatDescriptionRef format = NULL;
|
+ err = initVTSession(w, job, pv);
|
+ size_t rgbBufSize = sizeof(uint8) * 3 * job->width * job->height;
|
+ uint8 *rgbBuf = malloc(rgbBufSize);
|
+ // Compress a random frame to get the magicCookie
|
+ CVPixelBufferRef pxbuffer = NULL;
|
+ CVPixelBufferCreateWithBytes(kCFAllocatorDefault,
|
+ kCVPixelFormatType_24RGB,
|
+ &pixelBufferReleaseBytesCallback,
|
+ if (kCVReturnSuccess != err)
|
+ hb_log("VTCompressionSession: CVPixelBuffer error");
|
+ CMTime pts = CMTimeMake(0, 90000);
|
+ err = VTCompressionSessionEncodeFrame(
|
+ VTCompressionSessionCompleteFrames(pv->session, CMTimeMake(0,90000));
|
+ CMSampleBufferRef sampleBuffer = (CMSampleBufferRef) CMSimpleQueueDequeue(pv->queue);
|
+ format = CMSampleBufferGetFormatDescription(sampleBuffer);
|
+ hb_log("VTCompressionSession: Format Description error");
|
+ CFDictionaryRef extentions = CMFormatDescriptionGetExtensions(format);
|
+ hb_log("VTCompressionSession: Format Description Extensions error");
|
+ CFDictionaryRef atoms = CFDictionaryGetValue(extentions, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms);
|
+ CFDataRef magicCookie = CFDictionaryGetValue(atoms, CFSTR("avcC"));
|
+ hb_log("VTCompressionSession: Magic Cookie error");
|
+ const uint8_t *avcCAtom = CFDataGetBytePtr(magicCookie);
|
+ int8_t spsCount = (avcCAtom[5] & 0x1f);
|
+ for (i = 0; i < spsCount; i++) {
|
+ uint16_t spsSize = (avcCAtom[ptrPos++] << 8) & 0xff00;
|
+ spsSize += avcCAtom[ptrPos++] & 0xff;
|
+ memcpy(w->config->h264.sps + spsPos, avcCAtom+ptrPos, spsSize);;
|
+ w->config->h264.sps_length = spsPos;
|
+ int8_t ppsCount = avcCAtom[ptrPos++];
|
+ for (i = 0; i < ppsCount; i++) {
|
+ uint16_t ppsSize = (avcCAtom[ptrPos++] << 8) & 0xff00;
|
+ ppsSize += avcCAtom[ptrPos++] & 0xff;
|
+ memcpy(w->config->h264.pps + ppsPos, avcCAtom+ptrPos, ppsSize);;
|
+ w->config->h264.pps_length = ppsPos;
|
+ VTCompressionSessionInvalidate(pv->session);
|
+ CFRelease(pv->session);
|
+ CFRelease(sampleBuffer);
|
+int encvt_h264Init( hb_work_object_t * w, hb_job_t * job )
|
+ hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
|
+ setupMagicCookie(w, job, pv);
|
+ err = initVTSession(w, job, pv);
|
+ hb_log("Error creating a VTCompressionSession err=%"PRId64"", (int64_t)err);
|
+/***********************************************************************
|
+ ***********************************************************************
|
+ **********************************************************************/
|
+void encvt_h264Close( hb_work_object_t * w )
|
+ hb_work_private_t * pv = w->private_data;
|
+ VTCompressionSessionInvalidate(pv->session);
|
+ CFRelease(pv->session);
|
+ w->private_data = NULL;
|
+/***********************************************************************
|
+ ***********************************************************************
|
+ **********************************************************************/
|
+hb_buffer_t* extractData(CMSampleBufferRef sampleBuffer, hb_work_object_t * w)
|
+ hb_work_private_t * pv = w->private_data;
|
+ hb_job_t * job = pv->job;
|
+ hb_buffer_t *buf = NULL;
|
+ CMItemCount samplesNum = CMSampleBufferGetNumSamples(sampleBuffer);
|
+ hb_log("VTCompressionSession: more than 1 sample in sampleBuffer = %ld", samplesNum);
|
+ CMBlockBufferRef buffer = CMSampleBufferGetDataBuffer(sampleBuffer);
|
+ size_t sampleSize = CMBlockBufferGetDataLength(buffer);
|
+ buf = hb_buffer_init( sampleSize );
|
+ err = CMBlockBufferCopyDataBytes(buffer, 0, sampleSize, buf->data);
|
+ if (err != kCMBlockBufferNoErr)
|
+ hb_log("VTCompressionSession: CMBlockBufferCopyDataBytes error");
|
+ buf->s.frametype = HB_FRAME_IDR;
|
+ buf->s.flags |= HB_FRAME_REF;
|
+ CFArrayRef attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, 0);
|
+ if (CFArrayGetCount(attachmentsArray))
|
+ CFDictionaryRef dict = CFArrayGetValueAtIndex(attachmentsArray, 0);
|
+ if (CFDictionaryGetValueIfPresent(dict, kCMSampleAttachmentKey_NotSync, NULL))
|
+ if (CFDictionaryGetValueIfPresent(dict, kCMSampleAttachmentKey_PartialSync, NULL))
|
+ buf->s.frametype = HB_FRAME_I;
|
+ else if (CFDictionaryGetValueIfPresent(dict, kCMSampleAttachmentKey_IsDependedOnByOthers,(const void **) &b))
|
+ Boolean bv = CFBooleanGetValue(b);
|
+ buf->s.frametype = HB_FRAME_P;
|
+ buf->s.frametype = HB_FRAME_B;
|
+ buf->s.flags &= ~HB_FRAME_REF;
|
+ buf->s.frametype = HB_FRAME_P;
|
+ CMTime decodeTimeStamp = CMSampleBufferGetDecodeTimeStamp(sampleBuffer);
|
+ CMTime presentationTimeStamp = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
|
+ if ( !w->config->h264.init_delay && presentationTimeStamp.value )
|
+ w->config->h264.init_delay = presentationTimeStamp.value;
|
+ buf->f.width = job->width;
|
+ buf->f.height = job->height;
|
+ buf->s.start = presentationTimeStamp.value + w->config->h264.init_delay;
|
+ buf->s.stop = presentationTimeStamp.value + w->config->h264.init_delay;
|
+ buf->s.renderOffset = decodeTimeStamp.value;
|
+ /* if we have a chapter marker pending and this
|
+ frame‘s presentation time stamp is at or after
|
+ the marker‘s time stamp, use this as the
|
+ if( buf->s.frametype == HB_FRAME_IDR && pv->next_chap != 0 && pv->next_chap <= presentationTimeStamp.value )
|
+ buf->s.new_chap = pv->chap_mark;
|
+int encvt_h264Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
|
+ hb_buffer_t ** buf_out )
|
+ hb_work_private_t * pv = w->private_data;
|
+ hb_job_t * job = pv->job;
|
+ hb_buffer_t * in = *buf_in, * buf = NULL;
|
+ CMSampleBufferRef sampleBuffer = NULL;
|
+ // EOF on input. Flush any frames still in the decoder then
|
+ // send the eof downstream to tell the muxer we‘re done.
|
+ VTCompressionSessionCompleteFrames(pv->session, kCMTimeInvalid);
|
+ hb_buffer_t *last_buf = NULL;
|
+ while ( ( sampleBuffer = (CMSampleBufferRef) CMSimpleQueueDequeue(pv->queue) ) )
|
+ buf = extractData(sampleBuffer, w);
|
+ CFRelease(sampleBuffer);
|
+ if ( last_buf == NULL )
|
+ // Flushed everything - add the eof to the end of the chain.
|
+ if ( last_buf == NULL )
|
+ // Create a CVPixelBuffer to wrap the frame data
|
+ CVPixelBufferRef pxbuffer = NULL;
|
+ hb_buffer_t *in_c = hb_buffer_dup(in);
|
+ void *planeBaseAddress[3] = {in_c->plane[0].data, in_c->plane[1].data, in_c->plane[2].data};
|
+ size_t planeWidth[3] = {in_c->plane[0].width, in_c->plane[1].width, in_c->plane[2].width};
|
+ size_t planeHeight[3] = {in_c->plane[0].height, in_c->plane[1].height, in_c->plane[2].height};
|
+ size_t planeBytesPerRow[3] = {in_c->plane[0].stride, in_c->plane[1].stride, in_c->plane[2].stride};
|
+ err = CVPixelBufferCreateWithPlanarBytes(
|
+ kCVPixelFormatType_420YpCbCr8Planar,
|
+ &pixelBufferReleasePlanarBytesCallback,
|
+ if (kCVReturnSuccess != err)
|
+ hb_log("VTCompressionSession: CVPixelBuffer error");
|
+ CFDictionaryRef frameProperties = NULL;
|
+ if( in->s.new_chap && job->chapter_markers )
|
+ /* chapters have to start with an IDR frame so request that this
|
+ frame be coded as IDR. Since there may be up to 16 frames
|
+ currently buffered in the encoder remember the timestamp so
|
+ when this frame finally pops out of the encoder we‘ll mark
|
+ its buffer as the start of a chapter. */
|
+ const void *keys[1] = { kVTEncodeFrameOptionKey_ForceKeyFrame };
|
+ const void *values[1] = { kCFBooleanTrue };
|
+ frameProperties = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
+ if( pv->next_chap == 0 )
|
+ pv->next_chap = in->s.start;
|
+ pv->chap_mark = in->s.new_chap;
|
+ /* don‘t let ‘work_loop‘ put a chapter mark on the wrong buffer */
|
+ // Send the frame to be encoded
|
+ err = VTCompressionSessionEncodeFrame(
|
+ CMTimeMake(in->s.start, 90000),
|
+ hb_log("VTCompressionSession: VTCompressionSessionEncodeFrame error");
|
+ CFRelease(frameProperties);
|
+ // Return a frame if ready
|
+ sampleBuffer = (CMSampleBufferRef) CMSimpleQueueDequeue(pv->queue);
|
+ buf = extractData(sampleBuffer, w);
|
+ CFRelease(sampleBuffer);
|
3 ?????
libhb/work.c
@@ -1027,6 +1027,9 @@ static void do_job(hb_job_t *job) |
w = hb_get_work( WORK_ENCX264 );
|
+ case HB_VCODEC_VT_H264:
|
+ w = hb_get_work( WORK_ENCVT_H264 );
|
w = hb_get_work( WORK_ENCTHEORA );
|
18 ?????
macosx/HandBrake.xcodeproj/project.pbxproj
27D6C77314B102DA00B785E4 /* libxml2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C74014B102DA00B785E4 /* libxml2.a */; };
|
3490BCB41614CF8D002A5AD7 /* HandBrake.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3490BCB31614CF8D002A5AD7 /* HandBrake.icns */; };
|
46AB433515F98A2B009C0961 /* DockTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 46AB433415F98A2B009C0961 /* DockTextField.m */; };
|
+ A90156C21770AB9200079F5A /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A90156C11770AB9200079F5A /* VideoToolbox.framework */; };
|
+ A90156C31770ADCE00079F5A /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A90156C11770AB9200079F5A /* VideoToolbox.framework */; };
|
+ A94BC59D1770C0110055F56B /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A94BC59C1770C0110055F56B /* CoreMedia.framework */; };
|
+ A94BC59E1770C0180055F56B /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A94BC59C1770C0110055F56B /* CoreMedia.framework */; };
|
+ A94BC5A01770C0C00055F56B /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A94BC59F1770C0C00055F56B /* CoreVideo.framework */; };
|
+ A94BC5A11770C0C70055F56B /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A94BC59F1770C0C00055F56B /* CoreVideo.framework */; };
|
A9E1467B16BC2ABD00C307BC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9E1467A16BC2ABD00C307BC /* QuartzCore.framework */; };
|
A9E1468016BC2AD800C307BC /* next-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467C16BC2AD800C307BC /* next-p.pdf */; };
|
A9E1468116BC2AD800C307BC /* pause-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467D16BC2AD800C307BC /* pause-p.pdf */; };
|
34FF2FC014EEC363004C2400 /* HBAdvancedController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAdvancedController.h; sourceTree = "<group>"; };
|
46AB433315F98A2B009C0961 /* DockTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DockTextField.h; sourceTree = "<group>"; };
|
46AB433415F98A2B009C0961 /* DockTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DockTextField.m; sourceTree = "<group>"; };
|
+ A90156C11770AB9200079F5A /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = /System/Library/Frameworks/VideoToolbox.framework; sourceTree = "<absolute>"; };
|
+ A94BC59C1770C0110055F56B /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = /System/Library/Frameworks/CoreMedia.framework; sourceTree = "<absolute>"; };
|
+ A94BC59F1770C0C00055F56B /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = "<absolute>"; };
|
A9E1467A16BC2ABD00C307BC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
|
A9E1467C16BC2AD800C307BC /* next-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "next-p.pdf"; sourceTree = "<group>"; };
|
A9E1467D16BC2AD800C307BC /* pause-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "pause-p.pdf"; sourceTree = "<group>"; };
|
isa = PBXFrameworksBuildPhase;
|
buildActionMask = 2147483647;
|
+ A94BC5A11770C0C70055F56B /* CoreVideo.framework in Frameworks */,
|
+ A94BC59D1770C0110055F56B /* CoreMedia.framework in Frameworks */,
|
+ A90156C31770ADCE00079F5A /* VideoToolbox.framework in Frameworks */,
|
273F203014ADB9790021BE6D /* AudioToolbox.framework in Frameworks */,
|
273F202314ADB8650021BE6D /* IOKit.framework in Frameworks */,
|
273F203314ADB9F00021BE6D /* CoreServices.framework in Frameworks */,
|
isa = PBXFrameworksBuildPhase;
|
buildActionMask = 2147483647;
|
+ A94BC5A01770C0C00055F56B /* CoreVideo.framework in Frameworks */,
|
+ A94BC59E1770C0180055F56B /* CoreMedia.framework in Frameworks */,
|
+ A90156C21770AB9200079F5A /* VideoToolbox.framework in Frameworks */,
|
A9E1467B16BC2ABD00C307BC /* QuartzCore.framework in Frameworks */,
|
273F21C114ADE7A20021BE6D /* Growl.framework in Frameworks */,
|
273F21C214ADE7BC0021BE6D /* Sparkle.framework in Frameworks */,
|
273F203414ADBAC30021BE6D /* Frameworks */ = {
|
+ A94BC59F1770C0C00055F56B /* CoreVideo.framework */,
|
+ A94BC59C1770C0110055F56B /* CoreMedia.framework */,
|
+ A90156C11770AB9200079F5A /* VideoToolbox.framework */,
|
A9E1467A16BC2ABD00C307BC /* QuartzCore.framework */,
|
273F20C714ADC4FF0021BE6D /* QTKit.framework */,
|
273F202F14ADB9790021BE6D /* AudioToolbox.framework */,
|
2 ?????
test/module.defs
@@ -50,7 +50,7 @@ BUILD.out += $(TEST.install.exe) |
TEST.GCC.I += $(LIBHB.GCC.I)
|
ifeq ($(BUILD.system),darwin)
|
- TEST.GCC.f += IOKit CoreServices AudioToolbox
|
+ TEST.GCC.f += IOKit CoreServices AudioToolbox VideoToolbox CoreMedia CoreVideo
|
else ifeq ($(BUILD.system),linux)
|
TEST.GCC.l += pthread dl m
|
0 comments
on commit 2c13329
Styling with Markdown is supported
Write
Preview
Attach files by dragging & dropping or selecting them.
You’re not receiving notifications from this thread.
时间: 2024-10-12 22:51:59