<commit_before>import AVFoundation

enum PlaybackState {
    case Idle, Paused, Playing, Buffering
}

public class AVFoundationPlayback: Playback {
    private var kvoStatusDidChangeContext = 0
    private var kvoTimeRangesContext = 0
    private var kvoBufferingContext = 0
    
    private var player: AVPlayer?
    private var playerLayer: AVPlayerLayer?
    private var currentState = PlaybackState.Idle
    
    public var url: NSURL?
    
    public override var pluginName: String {
        return "AVPlayback"
    }

    public override var selectedSubtitle: Subtitle? {
        get {
            let option = getSelectedMediaOptionWithCharacteristic(AVMediaCharacteristicLegible)
            return Subtitle.fromAVMediaSelectionOption(option)
        }
        set {
            if let newOption = newValue?.raw as? AVMediaSelectionOption {
                setMediaSelectionOption(newOption, characteristic: AVMediaCharacteristicLegible)
            }
        }
    }

    public override var selectedAudioSource: AudioSource? {
        get {
            let option = getSelectedMediaOptionWithCharacteristic(AVMediaCharacteristicAudible)
            return AudioSource.fromAVMediaSelectionOption(option)
        }
        set {
            if let newOption = newValue?.raw as? AVMediaSelectionOption {
                setMediaSelectionOption(newOption, characteristic: AVMediaCharacteristicAudible)
            }
        }
    }
    <commit_msg>AVPlayback: Allow subtitle to be nil<commit_after>import AVFoundation

enum PlaybackState {
    case Idle, Paused, Playing, Buffering
}

public class AVFoundationPlayback: Playback {
    private var kvoStatusDidChangeContext = 0
    private var kvoTimeRangesContext = 0
    private var kvoBufferingContext = 0
    
    private var player: AVPlayer?
    private var playerLayer: AVPlayerLayer?
    private var currentState = PlaybackState.Idle
    
    public var url: NSURL?
    
    public override var pluginName: String {
        return "AVPlayback"
    }
    
    public override var selectedSubtitle: Subtitle? {
        get {
            let option = getSelectedMediaOptionWithCharacteristic(AVMediaCharacteristicLegible)
            return Subtitle.fromAVMediaSelectionOption(option)
        }
        set {
            let newOption = newValue?.raw as? AVMediaSelectionOption
            setMediaSelectionOption(newOption, characteristic: AVMediaCharacteristicLegible)
        }
    }
    
    public override var selectedAudioSource: AudioSource? {
        get {
            let option = getSelectedMediaOptionWithCharacteristic(AVMediaCharacteristicAudible)
            return AudioSource.fromAVMediaSelectionOption(option)
        }
        set {
            if let newOption = newValue?.raw as? AVMediaSelectionOption {
                setMediaSelectionOption(newOption, characteristic: AVMediaCharacteristicAudible)
            }
        }
    }
    
{'fraction_non_alphanumeric': 0.05037697052775874, 'fraction_numerical': 0.00205620287868403, 'mean_word_length': 2.644194756554307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3745394', 'n_tokens_mistral': 758, 'n_tokens_neox': 734, 'n_words': 184}