Lines Matching refs:mData
306 AMediaCodec *mData = new AMediaCodec();
307 mData->mLooper = new ALooper;
308 mData->mLooper->setName("NDK MediaCodec_looper");
309 size_t res = mData->mLooper->start(
315 AMediaCodec_delete(mData);
319 mData->mCodec = android::MediaCodec::CreateByType(mData->mLooper, name, encoder);
321 mData->mCodec = android::MediaCodec::CreateByComponentName(mData->mLooper, name);
323 if (mData->mCodec == NULL) { // failed to create codec
324 AMediaCodec_delete(mData);
327 mData->mHandler = new CodecHandler(mData);
328 mData->mLooper->registerHandler(mData->mHandler);
329 mData->mGeneration = 1;
330 mData->mRequestedActivityNotification = false;
331 mData->mCallback = NULL;
333 mData->mAsyncCallback = {};
334 mData->mAsyncCallbackUserData = NULL;
336 return mData;
355 media_status_t AMediaCodec_delete(AMediaCodec *mData) {
356 if (mData != NULL) {
357 if (mData->mCodec != NULL) {
358 mData->mCodec->release();
359 mData->mCodec.clear();
362 if (mData->mLooper != NULL) {
363 if (mData->mHandler != NULL) {
364 mData->mLooper->unregisterHandler(mData->mHandler->id());
366 mData->mLooper->stop();
367 mData->mLooper.clear();
369 delete mData;
376 AMediaCodec *mData,
383 status_t err = mData->mCodec->getName(&compName);
393 AMediaCodec * /* mData */,
402 AMediaCodec *mData,
415 status_t err = mData->mCodec->configure(nativeFormat, surface,
426 AMediaCodec *mData,
429 if (mData->mAsyncNotify == NULL && userdata != NULL) {
430 mData->mAsyncNotify = new AMessage(kWhatAsyncNotify, mData->mHandler);
431 status_t err = mData->mCodec->setCallback(mData->mAsyncNotify);
438 Mutex::Autolock _l(mData->mAsyncCallbackLock);
439 mData->mAsyncCallback = callback;
440 mData->mAsyncCallbackUserData = userdata;
447 media_status_t AMediaCodec_releaseCrypto(AMediaCodec *mData) {
448 return translate_error(mData->mCodec->releaseCrypto());
452 media_status_t AMediaCodec_start(AMediaCodec *mData) {
453 status_t ret = mData->mCodec->start();
457 mData->mActivityNotification = new AMessage(kWhatActivityNotify, mData->mHandler);
458 mData->mActivityNotification->setInt32("generation", mData->mGeneration);
459 requestActivityNotification(mData);
464 media_status_t AMediaCodec_stop(AMediaCodec *mData) {
465 media_status_t ret = translate_error(mData->mCodec->stop());
467 sp<AMessage> msg = new AMessage(kWhatStopActivityNotifications, mData->mHandler);
470 mData->mActivityNotification.clear();
476 media_status_t AMediaCodec_flush(AMediaCodec *mData) {
477 return translate_error(mData->mCodec->flush());
481 ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec *mData, int64_t timeoutUs) {
483 status_t ret = mData->mCodec->dequeueInputBuffer(&idx, timeoutUs);
484 requestActivityNotification(mData);
492 uint8_t* AMediaCodec_getInputBuffer(AMediaCodec *mData, size_t idx, size_t *out_size) {
493 if (mData->mAsyncNotify != NULL) {
496 if (mData->mCodec->getInputBuffer(idx, &abuf) != 0) {
507 if (mData->mCodec->getInputBuffers(&abufs) == 0) {
527 uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec *mData, size_t idx, size_t *out_size) {
528 if (mData->mAsyncNotify != NULL) {
531 if (mData->mCodec->getOutputBuffer(idx, &abuf) != 0) {
542 if (mData->mCodec->getOutputBuffers(&abufs) == 0) {
558 media_status_t AMediaCodec_queueInputBuffer(AMediaCodec *mData,
562 status_t ret = mData->mCodec->queueInputBuffer(idx, offset, size, time, flags, &errorMsg);
567 ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec *mData,
574 status_t ret = mData->mCodec->dequeueOutputBuffer(&idx, &offset, &size, &presentationTimeUs,
576 requestActivityNotification(mData);
597 AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec *mData) {
599 mData->mCodec->getOutputFormat(&format);
604 AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec *mData) {
606 mData->mCodec->getInputFormat(&format);
611 AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec *mData, size_t index) {
613 mData->mCodec->getOutputFormat(index, &format);
618 media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec *mData, size_t idx, bool render) {
620 return translate_error(mData->mCodec->renderOutputBufferAndRelease(idx));
622 return translate_error(mData->mCodec->releaseOutputBuffer(idx));
628 AMediaCodec *mData, size_t idx, int64_t timestampNs) {
630 return translate_error(mData->mCodec->renderOutputBufferAndRelease(idx, timestampNs));
634 media_status_t AMediaCodec_setOutputSurface(AMediaCodec *mData, ANativeWindow* window) {
639 return translate_error(mData->mCodec->setSurface(surface));
643 media_status_t AMediaCodec_createInputSurface(AMediaCodec *mData, ANativeWindow **surface) {
644 if (surface == NULL || mData == NULL) {
650 status_t err = mData->mCodec->createInputSurface(&igbp);
685 AMediaCodec *mData, ANativeWindow *surface) {
687 if (surface == NULL || mData == NULL) {
697 return translate_error(mData->mCodec->setInputSurface(
703 AMediaCodec *mData, const AMediaFormat* params) {
704 if (params == NULL || mData == NULL) {
711 return translate_error(mData->mCodec->setParameters(nativeParams));
715 media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) {
717 if (mData == NULL) {
721 status_t err = mData->mCodec->signalEndOfInputStream();
731 media_status_t AMediaCodec_setNotificationCallback(AMediaCodec *mData, OnCodecEvent callback,
733 mData->mCallback = callback;
734 mData->mCallbackUserData = userdata;