##############################################################################
# 1.General settings
##############################################################################

# Dongle configuration (use lsusb to find yours)
# Note that vendor id and product id are in decimals, not hex here
#vendor-id = 4884 # 0x1314
#product-id = 5408 # 0x1520

# Requested image resolution
#width = 1024
#height = 576

# Requested image refresh rate
#source-fps = 60

# Application window mode
# 0 - windowed
# 1 - fullscreen
# 2 - headless linux (in case of direct output to screen without window manager)
#window-mode = 0

# Show mouse pointer
#cursor = false

# Set log level. Can reduce performace
# 0 - No logging
# 1 - Errors
# 2 - Warnings
# 3 - Information
# 4 - Debug
# 5 - Verbose
# 6 - Protocol dump
#log-level = 2

##############################################################################
# 2.Device configurations
##############################################################################

# USB communication protocol encryption
# From 2024 Carlinkit has an optinal USB protocol encryption
# It can happened that it will become mandatory and device will not work withou it
# So if you have updated your device and it stop working try to enable encryption
#encryption = false

# Enable automatic connection to wireless devices
#autoconnect = true

# Eanble weak charging current (standart usb 0.5A).
# If you have a powerfull poswer supply you can try to disable this.
# If you have troubles with wired connection try to enable this, cause it might be cause of power lack.
#weak-charge = true

# Driving position, true for left hand drive, false for right hand drive
#left-hand-drive = true

# Nigh mode. 0 for day mode, 1 for night mode, 2 for automatic
#night-mode = 2

# Enable 5Ghz wifi. Otherwise will use 2,4Ghz
#wifi-5 = true

# Enable bluetooth audio. If enables the audio will be played not through the dongle but through bluetooth connection
#bluetooth-audio = false

# Microphone in use. Copied directly from carlinkit app.
# 1 - Car
# 2 - Box
# 3 - Phone
#mic-type = 1

# Requested image DPI (Android auto scale)
#android-dpi = 120

# Android auto resolution mode.
# Android is always streaming one of fixed resolutions
# If you are using default android auto make sure that your widh and height
# set up according to resolution. Or you can enable any resolution by developer menu.
# For developer menu go to Android Auto app info -> Additional settings in the app
# Scrol down and tap fast 5 times on version. Now you can use top right three dots menu
# to go to "Developer settings". Tap "Video Resolution" and select "Allow to car and phone to negotiate"
# 1 - 480p => 800x480
# 2 - 720p => 1280x720
# 3 - 1080p => 1920x1080
#android-resolution = 1

# Media delay for android auto
#android-media-delay = 300

##############################################################################
# 3.Application configuration
##############################################################################

# Font size for messgaes on screen. Set to 0 is you do not want any
#font-size = 40

# Enable vsync. This reduce tearing but can dramatically affect performance on low end systems
#vsync = false

# Prefer HW decoding.
# If you have input lag that means that your hardware decoder can't work in streaming mode
# This is happening or Raspberry Pi Zero 2W. Disable this to use SW decoding for that case.
#hw-decode = true

# Rendeing buffer size, increse for smoothness but can introduce lag. Minimum size is 3
#rendering-buffer = 5

# Skip several frames on processing events if FPS drops. Can increase responsivenes and reduce lag.
#draw-skip-events = 3

# Request extra frames onevery key press. Usefull if you do not see last updates after key press
# Enable for RPI hardware decoding and other systems where hardware decoder tends to buffer frames
# 0 - disabled, enter number of frames after which the request is made (find minimal value that get all screen updates)
#force-redraw = 0

# Corrects aspect of UI
#aspect-correction = 1

# Force SDL renderer backend, leave empty for automatic
# Examples: opengles2, opengl, software
#renderer-driver = 

# Use alternative video rendering method. May reduce CPU load and increase smoothness.
#alternative-rendering = false

# Select faster method of scaling image to window size (nearest) or better quality (linear)
#fast-render-scale = false

# USB read pipeline tuning, number of libusb bulk transfers kept in flight and size of each USB transfer
# Increase amount of async-usb-calls if you have issues with audio and video lagging behind
# If you have mallformed message errors on RPI try to increase async-usb-calls
#async-usb-calls = 32
#usb-buffer-size = 2048

# Number of buffered USB data slots queued for processing
#usb-buffer = 128

# Size of video and audio buffers. Increase if you see artifacts
#video-buffer-size = 64
#audio-buffer-size = 64

# Audio delay for music and calls. Fill the buffer to this value before start playing.
# Increase if you hear audio artifacts or tearing. Should be less than audio-buffer-size
#audio-buffer-wait = 2
#audio-buffer-wait-call = 6

# Reduce volume of main audio source when there is higher priority audio stream.
# This will reduce volume of the music if there is navigation instructions
# Reduction level from 1 (no reduction) to 0 (fully silenced)
#audio-fade = 0.3

# Delay navidation audio in milliseconds.
# Adjust value so navigation guidance do not start before main audio fade out.
# If you experience audio artifacts with high values increase audio-buffer-size 
#audio-aux-delay = 200

# Basic number of audio sample frames in the output buffer that is scaled by sample rate.
# This controls the size of the audio buffer used by the audio device.
# The buffer time is ~ 1/10 buffer size in ms, depending on sample rate e.g. 2048 = ~200ms
# Preferably use power of 2 for the values or check your audio driver documentation
#audio-buffer-samples = 512

# Force application to use following audio driver as audio output, if empty use default driver
# See SDL documentation for options. Some of them are
# alsa - Not supporting multiple channels, navigation over music will not work
# pulseaudio
# pipewire
#audio-driver = 

# Run script or app on phone connected and disconnected.
# This script/app should be fast, otherwise it will block system.
# If you need to start application in background use scripts with fork
#
#   #!/bin/bash
#   MyApp &
#   echo $! > app.pid
#
#   #!/bin/bash
#   if [ -f app.pid ]; then
#       kill -INT $(cat app.pid)
#       rm app.pid
#   fi
#
#on-connect-script =
#on-disconnect-script =

##############################################################################
# 4. Key mapping
##############################################################################

# Path for named pipe that keys are going to be listen on to.
# If empty pipe listening is disables.
# Example /tmp/fastcarplay_pipe
# Keys are byte value [1..255]
# They are mapped to keys defined above
#key-pipe-path =

# Map keys to control 
# If you set log-level and press keys you will see their codes in logs
#key-siri = 115             # S
#key-nightmode-on = 122     # Z
#key-nightmode-off = 120    # X
#key-left = 1073741904      # Left arrow
#key-left-extra = 39        # '
#key-right = 1073741903     # Right arrow
#key-right-extra = 92       # \
#key-enter = 13             # Enter
# For pipe to simulate key up after key-enter press
#key-enterup = 0            # unmapped by default
#key-back = 8               # Backspace
#key-up = 1073741906        # Up arrow
#key-down = 1073741905      # Down arrow
#key-home = 104             # H
#key-play = 93              # P
#key-pause = 91             # [
#key-play-toggle = 112      # ]
#key-next = 46              # >
#key-previous = 44          # <
#key-call-accept = 97       # A
#key-call-reject = 115      # S
#key-video-focus = 118      # V
#key-video-release = 98     # B
#key-nav-focus = 110        # N
#key-nav-release = 109      # M

##############################################################################
# 5. Custom scripts
##############################################################################

# Set custom script to be executed and/or message to be shown when key is pressed

# Custom script 1
#custom-script-1 =          
#key-custom-script-1 = 49   # 1
#custom-script-name-1 =

# Custom script 2
#custom-script-2 =          
#key-custom-script-2 = 50   # 2
#custom-script-name-2 =

# Custom script 3
#custom-script-3 =          
#key-custom-script-3 = 51   # 3
#custom-script-name-3 =

# Custom script 4
#custom-script-4 =          
#key-custom-script-4 = 52   # 4
#custom-script-name-4 =

##############################################################################
# 6.Debug
##############################################################################

# Enable FFMPEG AV_CODEC_FLAG_LOW_DELAY for HW decoder.
# Force low delay.
#decode-low-delay = true

# Enable FFMPEG AV_CODEC_FLAG2_FAST for HW decoder.
# Allow non spec compliant speedup tricks.
#decode-fast = true

# Draw debug info overlay on top of the video output.
#debug-overlay = false
