netwerk/protocol/rtsp/rtsp/ASessionDescription.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

     1 /*
     2  * Copyright (C) 2010 The Android Open Source Project
     3  *
     4  * Licensed under the Apache License, Version 2.0 (the "License");
     5  * you may not use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *      http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    17 #ifndef A_SESSION_DESCRIPTION_H_
    19 #define A_SESSION_DESCRIPTION_H_
    21 #include <sys/types.h>
    23 #include <media/stagefright/foundation/ABase.h>
    24 #include <utils/KeyedVector.h>
    25 #include <utils/RefBase.h>
    26 #include <utils/Vector.h>
    28 namespace android {
    30 struct AString;
    32 struct ASessionDescription : public RefBase {
    33     ASessionDescription();
    35     bool setTo(const void *data, size_t size);
    36     bool isValid() const;
    38     // Actually, 1 + number of tracks, as index 0 is reserved for the
    39     // session description root-level attributes.
    40     size_t countTracks() const;
    41     void getFormat(size_t index, AString *value) const;
    43     void getFormatType(
    44             size_t index, unsigned long *PT,
    45             AString *desc, AString *params) const;
    47     bool getDimensions(
    48             size_t index, unsigned long PT,
    49             int32_t *width, int32_t *height) const;
    51     bool getDurationUs(int64_t *durationUs) const;
    53     static void ParseFormatDesc(
    54             const char *desc, int32_t *timescale, int32_t *numChannels);
    56     bool findAttribute(size_t index, const char *key, AString *value) const;
    58     // parses strings of the form
    59     //   npt      := npt-time "-" npt-time? | "-" npt-time
    60     //   npt-time := "now" | [0-9]+("." [0-9]*)?
    61     //
    62     // Returns true iff both "npt1" and "npt2" times were available,
    63     // i.e. we have a fixed duration, otherwise this is live streaming.
    64     static bool parseNTPRange(const char *s, float *npt1, float *npt2);
    66 protected:
    67     virtual ~ASessionDescription();
    69 private:
    70     typedef KeyedVector<AString,AString> Attribs;
    72     bool mIsValid;
    73     Vector<Attribs> mTracks;
    74     Vector<AString> mFormats;
    76     bool parse(const void *data, size_t size);
    78     DISALLOW_EVIL_CONSTRUCTORS(ASessionDescription);
    79 };
    81 }  // namespace android
    83 #endif  // A_SESSION_DESCRIPTION_H_

mercurial