#!/usr/bin/env bash

set -euo pipefail

KEEP_TAGS=(
  "flutter:V"
  "ExoPlayerImpl:V"
  "MediaCodecVideoRenderer:V"
  "MediaCodecRenderer:V"
  "MediaCodecInfo:V"
  "VideoCapabilities:V"
  "Media3Engine:V"
  "Media3PlatformView:V"
  "Media3Player:V"
  "Media3PlayerEngine:V"
  "Media3PlayerInstance:V"
  "DolbyVisionConfig:V"
  "HevcReader:V"
  "Mp4Extractor:I"
  "DefaultTrackSelector:I"
  "EventLogger:V"
  "AndroidRuntime:E"
)

RAW=0
if [[ "${1:-}" == "--raw" ]]; then
  RAW=1
fi

if [[ $RAW -eq 0 ]]; then
  adb logcat -c
fi

exec adb logcat "${KEEP_TAGS[@]}" "*:S"
