Ejemplo n.º 1
0
 inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() )
 {
     return
         trim_copy_if(
             Input, 
             is_space(Loc) );
 }
Ejemplo n.º 2
0
///
/// Parse line containing SDP fmtp attribute for H.264.
///
/// @post config is non-empty if returns true, empty if false.
///
/// @param[in] line Line containing the fmtp attribute.
/// @param[out] config Configuration bytes.
/// @return Whether the fmtp attribute was parsed.
bool
RTSPUDPH264::
ParseFmtp(const string &line, vector<BYTE> &config) const
{
    bool parsed = false;

    config.clear();

    // Make sure we have an fmtp line to parse.
    if (!line.empty())
    {
        vector<string> fmtp_parts;
        string trimmed = trim_copy_if(line, is_any_of(" ;"));
        split(fmtp_parts, trimmed, is_any_of(" ;"), token_compress_on);
        string modeString;
        string sets;
        BOOST_FOREACH(const string &parameter, fmtp_parts)
        {
            if (starts_with(parameter, "packetization-mode"))
            {
                string::size_type iIndex = parameter.find("=");
                if (iIndex != string::npos)
                {
                    iIndex++; // move past '='
                    modeString = &parameter[iIndex];
                }
            }
            else if (starts_with(parameter, "sprop-parameter-sets"))
            {
                string::size_type iIndex = parameter.find("=");
                if (iIndex != string::npos)
                {
                    iIndex++; // move past '='
                    sets = &parameter[iIndex];
                }
            }
        }

        parsed = SupportedPacketizationMode(modeString) &&
            ParseSpropParameterSets(sets, config);
    }