<commit_before>/*
 * Copyright (C) 2008 <NAME> <<EMAIL>>.
 * Copyright (C) 2010 Nokia Corporation.
 *
 * Author: <NAME> (Khattak) <<EMAIL>>
 *                               <<EMAIL>>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

using GUPnP;

/**
 * Represents an audio item.
 */
public class Rygel.AudioItem : MediaItem {
    public new const string UPNP_CLASS = "object.item.audioItem";

    public long duration { get; set; default = -1; }  // Duration in seconds
    public int bitrate { get; set; default = -1; }    // Bytes/second

    public int sample_freq { get; set; default = -1; }
    public int bits_per_sample { get; set; default = -1; }
    public int channels { get; set; default = -1; }

    public AudioItem (string         id,
                      MediaContainer parent,
                      string         title,
                      string         upnp_class = AudioItem.UPNP_CLASS) {
        Object (id : id,
                parent : parent,
                title : title,
                upnp_class : upnp_class);
    }

    public override bool streamable () {
        return true;
    }

    internal override DIDLLiteResource add_resource
                                        (DIDLLiteObject didl_object,
                                         string?        uri,
                                         string         protocol,
                                         string?        import_uri = null)
                                         throws Error {
        var res = base.add_resource (didl_object, uri, protocol, import_uri);

        res.duration = this.duration;
        res.bitrate = this.bitrate;
        res.sample_freq = this.sample_freq;
        res.bits_per_sample = this.bits_per_sample;
        res.audio_channels = this.channels;

        return res;
    }
}
<commit_msg>server: Add AudioItem documentation<commit_after>/*
 * Copyright (C) 2008 <NAME> <<EMAIL>>.
 * Copyright (C) 2010 Nokia Corporation.
 * Copyright (C) 2013 Cable Television Laboratories, Inc.
 *
 * Author: <NAME> (Khattak) <<EMAIL>>
 *                               <<EMAIL>>
 *         <NAME> <<EMAIL>>
 *         <NAME> <<EMAIL>>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

using GUPnP;

/**
 * Represents an audio item contained in a file.
 */
public class Rygel.AudioItem : MediaItem {
    public new const string UPNP_CLASS = "object.item.audioItem";

    /**
     * The duration of the source content (this.uri) in seconds.
     * A value of -1 means the duration is unknown
     */
    public long duration { get; set; default = -1; }

    /**
     * The bitrate of the source content (this.uri) in bytes/second.
     * A value of -1 means the bitrate is unknown
     */
    public int bitrate { get; set; default = -1; }

    /**
     * The sample frequency of the source content (this.uri) in Hz.
     * A value of -1 means the sample frequency is unknown
     */
    public int sample_freq { get; set; default = -1; }

    /**
     * The bits per sample of the source content (this.uri).
     * A value of -1 means the bits per sample is unknown
     */
    public int bits_per_sample { get; set; default = -1; }

    /**
     * The number of audio channels in the source content (this.uri).
     * A value of -1 means the number of channels is unknown
     */
    public int channels { get; set; default = -1; }

    public AudioItem (string         id,
                      MediaContainer parent,
                      string         title,
                      string         upnp_class = AudioItem.UPNP_CLASS) {
        Object (id : id,
                parent : parent,
                title : title,
                upnp_class : upnp_class);
    }

    public override bool streamable () {
        return true;
    }

    internal override DIDLLiteResource add_resource
                                        (DIDLLiteObject didl_object,
                                         string?        uri,
                                         string         protocol,
                                         string?        import_uri = null)
                                         throws Error {
        var res = base.add_resource (didl_object, uri, protocol, import_uri);

        res.duration = this.duration;
        res.bitrate = this.bitrate;
        res.sample_freq = this.sample_freq;
        res.bits_per_sample = this.bits_per_sample;
        res.audio_channels = this.channels;

        return res;
    }
}

{'fraction_non_alphanumeric': 0.07955314827352743, 'fraction_numerical': 0.00998645903859174, 'mean_word_length': 1.8354126679462572, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4428850', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1490, 'n_words': 613}