1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef A_CODEC_H_ 18 19 #define A_CODEC_H_ 20 21 #include <stdint.h> 22 #include <android/native_window.h> 23 #include <media/hardware/MetadataBufferType.h> 24 #include <media/IOMX.h> 25 #include <media/stagefright/foundation/AHierarchicalStateMachine.h> 26 #include <media/stagefright/CodecBase.h> 27 #include <media/stagefright/FrameRenderTracker.h> 28 #include <media/stagefright/MediaDefs.h> 29 #include <media/stagefright/SkipCutBuffer.h> 30 #include <utils/NativeHandle.h> 31 #include <OMX_Audio.h> 32 #include <hardware/gralloc.h> 33 34 #define TRACK_BUFFER_TIMING 0 35 36 namespace android { 37 38 struct ABuffer; 39 class ACodecBufferChannel; 40 class MediaCodecBuffer; 41 class MemoryDealer; 42 struct DescribeColorFormat2Params; 43 struct DataConverter; 44 45 // Treble shared memory 46 namespace hidl { 47 namespace allocator { 48 namespace V1_0 { 49 struct IAllocator; 50 } // V1_0 51 } // allocator 52 namespace memory { 53 namespace V1_0 { 54 struct IMemory; 55 } // V1_0 56 } // memory 57 } // hidl 58 59 typedef hidl::allocator::V1_0::IAllocator TAllocator; 60 typedef hidl::memory::V1_0::IMemory TMemory; 61 62 struct ACodec : public AHierarchicalStateMachine, public CodecBase { 63 ACodec(); 64 65 void initiateSetup(const sp<AMessage> &msg); 66 67 virtual std::shared_ptr<BufferChannelBase> getBufferChannel() override; 68 virtual void initiateAllocateComponent(const sp<AMessage> &msg); 69 virtual void initiateConfigureComponent(const sp<AMessage> &msg); 70 virtual void initiateCreateInputSurface(); 71 virtual void initiateSetInputSurface(const sp<PersistentSurface> &surface); 72 virtual void initiateStart(); 73 virtual void initiateShutdown(bool keepComponentAllocated = false); 74 75 virtual status_t queryCapabilities( 76 const AString &name, const AString &mime, bool isEncoder, 77 sp<MediaCodecInfo::Capabilities> *caps); 78 79 virtual status_t setSurface(const sp<Surface> &surface); 80 81 virtual void signalFlush(); 82 virtual void signalResume(); 83 84 virtual void signalSetParameters(const sp<AMessage> &msg); 85 virtual void signalEndOfInputStream(); 86 virtual void signalRequestIDRFrame(); 87 88 // AHierarchicalStateMachine implements the message handling 89 virtual void onMessageReceived(const sp<AMessage> &msg) { 90 handleMessage(msg); 91 } 92 93 // Returns 0 if configuration is not supported. NOTE: this is treated by 94 // some OMX components as auto level, and by others as invalid level. 95 static int /* OMX_VIDEO_AVCLEVELTYPE */ getAVCLevelFor( 96 int width, int height, int rate, int bitrate, 97 OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline); 98 99 // Quirk still supported, even though deprecated 100 enum Quirks { 101 kRequiresAllocateBufferOnInputPorts = 1, 102 kRequiresAllocateBufferOnOutputPorts = 2, 103 }; 104 105 static status_t getOMXChannelMapping(size_t numChannels, OMX_AUDIO_CHANNELTYPE map[]); 106 107 // Save the flag. 108 void setTrebleFlag(bool trebleFlag); 109 // Return the saved flag. 110 bool getTrebleFlag() const; 111 112 protected: 113 virtual ~ACodec(); 114 115 private: 116 struct BaseState; 117 struct UninitializedState; 118 struct LoadedState; 119 struct LoadedToIdleState; 120 struct IdleToExecutingState; 121 struct ExecutingState; 122 struct OutputPortSettingsChangedState; 123 struct ExecutingToIdleState; 124 struct IdleToLoadedState; 125 struct FlushingState; 126 struct DeathNotifier; 127 128 enum { 129 kWhatSetup = 'setu', 130 kWhatOMXMessage = 'omx ', 131 // same as kWhatOMXMessage - but only used with 132 // handleMessage during OMX message-list handling 133 kWhatOMXMessageItem = 'omxI', 134 kWhatOMXMessageList = 'omxL', 135 kWhatInputBufferFilled = 'inpF', 136 kWhatOutputBufferDrained = 'outD', 137 kWhatShutdown = 'shut', 138 kWhatFlush = 'flus', 139 kWhatResume = 'resm', 140 kWhatDrainDeferredMessages = 'drai', 141 kWhatAllocateComponent = 'allo', 142 kWhatConfigureComponent = 'conf', 143 kWhatSetSurface = 'setS', 144 kWhatCreateInputSurface = 'cisf', 145 kWhatSetInputSurface = 'sisf', 146 kWhatSignalEndOfInputStream = 'eois', 147 kWhatStart = 'star', 148 kWhatRequestIDRFrame = 'ridr', 149 kWhatSetParameters = 'setP', 150 kWhatSubmitOutputMetadataBufferIfEOS = 'subm', 151 kWhatOMXDied = 'OMXd', 152 kWhatReleaseCodecInstance = 'relC', 153 kWhatForceStateTransition = 'fstt', 154 }; 155 156 enum { 157 kPortIndexInput = 0, 158 kPortIndexOutput = 1 159 }; 160 161 enum { 162 kFlagIsSecure = 1, 163 kFlagPushBlankBuffersToNativeWindowOnShutdown = 2, 164 kFlagIsGrallocUsageProtected = 4, 165 }; 166 167 enum { 168 kVideoGrallocUsage = (GRALLOC_USAGE_HW_TEXTURE 169 | GRALLOC_USAGE_HW_COMPOSER 170 | GRALLOC_USAGE_EXTERNAL_DISP), 171 }; 172 173 struct BufferInfo { 174 enum Status { 175 OWNED_BY_US, 176 OWNED_BY_COMPONENT, 177 OWNED_BY_UPSTREAM, 178 OWNED_BY_DOWNSTREAM, 179 OWNED_BY_NATIVE_WINDOW, 180 UNRECOGNIZED, // not a tracked buffer 181 }; 182 183 static inline Status getSafeStatus(BufferInfo *info) { 184 return info == NULL ? UNRECOGNIZED : info->mStatus; 185 } 186 187 IOMX::buffer_id mBufferID; 188 Status mStatus; 189 unsigned mDequeuedAt; 190 191 sp<MediaCodecBuffer> mData; // the client's buffer; if not using data conversion, this is 192 // the codec buffer; otherwise, it is allocated separately 193 sp<RefBase> mMemRef; // and a reference to the IMemory, so it does not go away 194 sp<MediaCodecBuffer> mCodecData; // the codec's buffer 195 sp<RefBase> mCodecRef; // and a reference to the IMemory 196 197 sp<GraphicBuffer> mGraphicBuffer; 198 bool mNewGraphicBuffer; 199 int mFenceFd; 200 FrameRenderTracker::Info *mRenderInfo; 201 202 // The following field and 4 methods are used for debugging only 203 bool mIsReadFence; 204 // Store |fenceFd| and set read/write flag. Log error, if there is already a fence stored. 205 void setReadFence(int fenceFd, const char *dbg); 206 void setWriteFence(int fenceFd, const char *dbg); 207 // Log error, if the current fence is not a read/write fence. 208 void checkReadFence(const char *dbg); 209 void checkWriteFence(const char *dbg); 210 }; 211 212 static const char *_asString(BufferInfo::Status s); 213 void dumpBuffers(OMX_U32 portIndex); 214 215 // If |fd| is non-negative, waits for fence with |fd| and logs an error if it fails. Returns 216 // the error code or OK on success. If |fd| is negative, it returns OK 217 status_t waitForFence(int fd, const char *dbg); 218 219 #if TRACK_BUFFER_TIMING 220 struct BufferStats { 221 int64_t mEmptyBufferTimeUs; 222 int64_t mFillBufferDoneTimeUs; 223 }; 224 225 KeyedVector<int64_t, BufferStats> mBufferStats; 226 #endif 227 228 sp<UninitializedState> mUninitializedState; 229 sp<LoadedState> mLoadedState; 230 sp<LoadedToIdleState> mLoadedToIdleState; 231 sp<IdleToExecutingState> mIdleToExecutingState; 232 sp<ExecutingState> mExecutingState; 233 sp<OutputPortSettingsChangedState> mOutputPortSettingsChangedState; 234 sp<ExecutingToIdleState> mExecutingToIdleState; 235 sp<IdleToLoadedState> mIdleToLoadedState; 236 sp<FlushingState> mFlushingState; 237 sp<SkipCutBuffer> mSkipCutBuffer; 238 int32_t mSampleRate; 239 240 AString mComponentName; 241 uint32_t mFlags; 242 sp<IOMX> mOMX; 243 sp<IOMXNode> mOMXNode; 244 int32_t mNodeGeneration; 245 bool mTrebleFlag; 246 sp<TAllocator> mAllocator[2]; 247 sp<MemoryDealer> mDealer[2]; 248 249 bool mUsingNativeWindow; 250 sp<ANativeWindow> mNativeWindow; 251 int mNativeWindowUsageBits; 252 android_native_rect_t mLastNativeWindowCrop; 253 int32_t mLastNativeWindowDataSpace; 254 sp<AMessage> mConfigFormat; 255 sp<AMessage> mInputFormat; 256 sp<AMessage> mOutputFormat; 257 258 // Initial output format + configuration params that is reused as the base for all subsequent 259 // format updates. This will equal to mOutputFormat until the first actual frame is received. 260 sp<AMessage> mBaseOutputFormat; 261 262 FrameRenderTracker mRenderTracker; // render information for buffers rendered by ACodec 263 Vector<BufferInfo> mBuffers[2]; 264 bool mPortEOS[2]; 265 status_t mInputEOSResult; 266 267 List<sp<AMessage> > mDeferredQueue; 268 269 sp<AMessage> mLastOutputFormat; 270 bool mIsVideo; 271 bool mIsEncoder; 272 bool mFatalError; 273 bool mShutdownInProgress; 274 bool mExplicitShutdown; 275 bool mIsLegacyVP9Decoder; 276 277 // If "mKeepComponentAllocated" we only transition back to Loaded state 278 // and do not release the component instance. 279 bool mKeepComponentAllocated; 280 281 int32_t mEncoderDelay; 282 int32_t mEncoderPadding; 283 int32_t mRotationDegrees; 284 285 bool mChannelMaskPresent; 286 int32_t mChannelMask; 287 unsigned mDequeueCounter; 288 IOMX::PortMode mPortMode[2]; 289 int32_t mMetadataBuffersToSubmit; 290 size_t mNumUndequeuedBuffers; 291 sp<DataConverter> mConverter[2]; 292 293 sp<IGraphicBufferSource> mGraphicBufferSource; 294 int64_t mRepeatFrameDelayUs; 295 int64_t mMaxPtsGapUs; 296 float mMaxFps; 297 double mFps; 298 double mCaptureFps; 299 bool mCreateInputBuffersSuspended; 300 uint32_t mLatency; 301 302 bool mTunneled; 303 304 OMX_INDEXTYPE mDescribeColorAspectsIndex; 305 OMX_INDEXTYPE mDescribeHDRStaticInfoIndex; 306 307 std::shared_ptr<ACodecBufferChannel> mBufferChannel; 308 309 int32_t mStateGeneration; 310 311 enum { 312 kExtensionsUnchecked, 313 kExtensionsNone, 314 kExtensionsExist, 315 } mVendorExtensionsStatus; 316 317 status_t setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode); 318 status_t allocateBuffersOnPort(OMX_U32 portIndex); 319 status_t freeBuffersOnPort(OMX_U32 portIndex); 320 status_t freeBuffer(OMX_U32 portIndex, size_t i); 321 322 status_t handleSetSurface(const sp<Surface> &surface); 323 status_t setPortMode(int32_t portIndex, IOMX::PortMode mode); 324 status_t setupNativeWindowSizeFormatAndUsage( 325 ANativeWindow *nativeWindow /* nonnull */, int *finalUsage /* nonnull */, 326 bool reconnect); 327 328 status_t configureOutputBuffersFromNativeWindow( 329 OMX_U32 *nBufferCount, OMX_U32 *nBufferSize, 330 OMX_U32 *nMinUndequeuedBuffers, bool preregister); 331 status_t allocateOutputMetadataBuffers(); 332 status_t submitOutputMetadataBuffer(); 333 void signalSubmitOutputMetadataBufferIfEOS_workaround(); 334 status_t allocateOutputBuffersFromNativeWindow(); 335 status_t cancelBufferToNativeWindow(BufferInfo *info); 336 status_t freeOutputBuffersNotOwnedByComponent(); 337 BufferInfo *dequeueBufferFromNativeWindow(); 338 339 inline bool storingMetadataInDecodedBuffers() { 340 return (mPortMode[kPortIndexOutput] == IOMX::kPortModeDynamicANWBuffer) && !mIsEncoder; 341 } 342 343 inline bool usingSecureBufferOnEncoderOutput() { 344 return (mPortMode[kPortIndexOutput] == IOMX::kPortModePresetSecureBuffer) && mIsEncoder; 345 } 346 347 BufferInfo *findBufferByID( 348 uint32_t portIndex, IOMX::buffer_id bufferID, 349 ssize_t *index = NULL); 350 351 status_t fillBuffer(BufferInfo *info); 352 353 status_t setComponentRole(bool isEncoder, const char *mime); 354 355 status_t configureCodec(const char *mime, const sp<AMessage> &msg); 356 357 status_t configureTunneledVideoPlayback(int32_t audioHwSync, 358 const sp<ANativeWindow> &nativeWindow); 359 360 status_t setVideoPortFormatType( 361 OMX_U32 portIndex, 362 OMX_VIDEO_CODINGTYPE compressionFormat, 363 OMX_COLOR_FORMATTYPE colorFormat, 364 bool usingNativeBuffers = false); 365 366 status_t setSupportedOutputFormat(bool getLegacyFlexibleFormat); 367 368 status_t setupVideoDecoder( 369 const char *mime, const sp<AMessage> &msg, bool usingNativeBuffers, bool haveSwRenderer, 370 sp<AMessage> &outputformat); 371 372 status_t setupVideoEncoder( 373 const char *mime, const sp<AMessage> &msg, 374 sp<AMessage> &outputformat, sp<AMessage> &inputformat); 375 376 status_t setVideoFormatOnPort( 377 OMX_U32 portIndex, 378 int32_t width, int32_t height, 379 OMX_VIDEO_CODINGTYPE compressionFormat, float frameRate = -1.0); 380 381 // sets |portIndex| port buffer numbers to be |bufferNum|. NOTE: Component could reject 382 // this setting if the |bufferNum| is less than the minimum buffer num of the port. 383 status_t setPortBufferNum(OMX_U32 portIndex, int bufferNum); 384 385 // gets index or sets it to 0 on error. Returns error from codec. 386 status_t initDescribeColorAspectsIndex(); 387 388 // sets |params|. If |readBack| is true, it re-gets them afterwards if set succeeded. 389 // returns the codec error. 390 status_t setCodecColorAspects(DescribeColorAspectsParams ¶ms, bool readBack = false); 391 392 // gets |params|; returns the codec error. |param| should not change on error. 393 status_t getCodecColorAspects(DescribeColorAspectsParams ¶ms); 394 395 // gets dataspace guidance from codec and platform. |params| should be set up with the color 396 // aspects to use. If |tryCodec| is true, the codec is queried first. If it succeeds, we 397 // return OK. Otherwise, we fall back to the platform guidance and return the codec error; 398 // though, we return OK if the codec failed with UNSUPPORTED, as codec guidance is optional. 399 status_t getDataSpace( 400 DescribeColorAspectsParams ¶ms, android_dataspace *dataSpace /* nonnull */, 401 bool tryCodec); 402 403 // sets color aspects for the encoder for certain |width/height| based on |configFormat|, and 404 // set resulting color config into |outputFormat|. If |usingNativeWindow| is true, we use 405 // video defaults if config is unspecified. Returns error from the codec. 406 status_t setColorAspectsForVideoDecoder( 407 int32_t width, int32_t height, bool usingNativeWindow, 408 const sp<AMessage> &configFormat, sp<AMessage> &outputFormat); 409 410 // gets color aspects for the encoder for certain |width/height| based on |configFormat|, and 411 // set resulting color config into |outputFormat|. If |dataSpace| is non-null, it requests 412 // dataspace guidance from the codec and platform and sets it into |dataSpace|. Returns the 413 // error from the codec. 414 status_t getColorAspectsAndDataSpaceForVideoDecoder( 415 int32_t width, int32_t height, const sp<AMessage> &configFormat, 416 sp<AMessage> &outputFormat, android_dataspace *dataSpace); 417 418 // sets color aspects for the video encoder assuming bytebuffer mode for certain |configFormat| 419 // and sets resulting color config into |outputFormat|. For mediarecorder, also set dataspace 420 // into |inputFormat|. Returns the error from the codec. 421 status_t setColorAspectsForVideoEncoder( 422 const sp<AMessage> &configFormat, 423 sp<AMessage> &outputFormat, sp<AMessage> &inputFormat); 424 425 // sets color aspects for the video encoder in surface mode. This basically sets the default 426 // video values for unspecified aspects and sets the dataspace to use in the input format. 427 // Also sets the dataspace into |dataSpace|. 428 // Returns any codec errors during this configuration, except for optional steps. 429 status_t setInitialColorAspectsForVideoEncoderSurfaceAndGetDataSpace( 430 android_dataspace *dataSpace /* nonnull */); 431 432 // gets color aspects for the video encoder input port and sets them into the |format|. 433 // Returns any codec errors. 434 status_t getInputColorAspectsForVideoEncoder(sp<AMessage> &format); 435 436 // updates the encoder output format with |aspects| defaulting to |dataSpace| for 437 // unspecified values. 438 void onDataSpaceChanged(android_dataspace dataSpace, const ColorAspects &aspects); 439 440 // gets index or sets it to 0 on error. Returns error from codec. 441 status_t initDescribeHDRStaticInfoIndex(); 442 443 // sets HDR static metadata for the video encoder/decoder based on |configFormat|, and 444 // sets resulting HDRStaticInfo config into |outputFormat|. Returns error from the codec. 445 status_t setHDRStaticInfoForVideoCodec( 446 OMX_U32 portIndex, const sp<AMessage> &configFormat, sp<AMessage> &outputFormat); 447 448 // sets |params|. Returns the codec error. 449 status_t setHDRStaticInfo(const DescribeHDRStaticInfoParams ¶ms); 450 451 // gets |params|. Returns the codec error. 452 status_t getHDRStaticInfo(DescribeHDRStaticInfoParams ¶ms); 453 454 // gets HDR static information for the video encoder/decoder port and sets them into |format|. 455 status_t getHDRStaticInfoForVideoCodec(OMX_U32 portIndex, sp<AMessage> &format); 456 457 typedef struct drcParams { 458 int32_t drcCut; 459 int32_t drcBoost; 460 int32_t heavyCompression; 461 int32_t targetRefLevel; 462 int32_t encodedTargetLevel; 463 } drcParams_t; 464 465 status_t setupAACCodec( 466 bool encoder, 467 int32_t numChannels, int32_t sampleRate, int32_t bitRate, 468 int32_t aacProfile, bool isADTS, int32_t sbrMode, 469 int32_t maxOutputChannelCount, const drcParams_t& drc, 470 int32_t pcmLimiterEnable); 471 472 status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); 473 474 status_t setupEAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); 475 476 status_t selectAudioPortFormat( 477 OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); 478 479 status_t setupAMRCodec(bool encoder, bool isWAMR, int32_t bitRate); 480 status_t setupG711Codec(bool encoder, int32_t sampleRate, int32_t numChannels); 481 482 status_t setupFlacCodec( 483 bool encoder, int32_t numChannels, int32_t sampleRate, int32_t compressionLevel); 484 485 status_t setupRawAudioFormat( 486 OMX_U32 portIndex, int32_t sampleRate, int32_t numChannels, 487 AudioEncoding encoding = kAudioEncodingPcm16bit); 488 489 status_t setPriority(int32_t priority); 490 status_t setLatency(uint32_t latency); 491 status_t getLatency(uint32_t *latency); 492 status_t setOperatingRate(float rateFloat, bool isVideo); 493 status_t getIntraRefreshPeriod(uint32_t *intraRefreshPeriod); 494 status_t setIntraRefreshPeriod(uint32_t intraRefreshPeriod, bool inConfigure); 495 496 // Configures temporal layering based on |msg|. |inConfigure| shall be true iff this is called 497 // during configure() call. on success the configured layering is set in |outputFormat|. If 498 // |outputFormat| is mOutputFormat, it is copied to trigger an output format changed event. 499 status_t configureTemporalLayers( 500 const sp<AMessage> &msg, bool inConfigure, sp<AMessage> &outputFormat); 501 502 status_t setMinBufferSize(OMX_U32 portIndex, size_t size); 503 504 status_t setupMPEG4EncoderParameters(const sp<AMessage> &msg); 505 status_t setupH263EncoderParameters(const sp<AMessage> &msg); 506 status_t setupAVCEncoderParameters(const sp<AMessage> &msg); 507 status_t setupHEVCEncoderParameters(const sp<AMessage> &msg); 508 status_t setupVPXEncoderParameters(const sp<AMessage> &msg, sp<AMessage> &outputFormat); 509 510 status_t verifySupportForProfileAndLevel(int32_t profile, int32_t level); 511 512 status_t configureBitrate( 513 int32_t bitrate, OMX_VIDEO_CONTROLRATETYPE bitrateMode); 514 void configureEncoderLatency(const sp<AMessage> &msg); 515 516 status_t setupErrorCorrectionParameters(); 517 518 // Returns true iff all buffers on the given port have status 519 // OWNED_BY_US or OWNED_BY_NATIVE_WINDOW. 520 bool allYourBuffersAreBelongToUs(OMX_U32 portIndex); 521 522 bool allYourBuffersAreBelongToUs(); 523 524 void waitUntilAllPossibleNativeWindowBuffersAreReturnedToUs(); 525 526 size_t countBuffersOwnedByComponent(OMX_U32 portIndex) const; 527 size_t countBuffersOwnedByNativeWindow() const; 528 529 void deferMessage(const sp<AMessage> &msg); 530 void processDeferredMessages(); 531 532 void onFrameRendered(int64_t mediaTimeUs, nsecs_t systemNano); 533 // called when we have dequeued a buffer |buf| from the native window to track render info. 534 // |fenceFd| is the dequeue fence, and |info| points to the buffer info where this buffer is 535 // stored. 536 void updateRenderInfoForDequeuedBuffer( 537 ANativeWindowBuffer *buf, int fenceFd, BufferInfo *info); 538 539 // Checks to see if any frames have rendered up until |until|, and to notify client 540 // (MediaCodec) of rendered frames up-until the frame pointed to by |until| or the first 541 // unrendered frame. These frames are removed from the render queue. 542 // If |dropIncomplete| is true, unrendered frames up-until |until| will be dropped from the 543 // queue, allowing all rendered framed up till then to be notified of. 544 // (This will effectively clear the render queue up-until (and including) |until|.) 545 // If |until| is NULL, or is not in the rendered queue, this method will check all frames. 546 void notifyOfRenderedFrames( 547 bool dropIncomplete = false, FrameRenderTracker::Info *until = NULL); 548 549 // Pass |expectedFormat| to print a warning if the format differs from it. 550 // Using sp<> instead of const sp<>& because expectedFormat is likely the current mOutputFormat 551 // which will get updated inside. 552 void onOutputFormatChanged(sp<const AMessage> expectedFormat = NULL); 553 void addKeyFormatChangesToRenderBufferNotification(sp<AMessage> ¬ify); 554 void sendFormatChange(); 555 556 status_t getPortFormat(OMX_U32 portIndex, sp<AMessage> ¬ify); 557 558 void signalError( 559 OMX_ERRORTYPE error = OMX_ErrorUndefined, 560 status_t internalError = UNKNOWN_ERROR); 561 562 status_t requestIDRFrame(); 563 status_t setParameters(const sp<AMessage> ¶ms); 564 565 // set vendor extension parameters specified in params that are supported by the codec 566 status_t setVendorParameters(const sp<AMessage> ¶ms); 567 568 // get vendor extension parameters supported by the codec for a specific port and add it to 569 // |format| 570 status_t getVendorParameters(OMX_U32 portIndex, sp<AMessage> &format); 571 572 // Send EOS on input stream. 573 void onSignalEndOfInputStream(); 574 575 // Force EXEC->IDLE->LOADED shutdown sequence if not stale. 576 void forceStateTransition(int generation); 577 578 DISALLOW_EVIL_CONSTRUCTORS(ACodec); 579 }; 580 581 } // namespace android 582 583 #endif // A_CODEC_H_ 584