15 #ifndef SHAKA_EMBEDDED_MEDIA_APPLE_DECODER_H_ 16 #define SHAKA_EMBEDDED_MEDIA_APPLE_DECODER_H_ 18 #include <AudioToolbox/AudioToolbox.h> 19 #include <VideoToolbox/VideoToolbox.h> 23 #include <type_traits> 53 std::vector<std::shared_ptr<DecodedFrame>>*
frames,
54 std::string* extra_info)
override;
57 static void OnNewVideoFrame(
void* user,
void* frameUser, OSStatus status,
58 VTDecodeInfoFlags flags, CVImageBufferRef buffer,
59 CMTime pts, CMTime duration);
60 static OSStatus AudioInputCallback(
61 AudioConverterRef conv, UInt32* num_packets, AudioBufferList* data,
62 AudioStreamPacketDescription** desc,
void* user);
66 bool DecodeVideo(
const uint8_t* data,
size_t data_size,
67 std::string* extra_info);
68 bool DecodeAudio(
const uint8_t* data,
size_t data_size,
69 std::string* extra_info);
71 bool InitVideoDecoder(std::shared_ptr<const StreamInfo> info,
72 std::string* extra_info);
73 bool InitAudioDecoder(std::shared_ptr<const StreamInfo> info,
74 std::string* extra_info);
78 const uint8_t* input_data_;
79 size_t input_data_size_;
80 std::vector<std::shared_ptr<DecodedFrame>>* output_;
81 std::shared_ptr<const StreamInfo> decoder_stream_info_;
83 util::CFRef<VTDecompressionSessionRef> vt_session_;
84 util::CFRef<CMVideoFormatDescriptionRef> format_desc_;
87 OSStatus(*)(AudioConverterRef)>
89 AudioStreamPacketDescription audio_desc_;
96 #endif // SHAKA_EMBEDDED_MEDIA_APPLE_DECODER_H_
std::list< std::shared_ptr< BaseFrame > > frames