package com.ss.android.ugc.aweme.services.video;

import X.AnonymousClass6ZR;
import X.C38646es;
import X.C42016kJ;
import X.C45066pE;
import X.M12;
import android.graphics.Bitmap;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.editSticker.model.CoverPublishModel;
import com.ss.android.ugc.aweme.effect.EffectPointModel;
import com.ss.android.ugc.aweme.filter.FilterBean;
import com.ss.android.ugc.aweme.out.AVServiceImpl;
import com.ss.android.ugc.aweme.services.IInternalAVService;
import com.ss.android.ugc.aweme.services.effect.IEffectService;
import java.util.ArrayList;
import kotlin.h.b.n;

public final class VideoCoverServiceImpl implements IVideoCoverService {
    static {
        Covode.recordClassIndex(105492);
    }

    public final Bitmap mergeCoverTextImage(Bitmap bitmap, CoverPublishModel coverPublishModel) {
        if (coverPublishModel == null) {
            return bitmap;
        }
        return coverPublishModel.getEffectTextModel().mergeCoverText(bitmap);
    }

    public final void getVideoCoverByCallback(C42016kJ r11, IEffectService.OnVideoCoverCallback onVideoCoverCallback) {
        boolean z;
        M12.LIZ(r11);
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(r11.LIZIZ());
        EffectPointModel effectPointModel = r11.LIZ.LJFF.LIZIZ;
        if (effectPointModel != null) {
            arrayList.add(effectPointModel);
            if (TextUtils.equals(effectPointModel.getKey(), "1")) {
                z = true;
                AnonymousClass6ZR.LIZLLL("DraftBoxViewHolder SetCoverImage EffectPointModelList:" + arrayList + "\n filterId:" + r11.LJJJJZ.LJJ);
                VideoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1 videoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1 = new VideoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1(this, r11, onVideoCoverCallback);
                IInternalAVService LIZ = AVServiceImpl.LIZ();
                n.LIZIZ(LIZ, "");
                FilterBean filter = LIZ.getFilterService().getFilter(r11.LJIILJJIL);
                n.LIZIZ(filter, "");
                C45066pE.LIZ(arrayList, filter.getFilterFilePath(), r11.LJIJJ(), (int) (r11.LJJJJJ * 1000.0f), z, C38646es.LJ(r11), videoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1);
            }
        }
        z = false;
        AnonymousClass6ZR.LIZLLL("DraftBoxViewHolder SetCoverImage EffectPointModelList:" + arrayList + "\n filterId:" + r11.LJJJJZ.LJJ);
        VideoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1 videoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$12 = new VideoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$1(this, r11, onVideoCoverCallback);
        IInternalAVService LIZ2 = AVServiceImpl.LIZ();
        n.LIZIZ(LIZ2, "");
        FilterBean filter2 = LIZ2.getFilterService().getFilter(r11.LJIILJJIL);
        n.LIZIZ(filter2, "");
        C45066pE.LIZ(arrayList, filter2.getFilterFilePath(), r11.LJIJJ(), (int) (r11.LJJJJJ * 1000.0f), z, C38646es.LJ(r11), videoCoverServiceImpl$getVideoCoverByCallback$delegateCallback$12);
    }
}
