Full Code of 01org/wds for AI

master 2d7db6cd406e cached
190 files
543.7 KB
149.8k tokens
381 symbols
1 requests
Download .txt
Showing preview only (591K chars total). Download the full file or copy to clipboard to get everything.
Repository: 01org/wds
Branch: master
Commit: 2d7db6cd406e
Files: 190
Total size: 543.7 KB

Directory structure:
gitextract_id6ruww0/

├── CMakeLists.txt
├── COPYING
├── README.md
├── TODO
├── data/
│   ├── CMakeLists.txt
│   └── wds.pc.in
├── datadumps/
│   ├── gstreamer-pipelines.txt
│   ├── information-elements.pcapng
│   └── rtsp-capture-win8.txt
├── desktop_source/
│   ├── CMakeLists.txt
│   ├── desktop_media_manager.cpp
│   ├── desktop_media_manager.h
│   ├── main.cpp
│   ├── mirac_broker_source.cpp
│   ├── mirac_broker_source.h
│   ├── source-app.cpp
│   └── source-app.h
├── libwds/
│   ├── CMakeLists.txt
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── logging.cpp
│   │   ├── message_handler.cpp
│   │   ├── message_handler.h
│   │   ├── rtsp_input_handler.cpp
│   │   ├── rtsp_input_handler.h
│   │   └── video_format.cpp
│   ├── public/
│   │   ├── audio_codec.h
│   │   ├── connector_type.h
│   │   ├── logging.h
│   │   ├── media_manager.h
│   │   ├── peer.h
│   │   ├── sink.h
│   │   ├── source.h
│   │   ├── video_format.h
│   │   └── wds_export.h
│   ├── rtsp/
│   │   ├── CMakeLists.txt
│   │   ├── audiocodecs.cpp
│   │   ├── audiocodecs.h
│   │   ├── avformatchangetiming.cpp
│   │   ├── avformatchangetiming.h
│   │   ├── clientrtpports.cpp
│   │   ├── clientrtpports.h
│   │   ├── connectortype.cpp
│   │   ├── connectortype.h
│   │   ├── constants.h
│   │   ├── contentprotection.cpp
│   │   ├── contentprotection.h
│   │   ├── coupledsink.cpp
│   │   ├── coupledsink.h
│   │   ├── displayedid.cpp
│   │   ├── displayedid.h
│   │   ├── driver.cpp
│   │   ├── driver.h
│   │   ├── errorlexer.l
│   │   ├── formats3d.cpp
│   │   ├── formats3d.h
│   │   ├── genericproperty.cpp
│   │   ├── genericproperty.h
│   │   ├── getparameter.cpp
│   │   ├── getparameter.h
│   │   ├── header.cpp
│   │   ├── header.h
│   │   ├── headerlexer.l
│   │   ├── i2c.cpp
│   │   ├── i2c.h
│   │   ├── idrrequest.cpp
│   │   ├── idrrequest.h
│   │   ├── macros.h
│   │   ├── message.cpp
│   │   ├── message.h
│   │   ├── messagelexer.l
│   │   ├── messages_rules.txt
│   │   ├── options.cpp
│   │   ├── options.h
│   │   ├── parser.ypp
│   │   ├── pause.cpp
│   │   ├── pause.h
│   │   ├── payload.cpp
│   │   ├── payload.h
│   │   ├── play.cpp
│   │   ├── play.h
│   │   ├── preferreddisplaymode.cpp
│   │   ├── preferreddisplaymode.h
│   │   ├── presentationurl.cpp
│   │   ├── presentationurl.h
│   │   ├── property.cpp
│   │   ├── property.h
│   │   ├── propertyerrors.cpp
│   │   ├── propertyerrors.h
│   │   ├── reply.cpp
│   │   ├── reply.h
│   │   ├── route.cpp
│   │   ├── route.h
│   │   ├── setparameter.cpp
│   │   ├── setparameter.h
│   │   ├── setup.cpp
│   │   ├── setup.h
│   │   ├── standby.cpp
│   │   ├── standby.h
│   │   ├── standbyresumecapability.cpp
│   │   ├── standbyresumecapability.h
│   │   ├── teardown.cpp
│   │   ├── teardown.h
│   │   ├── tests/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README
│   │   │   ├── dict/
│   │   │   │   ├── wfd_header.dict
│   │   │   │   ├── wfd_payload_error.dict
│   │   │   │   ├── wfd_payload_reply.dict
│   │   │   │   └── wfd_payload_request.dict
│   │   │   ├── run_afl_fuzzer.sh
│   │   │   ├── seed/
│   │   │   │   ├── header/
│   │   │   │   │   ├── error.txt
│   │   │   │   │   ├── get_parameter.txt
│   │   │   │   │   ├── options.txt
│   │   │   │   │   ├── pause.txt
│   │   │   │   │   ├── play.txt
│   │   │   │   │   ├── reply.txt
│   │   │   │   │   ├── set_parameter.txt
│   │   │   │   │   ├── setup.txt
│   │   │   │   │   └── teardown.txt
│   │   │   │   ├── payload_error/
│   │   │   │   │   ├── payload_error01.txt
│   │   │   │   │   └── payload_error02.txt
│   │   │   │   ├── payload_reply/
│   │   │   │   │   ├── payload_reply01.txt
│   │   │   │   │   └── payload_reply02.txt
│   │   │   │   └── payload_request/
│   │   │   │       ├── payload_request01.txt
│   │   │   │       └── payload_request02.txt
│   │   │   ├── tests.cpp
│   │   │   └── wdsfuzzer.cpp
│   │   ├── transportheader.cpp
│   │   ├── transportheader.h
│   │   ├── triggermethod.cpp
│   │   ├── triggermethod.h
│   │   ├── uibccapability.cpp
│   │   ├── uibccapability.h
│   │   ├── uibcsetting.cpp
│   │   ├── uibcsetting.h
│   │   ├── videoformats.cpp
│   │   └── videoformats.h
│   ├── sink/
│   │   ├── CMakeLists.txt
│   │   ├── cap_negotiation_state.cpp
│   │   ├── cap_negotiation_state.h
│   │   ├── init_state.cpp
│   │   ├── init_state.h
│   │   ├── session_state.cpp
│   │   ├── session_state.h
│   │   ├── sink.cpp
│   │   ├── streaming_state.cpp
│   │   └── streaming_state.h
│   └── source/
│       ├── CMakeLists.txt
│       ├── cap_negotiation_state.cpp
│       ├── cap_negotiation_state.h
│       ├── init_state.cpp
│       ├── init_state.h
│       ├── session_state.cpp
│       ├── session_state.h
│       ├── source.cpp
│       ├── streaming_state.cpp
│       └── streaming_state.h
├── mirac_network/
│   ├── CMakeLists.txt
│   ├── gst-test.cpp
│   ├── mirac-broker.cpp
│   ├── mirac-broker.hpp
│   ├── mirac-exception.hpp
│   ├── mirac-glib-logging.cpp
│   ├── mirac-glib-logging.hpp
│   ├── mirac-gst-bus-handler.cpp
│   ├── mirac-gst-bus-handler.hpp
│   ├── mirac-gst-sink.cpp
│   ├── mirac-gst-sink.hpp
│   ├── mirac-gst-test-source.cpp
│   ├── mirac-gst-test-source.hpp
│   ├── mirac-network.cpp
│   ├── mirac-network.hpp
│   └── network-test.cpp
├── p2p/
│   ├── CMakeLists.txt
│   ├── connman-client.cpp
│   ├── connman-client.h
│   ├── connman-peer.cpp
│   ├── connman-peer.h
│   ├── information-element.cpp
│   ├── information-element.h
│   ├── main.cpp
│   └── test-ie.cpp
├── rtsp-message-exchanges.txt
└── sink/
    ├── CMakeLists.txt
    ├── gst_sink_media_manager.cpp
    ├── gst_sink_media_manager.h
    ├── main.cpp
    ├── sink-app.cpp
    ├── sink-app.h
    ├── sink.cpp
    └── sink.h

================================================
FILE CONTENTS
================================================

================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 2.8)

project(wds CXX)

set(WDS_VERSION_MAJOR 1)
set(WDS_VERSION_MINOR 1)
set(WDS_VERSION_PATCH 0)

enable_testing()

option(WDS_INSTALL_TESTS "Install test programs" off)

include(GNUInstallDirs)

add_subdirectory(data)
add_subdirectory(libwds/rtsp)
add_subdirectory(libwds/rtsp/tests)
add_subdirectory(libwds/common)
add_subdirectory(libwds/source)
add_subdirectory(libwds/sink)
add_subdirectory(libwds)
add_subdirectory(p2p)
add_subdirectory(mirac_network)
add_subdirectory(sink)
add_subdirectory(desktop_source)


================================================
FILE: COPYING
================================================
                  GNU LESSER GENERAL PUBLIC LICENSE
                       Version 2.1, February 1999

 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL.  It also counts
 as the successor of the GNU Library Public License, version 2, hence
 the version number 2.1.]

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.

  This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it.  You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.

  When we speak of free software, we are referring to freedom of use,
not price.  Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.

  To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights.  These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.

  For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you.  You must make sure that they, too, receive or can get the source
code.  If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it.  And you must show them these terms so they know their rights.

  We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.

  To protect each distributor, we want to make it very clear that
there is no warranty for the free library.  Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.

  Finally, software patents pose a constant threat to the existence of
any free program.  We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder.  Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.

  Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License.  This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License.  We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.

  When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library.  The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom.  The Lesser General
Public License permits more lax criteria for linking other code with
the library.

  We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License.  It also provides other free software developers Less
of an advantage over competing non-free programs.  These disadvantages
are the reason we use the ordinary General Public License for many
libraries.  However, the Lesser license provides advantages in certain
special circumstances.

  For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard.  To achieve this, non-free programs must be
allowed to use the library.  A more frequent case is that a free
library does the same job as widely used non-free libraries.  In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.

  In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software.  For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.

  Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.

  The precise terms and conditions for copying, distribution and
modification follow.  Pay close attention to the difference between a
"work based on the library" and a "work that uses the library".  The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.

                  GNU LESSER GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".

  A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.

  The "Library", below, refers to any such software library or work
which has been distributed under these terms.  A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language.  (Hereinafter, translation is
included without limitation in the term "modification".)

  "Source code" for a work means the preferred form of the work for
making modifications to it.  For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.

  Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it).  Whether that is true depends on what the Library does
and what the program that uses the Library does.

  1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.

  You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.

  2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) The modified work must itself be a software library.

    b) You must cause the files modified to carry prominent notices
    stating that you changed the files and the date of any change.

    c) You must cause the whole of the work to be licensed at no
    charge to all third parties under the terms of this License.

    d) If a facility in the modified Library refers to a function or a
    table of data to be supplied by an application program that uses
    the facility, other than as an argument passed when the facility
    is invoked, then you must make a good faith effort to ensure that,
    in the event an application does not supply such function or
    table, the facility still operates, and performs whatever part of
    its purpose remains meaningful.

    (For example, a function in a library to compute square roots has
    a purpose that is entirely well-defined independent of the
    application.  Therefore, Subsection 2d requires that any
    application-supplied function or table used by this function must
    be optional: if the application does not supply it, the square
    root function must still compute square roots.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library.  To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License.  (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.)  Do not make any other change in
these notices.

  Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.

  This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.

  4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.

  If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.

  5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library".  Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.

  However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library".  The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.

  When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library.  The
threshold for this to be true is not precisely defined by law.

  If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work.  (Executables containing this object code plus portions of the
Library will still fall under Section 6.)

  Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.

  6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.

  You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License.  You must supply a copy of this License.  If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License.  Also, you must do one
of these things:

    a) Accompany the work with the complete corresponding
    machine-readable source code for the Library including whatever
    changes were used in the work (which must be distributed under
    Sections 1 and 2 above); and, if the work is an executable linked
    with the Library, with the complete machine-readable "work that
    uses the Library", as object code and/or source code, so that the
    user can modify the Library and then relink to produce a modified
    executable containing the modified Library.  (It is understood
    that the user who changes the contents of definitions files in the
    Library will not necessarily be able to recompile the application
    to use the modified definitions.)

    b) Use a suitable shared library mechanism for linking with the
    Library.  A suitable mechanism is one that (1) uses at run time a
    copy of the library already present on the user's computer system,
    rather than copying library functions into the executable, and (2)
    will operate properly with a modified version of the library, if
    the user installs one, as long as the modified version is
    interface-compatible with the version that the work was made with.

    c) Accompany the work with a written offer, valid for at
    least three years, to give the same user the materials
    specified in Subsection 6a, above, for a charge no more
    than the cost of performing this distribution.

    d) If distribution of the work is made by offering access to copy
    from a designated place, offer equivalent access to copy the above
    specified materials from the same place.

    e) Verify that the user has already received a copy of these
    materials or that you have already sent this user a copy.

  For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it.  However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.

  It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system.  Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.

  7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:

    a) Accompany the combined library with a copy of the same work
    based on the Library, uncombined with any other library
    facilities.  This must be distributed under the terms of the
    Sections above.

    b) Give prominent notice with the combined library of the fact
    that part of it is a work based on the Library, and explaining
    where to find the accompanying uncombined form of the same work.

  8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License.  Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License.  However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.

  9. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Library or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.

  10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.

  11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all.  For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded.  In such case, this License incorporates the limitation as if
written in the body of this License.

  13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number.  If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation.  If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.

  14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission.  For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this.  Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

                            NO WARRANTY

  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

                     END OF TERMS AND CONDITIONS

           How to Apply These Terms to Your New Libraries

  If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change.  You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

  To apply these terms, attach the following notices to the library.  It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the library's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This library 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.1 of the License, or (at your option) any later version.

    This library 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 library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  library `Frob' (a library for tweaking knobs) written by James Random Hacker.

  <signature of Ty Coon>, 1 April 1990
  Ty Coon, President of Vice

That's all there is to it!



================================================
FILE: README.md
================================================
DISCONTINUATION OF PROJECT.

This project will no longer be maintained by Intel.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. 

Intel no longer accepts patches to this project.

If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project. 
## Wireless Display Software For Linux OS (WDS)

WDS is a set of libraries for developers who want to build Wi-Fi Display applications on linux.

WDS consists of:
 * libwds: Main library implements a Wi-Fi Display dialect of RTSP that includes the parser, actual negotiation logic for sink and source, and the related data structures. It is not tied to any specific connection manager, media framework or main loop. This Library is also compatible with MSVC.
 * network: Supports integration with GLib main loop and GStreamer
 * p2p: Supports integration with Connman Wifi P2P features


The source code includes example implementations:
 * _sink:_ Wi-Fi Display sink that depends on Gstreamer, Connman and GLib mainloop
 * _desktop_source:_ Wi-Fi Display source that depends on Gstreamer, Connman and GLib mainloop

More information can be found on the [mailing list](https://lists.01.org/mailman/listinfo/wysiwidi-dev) and the [wiki](https://github.com/01org/wds/wiki).

### Requirements:

WDS test executables have runtime dependencies on just a few things (mostly GStreamer and GLib), but for successful Wi-Fi Display sessions the following are adviced:
 * Wifi adapter from Intel 7260-family or Atheros ath9k
 * [wpa_supplicant](http://w1.fi/wpa_supplicant/): version 2.4 or later, built with	`CONFIG_P2P=y`, `CONFIG_WIFI_DISPLAY=y` and `CONFIG_CTRL_IFACE_DBUS_NEW=y`
 * [connman](https://01.org/connman): version 1.28 (released Feb 1st 2015) or later.
 * gstreamer: either master branch more recent than Feb 3rd 2015 (commit d0a50be2), or 1.4 branch more recent than 
Feb 3rd 2005 (commit 1ce3260a638d or release 1.4.6 or later).

Test results with other Wifi adapters are very welcome but be warned that in many cases Wifi-P2P has not had the testing it needs on linux: you may run into problems in surprising places.

### Building WDS from git:

```
cmake .
make
```

### Testing WDS

#### Pre-requisites

Make sure wpa_supplicant & connmand are running. Running both of them uninstalled is possible (but in that case make sure the system wpa_supplicant and system connection manager are _not_ running):

```
$ sudo hostap/wpa_supplicant/wpa_supplicant -ddt -u

$ sudo connman/src/connmand -n -d
```

Use connmanctl to enable Wi-Fi and Wi-Fi P2P:

```
$ connman/client/connmanctl
connmanctl> enable wifi
Enabled wifi
connmanctl> enable p2p
Enabled p2p
```

Check that Peer-to-peer functionality is working:

```
connmanctl> scan p2p
Scan completed for p2p
connmanctl> peers
Nexus 5 (jku) idle peer_0c8bfd5f12fc_8ac9d0c0da67
Push2TV 75AEB2-PTV3000 idle peer_0c8bfd5f12fc_22e52a75aeb2

```

Enable agent:

```
connmanctl> agent on
Agent registered
```

#### Testing WDS sink with an Android device (e.g. Nexus 5):

* start sink: `sink/sink-test`
* Android: select the sink from the list in "Settings > Display > Cast Screen"
* connmanctl: when agent asks, accept the connection

In a few seconds, a window should open and a audio/video stream should start playing.

#### Testing WDS source with another sink:

* start source: `desktop_source/desktop_source`
* Initial scan will be automatic, but `scan` command will re-scan.
* After getting scan results, connect with `connect N` (where N is number from scan result)
* connmanctl: when agent asks, accept the connection

In a few seconds, the sink should start showing a stream mirroring your desktop.



================================================
FILE: TODO
================================================
GOAL: Make a release with the proper librarization by the time all dependencies are released, namely
	a. wpa_supplicant, past 2.3 (likely 2.4)
	b. connman, past 1.28	(likely 1.29)
	c. gst_plugins_bad past 1.4.5+ (likely 1.4.6) 


Big tasks (see issue tracker for the rest)
==========================================

Inspect and beautify P2P API

Create an installable library from the current source tree

Create C/gobject interface to the library so that language bindings can be done easliy
	
Create API for HDCP plugin implementation

Implement UIBC 

Use accelerated encoders/decoders for demo apps




================================================
FILE: data/CMakeLists.txt
================================================
configure_file(wds.pc.in wds.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wds.pc
        DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig)


================================================
FILE: data/wds.pc.in
================================================
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${exec_prefix}/include
 
Name: @CMAKE_PROJECT_NAME@
Description: Library to build WiFi Display applications
Version: @WDS_VERSION_MAJOR@.@WDS_VERSION_MINOR@.@WDS_VERSION_PATCH@
Libs: -L${libdir} -lwds
Cflags: -I${includedir}/wds


================================================
FILE: datadumps/gstreamer-pipelines.txt
================================================
WFD source:

 Only video:
 gst-launch-1.0 videotestsrc ! x264enc ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5000

 Only audio:
 gst-launch-1.0 audiotestsrc ! avenc_ac3 ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5000

 Both:
 gst-launch-1.0 videotestsrc ! x264enc ! muxer.  audiotestsrc ! avenc_ac3 ! muxer.  mpegtsmux name=muxer ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5000

WFD sink:

 Only audio:
 gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp" ! rtpmp2tdepay ! decodebin ! autoaudiosink

 Only video:
 gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp" ! rtpmp2tdepay ! decodebin ! autovideosink

 Both:
 gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp" ! rtpmp2tdepay ! decodebin name=decoder ! autoaudiosink  decoder. ! autovideosink



================================================
FILE: datadumps/rtsp-capture-win8.txt
================================================
OPTIONS * RTSP/1.0
CSeq: 1
Require: org.wfa.wfd1.0
User-Agent: WiDiApp/4.5.35.0 RDS/1.0.0

RTSP/1.0 200 OK
CSeq: 1
Date: Thu Jan  1 00:05:42 1970
Public: org.wfa.wfd1.0, GET_PARAMETER, SET_PARAMETER

OPTIONS * RTSP/1.0
CSeq: 1
Require: org.wfa.wfd1.0
User-Agent: SEC-WDH/ME29

RTSP/1.0 200 OK
CSeq: 1
Date: Tue, Aug 05 2014 18:56:28 GMT
Public: org.wfa.wfd1.0, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN

GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 2
Content-Type: text/parameters
Content-Length: 325

wfd_client_rtp_ports
wfd_audio_codecs
wfd_video_formats
wfd_3d_video_formats
wfd_coupled_sink
wfd_display_edid
wfd_connector_type
wfd_uibc_capability
wfd_standby_resume_capability
wfd_content_protection
intel_sink_version
intel_sink_information
intel_lower_bandwidth
intel_interactivity_mode
intel_fast_cursor
RTSP/1.0 200 OK
CSeq: 2
Content-Type: text/parameters
Content-Length: 1187

wfd_audio_codecs: LPCM 00000003 00, AAC 00000001 00
wfd_video_formats: 40 00 02 04 0001DEFF 053C7FFF 00000FFF 00 0000 0000 11 none none, 01 04 0001DEFF 053C7FFF 00000FFF 00 0000 0000 11 none none
wfd_3d_video_formats: 80 00 03 0F 0000000000000005 00 0001 1401 13 none none
wfd_content_protection: HDCP2.1 port=1189
wfd_display_edid: 0002 00ffffffffffff004c2dde07000000002f14010380834a780aee91a3544c99260f5054bdef80714f8100814081809500950fb300a940023a801871382d40582c4500a05a0000001e662150b051001b3040703600a05a0000001e000000fd00184b1a5117000a202020202020000000fc0053414d53554e470a202020202001fd02032ef14b901f0413051403122021222309070783010000e2000f72030c004000b82d20d0080140073f405090a0023a80d072382d40102c4580a05a0000001e011d00bc52d01e20b8285540a05a0000001e011d80d0721c1620102c2580a05a0000009e00000000000000000000000000000000000000000000000000000078
wfd_coupled_sink: none
wfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode=play
wfd_uibc_capability: none
wfd_connector_type: 05
wfd_standby_resume_capability: supported
intel_sink_version: product_ID=widicesdk hw_version=02.00.00.0000 sw_version=02.04.46.0000
intel_lower_bandwidth: none
intel_interactivity_mode: HIGH
SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 3
Content-Type: text/parameters
Content-Length: 248

wfd_audio_codecs: AAC 00000001 00
wfd_video_formats: 00 00 02 04 00000020 00000000 00000000 00 0000 0000 11 none none
wfd_presentation_URL: rtsp://192.168.173.1/wfd1.0/streamid=0 none
wfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode=play
RTSP/1.0 200 OK
CSeq: 3

SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 4
Content-Type: text/parameters
Content-Length: 146

intel_overscan_comp: x=0, y=0
intel_sigma_pipeline_params: PlaybackDelay=50; PositiveMaxStcPCR=25; NegativeMaxStcPCR=50;
intel_topology: CLONE
RTSP/1.0 200 OK
CSeq: 4

SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 5
Content-Type: text/parameters
Content-Length: 27

wfd_trigger_method: SETUP
RTSP/1.0 200 OK
CSeq: 5

SETUP rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 2
User-Agent: SEC-WDH/ME29
Transport: RTP/AVP/UDP;unicast;client_port=19000

RTSP/1.0 200 OK
CSeq: 2
Session: VaMkltjy;timeout=60
Transport: RTP/AVP/UDP;unicast;client_port=19000;server_port=53151-53153

PLAY rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 3
Session: VaMkltjy
User-Agent: SEC-WDH/ME29

RTSP/1.0 200 OK
CSeq: 3
Session: VaMkltjy
Date: Tue, Aug 05 2014 18:56:29 GMT

SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 6
Content-Type: text/parameters
Content-Length: 31
Session: VaMkltjy

intel_enable_widi_rtcp: 53153
RTSP/1.0 200 OK
CSeq: 6

SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 7
Content-Type: text/parameters
Content-Length: 172
Session: VaMkltjy

wfd_audio_codecs: AAC 00000001 00
wfd_video_formats: 00 00 02 04 00000000 00001000 00000000 00 0000 0000 11 none none
wfd_av_format_change_timing: 00000bb800 000005dc00
RTSP/1.0 200 OK
CSeq: 7

SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0
CSeq: 8
Content-Type: text/parameters
Content-Length: 150
Session: VaMkltjy

intel_sigma_pipeline_params: PlaybackDelay=50; PositiveMaxStcPCR=25; NegativeMaxStcPCR=50;
intel_interactivity_mode: DEFAULT
intel_topology: LOCAL
RTSP/1.0 200 OK
CSeq: 8

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 4
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 4
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 5
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 5
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 6
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 6
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 7
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 7
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 8
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 8
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 9
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 9
Session: VaMkltjy

SET_PARAMETER rtsp://192.168.173.1/wfd1.0/streamid=0 RTSP/1.0
CSeq: 10
Session: VaMkltjy
User-Agent: SEC-WDH/ME29
Content-Type: text/parameters
Content-Length: 17

wfd_idr_request
RTSP/1.0 200 OK
CSeq: 10
Session: VaMkltjy




================================================
FILE: desktop_source/CMakeLists.txt
================================================
#FIXME in the future: with cmake 2.8.12 and up it's better
#to use target_compile_options or add_compile_options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pthread -std=c++11")

include_directories ("${PROJECT_SOURCE_DIR}")
include_directories ("${PROJECT_SOURCE_DIR}/libwds/public")
include_directories ("${PROJECT_SOURCE_DIR}/libwds/parser")
include_directories ("${PROJECT_SOURCE_DIR}/p2p")
include_directories ("${PROJECT_SOURCE_DIR}/mirac_network")

find_package(PkgConfig REQUIRED)

pkg_check_modules (GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})

pkg_check_modules (GIO REQUIRED gio-2.0)
include_directories(${GIO_INCLUDE_DIRS})

pkg_check_modules (GST REQUIRED gstreamer-1.0)
include_directories(${GST_INCLUDE_DIRS})

add_executable(desktop-source-test main.cpp source-app.cpp mirac_broker_source.cpp desktop_media_manager.cpp)
target_link_libraries (desktop-source-test  mirac wds p2p ${GIO_LIBRARIES} ${GST_LIBRARIES})

if (WDS_INSTALL_TESTS)
  install(PROGRAMS desktop-source-test DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
endif()


================================================
FILE: desktop_source/desktop_media_manager.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
#include "desktop_media_manager.h"
#include "mirac-glib-logging.hpp"
#include <cassert>

DesktopMediaManager::DesktopMediaManager(const std::string& hostname)
  : hostname_(hostname),
    format_() {
}

void DesktopMediaManager::Play() {
  assert(gst_pipeline_);
  gst_pipeline_->SetState(GST_STATE_PLAYING);
}

void DesktopMediaManager::Pause() {
  assert(gst_pipeline_);
  gst_pipeline_->SetState(GST_STATE_PAUSED);
}

void DesktopMediaManager::Teardown() {
  if (gst_pipeline_)
    gst_pipeline_->SetState(GST_STATE_READY);
}

bool DesktopMediaManager::IsPaused() const {
  return (gst_pipeline_->GetState() != GST_STATE_PLAYING);
}

std::string DesktopMediaManager::GetSessionId() const {
  return "abcdefg123456";
}

wds::SessionType DesktopMediaManager::GetSessionType() const {
  return wds::VideoSession;
}

void DesktopMediaManager::SetSinkRtpPorts(int port1, int port2) {
  sink_port1_ = port1;
  sink_port2_ = port2;
  gst_pipeline_.reset(new MiracGstTestSource(WFD_DESKTOP, hostname_, port1));
  gst_pipeline_->SetState(GST_STATE_READY);
}

std::pair<int, int> DesktopMediaManager::GetSinkRtpPorts() const {
  return std::pair<int, int>(sink_port1_, sink_port2_);
}

int DesktopMediaManager::GetLocalRtpPort() const {
  return gst_pipeline_->UdpSourcePort();
}

namespace {

std::vector<wds::H264VideoCodec> GetH264VideoCodecs() {
  static std::vector<wds::H264VideoCodec> codecs;
  if (codecs.empty()) {
    wds::RateAndResolutionsBitmap cea_rr;
    wds::RateAndResolutionsBitmap vesa_rr;
    wds::RateAndResolutionsBitmap hh_rr;
    wds::RateAndResolution i;
    // declare that we support all resolutions, CHP and level 4.2
    // gstreamer should handle all of it :)
    for (i = wds::CEA640x480p60; i <= wds::CEA1920x1080p24; ++i)
      cea_rr.set(i);
    for (i = wds::VESA800x600p30; i <= wds::VESA1920x1200p30; ++i)
      vesa_rr.set(i);
    for (i = wds::HH800x480p30; i <= wds::HH848x480p60; ++i)
      hh_rr.set(i);

    wds::H264VideoCodec codec(wds::CHP, wds::k4_2, cea_rr, vesa_rr, hh_rr);
    codecs.push_back(codec);
  }

  return codecs;
}

}

bool DesktopMediaManager::InitOptimalVideoFormat(
    const wds::NativeVideoFormat& sink_native_format,
    const std::vector<wds::H264VideoCodec>& sink_supported_codecs) {

  format_ = wds::FindOptimalVideoFormat(sink_native_format,
                                        GetH264VideoCodecs(),
                                        sink_supported_codecs);
  return true;
}

wds::H264VideoFormat DesktopMediaManager::GetOptimalVideoFormat() const {
  return format_;
}

bool DesktopMediaManager::InitOptimalAudioFormat(const std::vector<wds::AudioCodec>& sink_codecs) {
  for (const auto& codec : sink_codecs) {
     if (codec.format == wds::AAC && codec.modes.test(wds::AAC_48K_16B_2CH))
       return true;
  }
  return false;
}

wds::AudioCodec DesktopMediaManager::GetOptimalAudioFormat() const {
  wds::AudioModes audio_modes;
  audio_modes.set(wds::AAC_48K_16B_2CH);

  return wds::AudioCodec(wds::AAC, audio_modes, 0);
}

void DesktopMediaManager::SendIDRPicture() {
  WDS_WARNING("Unimplemented IDR picture request");
}


================================================
FILE: desktop_source/desktop_media_manager.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
#ifndef DESKTOP_MEDIA_MANAGER_H_
#define DESKTOP_MEDIA_MANAGER_H_

#include <memory>

#include "libwds/public/media_manager.h"
#include "mirac-gst-test-source.hpp"

class DesktopMediaManager : public wds::SourceMediaManager {
 public:
  explicit DesktopMediaManager(const std::string& hostname);
  void Play() override;
  void Pause() override;
  void Teardown() override;
  bool IsPaused() const override;
  std::string GetSessionId() const override;
  void SetSinkRtpPorts(int port1, int port2) override;
  std::pair<int,int> GetSinkRtpPorts() const override;
  int GetLocalRtpPort() const override;
  wds::SessionType GetSessionType() const override;

  bool InitOptimalVideoFormat(const wds::NativeVideoFormat& sink_native_format,
      const std::vector<wds::H264VideoCodec>& sink_supported_codecs) override;
  wds::H264VideoFormat GetOptimalVideoFormat() const override;
  bool InitOptimalAudioFormat(const std::vector<wds::AudioCodec>& sink_supported_codecs) override;
  wds::AudioCodec GetOptimalAudioFormat() const override;
  void SendIDRPicture() override;

 private:
  std::string hostname_;
  std::unique_ptr<MiracGstTestSource> gst_pipeline_;
  int sink_port1_;
  int sink_port2_;
  wds::H264VideoFormat format_;
};

#endif // DESKTOP_MEDIA_MANAGER_H_


================================================
FILE: desktop_source/main.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <glib.h>
#include <glib-unix.h>
#include <gst/gst.h>
#include <iostream>

#include "source-app.h"
#include "mirac_broker_source.h"
#include "mirac-glib-logging.hpp"

#include "libwds/public/source.h"

static gboolean _sig_handler (gpointer data_ptr)
{
    GMainLoop *main_loop = (GMainLoop *) data_ptr;

    g_main_loop_quit(main_loop);

    return G_SOURCE_CONTINUE;
}

static void parse_input_and_call_source(
    const std::string& command, SourceApp *app) {

    auto source = app->source()->wfd_source();
    bool status = true;

    if (command == "scan\n") {
        app->scan();
    } else if (command.find("connect ") == 0) {
        app->connect(std::stoi(command.substr(8)));
    } else if (command == "teardown\n") {
        status = source && source->Teardown();
    } else if (command == "pause\n") {
        status = source && source->Pause();
    } else if (command == "play\n") {
        status = source && source->Play();
    } else {
        std::cout << "Received unknown command: " << command << std::endl;
    }

    if (!status)
        std::cout << "This command cannot be executed now." << std::endl;
}

static gboolean _user_input_handler (
    GIOChannel* channel, GIOCondition /*condition*/, gpointer data_ptr)
{
    GError* error = NULL;
    char* str = NULL;
    size_t len;
    SourceApp* app = static_cast<SourceApp*>(data_ptr);

    switch (g_io_channel_read_line(channel, &str, &len, NULL, &error)) {
    case G_IO_STATUS_NORMAL:
        parse_input_and_call_source(str, app);
        g_free(str);
        return true;
    case G_IO_STATUS_ERROR:
        std::cout << "User input error: " << error->message << std::endl;
        g_error_free(error);
        return false;
    case G_IO_STATUS_EOF:
    case G_IO_STATUS_AGAIN:
        return true;
    default:
        return false;
    }
    return false;
}

int main (int argc, char *argv[])
{
    InitGlibLogging();
    int port = 7236;

    GOptionEntry main_entries[] =
    {
        { "rtsp_port", 0, 0, G_OPTION_ARG_INT, &(port), "Specify optional RTSP port number, 7236 by default", "rtsp_port"},
        { NULL }
    };

    GOptionContext* context = g_option_context_new ("- WFD desktop source demo application\n");
    g_option_context_add_main_entries (context, main_entries, NULL);
    g_option_context_add_group (context, gst_init_get_option_group ());

    GError* error = NULL;
    if (!g_option_context_parse (context, &argc, &argv, &error)) {
        WDS_ERROR ("option parsing failed: %s", error->message);
        g_option_context_free(context);
        exit (1);
    }
    g_option_context_free(context);

    SourceApp app(port);

    GMainLoop *main_loop =  g_main_loop_new(NULL, TRUE);
    g_unix_signal_add(SIGINT, _sig_handler, main_loop);
    g_unix_signal_add(SIGTERM, _sig_handler, main_loop);

    GIOChannel* io_channel = g_io_channel_unix_new (STDIN_FILENO);
    g_io_add_watch(io_channel, G_IO_IN, _user_input_handler, &app);
    g_io_channel_unref(io_channel);


    g_main_loop_run (main_loop);

    g_main_loop_unref (main_loop);

    return 0;
}



================================================
FILE: desktop_source/mirac_broker_source.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <iostream>

#include "desktop_media_manager.h"
#include "mirac_broker_source.h"

#include "libwds/public/source.h"

MiracBrokerSource::MiracBrokerSource(int rtsp_port)
  : MiracBroker(std::to_string(rtsp_port)) {
}

MiracBrokerSource::~MiracBrokerSource() {}

void MiracBrokerSource::got_message(const std::string& message) {
  wfd_source_->RTSPDataReceived(message);
}

void MiracBrokerSource::on_connected() {
  media_manager_.reset(new DesktopMediaManager(get_peer_address()));
  wfd_source_.reset(wds::Source::Create(this, media_manager_.get()));
  wfd_source_->Start();
}

void MiracBrokerSource::on_connection_failure(ConnectionFailure failure) {
  switch (failure) {
      case CONNECTION_LOST:
          std::cout << "* RTSP connection lost" << std::endl;
          break;
      case CONNECTION_TIMEOUT:
          std::cout << "* RTSP connection failed: timeout" << std::endl;
          break;
      default:
          std::cout << "* RTSP connection failure" << std::endl;
  }
}

wds::Peer* MiracBrokerSource::Peer() const {
  return wfd_source_.get();
}


================================================
FILE: desktop_source/mirac_broker_source.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef MIRAC_BROKER_SOURCE_H_
#define MIRAC_BROKER_SOURCE_H_

#include <memory>

#include "mirac-broker.hpp"

namespace wds {
class SourceMediaManager;
class Source;
}

class MiracBrokerSource : public MiracBroker {
 public:
  explicit MiracBrokerSource(int rtsp_port);
  ~MiracBrokerSource();

  wds::Source* wfd_source() { return wfd_source_.get(); }

 private:
  virtual void got_message(const std::string& message) override;
  virtual void on_connected() override;
  void on_connection_failure(ConnectionFailure failure) override;
  virtual wds::Peer* Peer() const override;

  std::unique_ptr<wds::SourceMediaManager> media_manager_;
  std::unique_ptr<wds::Source> wfd_source_;
};

#endif // MIRAC_BROKER_SOURCE_H_


================================================
FILE: desktop_source/source-app.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <iostream>
#include <netinet/in.h> // htons()

#include "source-app.h"

void SourceApp::on_availability_changed(P2P::Client *client)
{
    if (client->is_available())
        scan();
}

void SourceApp::on_peer_added(P2P::Client *client, std::shared_ptr<P2P::Peer> peer)
{
    if (peer->device_type() == P2P::PRIMARY_SINK) {
        peer->set_observer(this);
    }
}

void SourceApp::on_peer_removed(P2P::Client *client, std::shared_ptr<P2P::Peer> peer)
{
    for (auto it = peers_.begin(); it != peers_.end();) {
        if (it->second == peer.get()) {
            peers_.erase (it++);
            return;
        } else {
            ++it;
        }
    }
}

void SourceApp::on_initialized(P2P::Peer *peer)
{
    peers_[peer_index_] = peer;
    std::cout << "  "<< peer_index_ << " : " << peer->name() << std::endl;
    peer_index_++;
}

void SourceApp::scan()
{
    std::cout << "* Now scanning for peers..." << std::endl;
    p2p_client_->scan();
}

bool SourceApp::connect(uint peer_index)
{
    auto it = peers_.find (peer_index);
    if (it == peers_.end()) {
        std::cout << "No such peer" << std::endl;
        return false;
    }

    it->second->connect ();
    return true;
}

void SourceApp::on_availability_changed(P2P::Peer *peer)
{
    if (!peer->is_available())
        return;

    std::cout << "* Connected to " << peer->remote_host()  << std::endl;
}

SourceApp::SourceApp(int port) :
    peer_index_(0)
{
    // Create a information element for a simple WFD Source
    P2P::InformationElement ie;
    auto sub_element = P2P::new_subelement(P2P::DEVICE_INFORMATION);
    auto dev_info = (P2P::DeviceInformationSubelement*)sub_element;

    // TODO InformationElement could have constructors for this stuff...
    dev_info->session_management_control_port = htons(port);
    dev_info->maximum_throughput = htons(50);
    dev_info->field1.device_type = P2P::SOURCE;
    dev_info->field1.session_availability = true;
    ie.add_subelement(sub_element);

    std::cout << "* Registering Wi-Fi Display Source with IE " << ie.to_string() <<  std::endl;

    // register the P2P service with connman
    auto array = ie.serialize ();
    p2p_client_.reset(new P2P::Client(array, this));

    source_.reset(new MiracBrokerSource(port));
}

SourceApp::~SourceApp()
{
}


================================================
FILE: desktop_source/source-app.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef SOURCE_APP_H
#define SOURCE_APP_H

#include <memory>

#include "source.h"
#include "connman-client.h"
#include "mirac_broker_source.h"

class SourceApp: public P2P::Client::Observer, public P2P::Peer::Observer {
  public:
    SourceApp(int port);
    ~SourceApp();

    MiracBrokerSource* source() { return source_.get(); }

    void on_peer_added(P2P::Client *client, std::shared_ptr<P2P::Peer> peer) override;
    void on_peer_removed(P2P::Client *client, std::shared_ptr<P2P::Peer> peer) override;
    void on_availability_changed(P2P::Client *client) override;

    void on_availability_changed(P2P::Peer *peer) override;
    void on_initialized(P2P::Peer *peer) override;

    void scan();
    bool connect(uint peer_index);

  private:
    std::unique_ptr<P2P::Client> p2p_client_;
    std::unique_ptr<MiracBrokerSource> source_;
    std::map<uint, P2P::Peer*>peers_;
    uint peer_index_;
};

#endif // SOURCE_APP_H


================================================
FILE: libwds/CMakeLists.txt
================================================
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -std=c99 -Wall")


add_library(wds
    SHARED $<TARGET_OBJECTS:wdsrtsp>
           $<TARGET_OBJECTS:wdscommon>
           $<TARGET_OBJECTS:wdssink>
           $<TARGET_OBJECTS:wdssource>)
set_target_properties(wds PROPERTIES
    VERSION ${WDS_VERSION_MAJOR}.${WDS_VERSION_MINOR}.${WDS_VERSION_PATCH}
    SOVERSION ${WDS_VERSION_MAJOR})

install(TARGETS wds LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

set(PUBLIC_HEADERS
    public/connector_type.h
    public/peer.h
    public/video_format.h
    public/sink.h
    public/wds_export.h
    public/audio_codec.h
    public/media_manager.h
    public/source.h
    public/logging.h)

install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/wds)


================================================
FILE: libwds/common/CMakeLists.txt
================================================
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -std=c99 -Wall")

include_directories ("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libwds/rtsp/gen")

add_library(wdscommon OBJECT
    logging.cpp message_handler.cpp rtsp_input_handler.cpp video_format.cpp)
add_dependencies(wdscommon wdsrtsp)


================================================
FILE: libwds/common/logging.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2016 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include "libwds/public/logging.h"

namespace wds {

static void Dummy(const char*, ...) {}
LogSystem::LogFunction LogSystem::log_func_ = &Dummy;
LogSystem::LogFunction LogSystem::vlog_func_ = &Dummy;
LogSystem::LogFunction LogSystem::warning_func_ = &Dummy;
LogSystem::LogFunction LogSystem::error_func_ = &Dummy;

void LogSystem::set_log_func(LogFunction func) {
  log_func_ = func;
}

LogSystem::LogFunction LogSystem::log_func() {
  return log_func_;
}

void LogSystem::set_vlog_func(LogFunction func) {
  vlog_func_ = func;
}

LogSystem::LogFunction LogSystem::vlog_func() {
  return vlog_func_;
}

void LogSystem::set_warning_func(LogFunction func) {
  warning_func_ = func;
}

LogSystem::LogFunction LogSystem::warning_func() {
  return warning_func_;
}

void LogSystem::set_error_func(LogFunction func) {
  error_func_ = func;
}

LogSystem::LogFunction LogSystem::error_func() {
  return error_func_;
}

}  // namespace wds


================================================
FILE: libwds/common/message_handler.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <algorithm>

#include "libwds/common/message_handler.h"
#include "libwds/public/media_manager.h"

namespace wds {

using rtsp::Message;
using rtsp::Request;
using rtsp::Reply;

bool MessageHandler::HandleTimeoutEvent(unsigned timer_id) const {
  return false;
}

MessageHandler::~MessageHandler() {}

MessageSequenceHandler::MessageSequenceHandler(const InitParams& init_params)
  : MessageHandler(init_params),
    current_handler_(nullptr) {
}

MessageSequenceHandler::~MessageSequenceHandler() {
}

void MessageSequenceHandler::Start() {
  if (current_handler_) {
    return;
  }
  current_handler_ = handlers_.front();
  current_handler_->Start();
}

void MessageSequenceHandler::Reset() {
  if (current_handler_) {
    current_handler_->Reset();
    current_handler_ = nullptr;
  }
}

bool MessageSequenceHandler::CanSend(Message* message) const {
  return current_handler_ && current_handler_->CanSend(message);
}

void MessageSequenceHandler::Send(std::unique_ptr<Message> message) {
  assert(current_handler_);
  current_handler_->Send(std::move(message));
}

bool MessageSequenceHandler::CanHandle(Message* message) const {
  return current_handler_ && current_handler_->CanHandle(message);
}

void MessageSequenceHandler::Handle(std::unique_ptr<Message> message) {
  assert(current_handler_);
  current_handler_->Handle(std::move(message));
}

void MessageSequenceHandler::AddSequencedHandler(MessageHandlerPtr handler) {
  assert(!current_handler_); // We are not started
  assert(handler);
  assert(handlers_.end() == std::find(
      handlers_.begin(), handlers_.end(), handler));
  handlers_.push_back(handler);
  handler->set_observer(this);
}

void MessageSequenceHandler::OnCompleted(MessageHandlerPtr handler) {
  assert(handler == current_handler_);
  current_handler_->Reset();

  auto it = std::find(handlers_.begin(), handlers_.end(), handler);
  assert(handlers_.end() != it);
  if (++it == handlers_.end()) {
    observer_->OnCompleted(shared_from_this());
    return;
  }

  current_handler_ = *it;
  current_handler_->Start();
}

void MessageSequenceHandler::OnError(MessageHandlerPtr handler) {
  assert(handler == current_handler_);
  handler->Reset();
  observer_->OnError(shared_from_this());
}

bool MessageSequenceHandler::HandleTimeoutEvent(unsigned timer_id) const {
  return current_handler_->HandleTimeoutEvent(timer_id);
}

MessageSequenceWithOptionalSetHandler::MessageSequenceWithOptionalSetHandler(
    const InitParams& init_params)
  : MessageSequenceHandler(init_params) {
}

MessageSequenceWithOptionalSetHandler::~MessageSequenceWithOptionalSetHandler() {
}

void MessageSequenceWithOptionalSetHandler::Start() {
  MessageSequenceHandler::Start();
  for (MessageHandlerPtr handler : optional_handlers_)
    handler->Start();
}

void MessageSequenceWithOptionalSetHandler::Reset() {
  MessageSequenceHandler::Reset();
  for (MessageHandlerPtr handler : optional_handlers_)
    handler->Reset();
}

bool MessageSequenceWithOptionalSetHandler::CanSend(Message* message) const {
  for (MessageHandlerPtr handler : optional_handlers_)
    if (handler->CanSend(message))
      return true;

  if (MessageSequenceHandler::CanSend(message))
    return true;

  return false;
}

void MessageSequenceWithOptionalSetHandler::Send(std::unique_ptr<Message> message) {
  for (MessageHandlerPtr handler : optional_handlers_) {
    if (handler->CanSend(message.get())) {
      handler->Send(std::move(message));
      return;
    }
  }

  if (MessageSequenceHandler::CanSend(message.get())) {
    MessageSequenceHandler::Send(std::move(message));
    return;
  }

  observer_->OnError(shared_from_this());
}

bool MessageSequenceWithOptionalSetHandler::CanHandle(Message* message) const {
  if (MessageSequenceHandler::CanHandle(message))
    return true;

  for (MessageHandlerPtr handler : optional_handlers_)
    if (handler->CanHandle(message))
      return true;

  return false;
}

void MessageSequenceWithOptionalSetHandler::Handle(std::unique_ptr<Message> message) {
  if (MessageSequenceHandler::CanHandle(message.get())) {
     MessageSequenceHandler::Handle(std::move(message));
     return;
  }

  for (MessageHandlerPtr handler : optional_handlers_) {
    if (handler->CanHandle(message.get())) {
      handler->Handle(std::move(message));
      return;
    }
  }

  observer_->OnError(shared_from_this());
}

void MessageSequenceWithOptionalSetHandler::AddOptionalHandler(
    MessageHandlerPtr handler) {
  assert(handler);
  assert(optional_handlers_.end() == std::find(
      optional_handlers_.begin(), optional_handlers_.end(), handler));
  optional_handlers_.push_back(handler);
  handler->set_observer(this);
}

void MessageSequenceWithOptionalSetHandler::OnCompleted(MessageHandlerPtr handler) {
  auto it = std::find(
      optional_handlers_.begin(), optional_handlers_.end(), handler);
  if (it != optional_handlers_.end()) {
    handler->Reset();
    handler->Start();
    return;
  }
  MessageSequenceHandler::OnCompleted(handler);
}

void MessageSequenceWithOptionalSetHandler::OnError(MessageHandlerPtr handler) {
  handler->Reset();
  observer_->OnError(shared_from_this());
}

bool MessageSequenceWithOptionalSetHandler::HandleTimeoutEvent(unsigned timer_id) const {
  for (MessageHandlerPtr handler : optional_handlers_)
    if (handler->HandleTimeoutEvent(timer_id))
      return true;
  return MessageSequenceHandler::HandleTimeoutEvent(timer_id);
}

// MessageReceiverBase
MessageReceiverBase::MessageReceiverBase(const InitParams& init_params)
  : MessageHandler(init_params),
    wait_for_message_(false) {}

MessageReceiverBase::~MessageReceiverBase() {}

bool MessageReceiverBase::CanHandle(Message* message) const {
  assert(message);
  return wait_for_message_;
}

void MessageReceiverBase::Start() { wait_for_message_ = true; }
void MessageReceiverBase::Reset() { wait_for_message_ = false; }
bool MessageReceiverBase::CanSend(Message* message) const { return false; }
void MessageReceiverBase::Send(std::unique_ptr<Message> message) {}
void MessageReceiverBase::Handle(std::unique_ptr<Message> message) {
  assert(message);
  if (!CanHandle(message.get())) {
    observer_->OnError(shared_from_this());
    return;
  }
  wait_for_message_ = false;
  std::unique_ptr<Reply> reply = HandleMessage(message.get());
  if (!reply) {
    observer_->OnError(shared_from_this());
    return;
  }
  reply->header().set_cseq(message->cseq());
  sender_->SendRTSPData(reply->ToString());
  observer_->OnCompleted(shared_from_this());
}

MessageSenderBase::MessageSenderBase(const InitParams& init_params)
  : MessageHandler(init_params) {
}

MessageSenderBase::~MessageSenderBase() {
  for (const ParcelData& data : parcel_queue_)
    sender_->ReleaseTimer(data.timer_id);
}

void MessageSenderBase::Reset() {
  while (!parcel_queue_.empty()) {
    sender_->ReleaseTimer(parcel_queue_.front().timer_id);
    parcel_queue_.pop_front();
  }
}

void MessageSenderBase::Send(std::unique_ptr<Message> message) {
  assert(message);
  if (!CanSend(message.get())) {
    observer_->OnError(shared_from_this());
    return;
  }
  parcel_queue_.push_back(
      {message->cseq(), sender_->CreateTimer(GetResponseTimeout())});
  sender_->SendRTSPData(message->ToString());
}

bool MessageSenderBase::CanHandle(Message* message) const {
  assert(message);
  return message->is_reply() && !parcel_queue_.empty() &&
         (message->cseq() == parcel_queue_.front().cseq);
}

void MessageSenderBase::Handle(std::unique_ptr<Message> message) {
  assert(message);
  if (!CanHandle(message.get())) {
    observer_->OnError(shared_from_this());
    return;
  }
  sender_->ReleaseTimer(parcel_queue_.front().timer_id);
  parcel_queue_.pop_front();

  if (!HandleReply(static_cast<Reply*>(message.get()))) {
    observer_->OnError(shared_from_this());
    return;
  }

  if (parcel_queue_.empty()) {
    observer_->OnCompleted(shared_from_this());
  }
}

bool MessageSenderBase::HandleTimeoutEvent(unsigned timer_id) const {
  for (const ParcelData& data : parcel_queue_)
    if (data.timer_id == timer_id)
      return true;

  return false;
}

int MessageSenderBase::GetResponseTimeout() const {
  return kDefaultTimeoutValue;
}

SequencedMessageSender::SequencedMessageSender(const InitParams& init_params)
  : MessageSenderBase(init_params),
    to_be_send_(nullptr) {
}

SequencedMessageSender::~SequencedMessageSender() {
}

void SequencedMessageSender::Start() {
  auto message = CreateMessage();
  to_be_send_ = message.get();
  Send(std::move(message));
}

void SequencedMessageSender::Reset() {
  to_be_send_ = nullptr;
  MessageSenderBase::Reset();
}

bool SequencedMessageSender::CanSend(Message* message) const {
  return message && (message == to_be_send_);
}

}


================================================
FILE: libwds/common/message_handler.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_COMMON_MESSAGE_HANDLER_H_
#define LIBWDS_COMMON_MESSAGE_HANDLER_H_

#include <cassert>
#include <list>
#include <vector>
#include <memory>
#include <utility>

#include "libwds/rtsp/message.h"
#include "libwds/rtsp/reply.h"
#include "libwds/public/logging.h"
#include "libwds/public/peer.h"

namespace wds {

// Default keep-alive timer is 60 seconds
const int kDefaultKeepAliveTimeout = 60;
// Default timeout for RTSP message exchange
const int kDefaultTimeoutValue = 5;

class MediaManager;

class MessageHandler;
using MessageHandlerPtr = std::shared_ptr<MessageHandler>;

inline MessageHandlerPtr make_ptr(MessageHandler* handler) {
  return MessageHandlerPtr(handler);
}

class MessageHandler : public std::enable_shared_from_this<MessageHandler> {
 public:
  class Observer {
   public:
    virtual void OnCompleted(MessageHandlerPtr handler) {}
    virtual void OnError(MessageHandlerPtr handler) {}

   protected:
    virtual ~Observer() {}
  };

  struct InitParams {
    Peer::Delegate* sender;
    MediaManager* manager;
    Observer* observer;
  };

  virtual ~MessageHandler();

  virtual void Start() = 0;
  virtual void Reset() = 0;

  virtual bool CanSend(rtsp::Message* message) const = 0;
  virtual void Send(std::unique_ptr<rtsp::Message> message) = 0;

  virtual bool CanHandle(rtsp::Message* message) const = 0;
  virtual void Handle(std::unique_ptr<rtsp::Message> message) = 0;

  // For handlers that require timeout
  virtual bool HandleTimeoutEvent(unsigned timer_id) const;

  void set_observer(Observer* observer) {
    assert(observer);
    observer_ = observer;
  }

protected:
  explicit MessageHandler(const InitParams& init_params)
    : sender_(init_params.sender),
      manager_(init_params.manager),
      observer_(init_params.observer) {
    assert(sender_);
    assert(manager_);
    assert(observer_);
  }

  Peer::Delegate* sender_;
  MediaManager* manager_;
  Observer* observer_;
};

class MessageSequenceHandler : public MessageHandler,
                               public MessageHandler::Observer {
 public:
  explicit MessageSequenceHandler(const InitParams& init_params);
  ~MessageSequenceHandler() override;
  void Start() override;
  void Reset() override;

  bool CanSend(rtsp::Message* message) const override;
  void Send(std::unique_ptr<rtsp::Message> message) override;

  bool CanHandle(rtsp::Message* message) const override;
  void Handle(std::unique_ptr<rtsp::Message> message) override;

  bool HandleTimeoutEvent(unsigned timer_id) const override;

 protected:
  void AddSequencedHandler(MessageHandlerPtr handler);
  // MessageHandler::Observer implementation.
  void OnCompleted(MessageHandlerPtr handler) override;
  void OnError(MessageHandlerPtr handler) override;

  std::vector<MessageHandlerPtr> handlers_;
  MessageHandlerPtr current_handler_;
};

class MessageSequenceWithOptionalSetHandler : public MessageSequenceHandler {
 public:
  explicit MessageSequenceWithOptionalSetHandler(const InitParams& init_params);
  ~MessageSequenceWithOptionalSetHandler() override;
  void Start() override;
  void Reset() override;
  bool CanSend(rtsp::Message* message) const override;
  void Send(std::unique_ptr<rtsp::Message> message) override;
  bool CanHandle(rtsp::Message* message) const override;
  void Handle(std::unique_ptr<rtsp::Message> message) override;

  bool HandleTimeoutEvent(unsigned timer_id) const override;

 protected:
  void AddOptionalHandler(MessageHandlerPtr handler);
  // MessageHandler::Observer implementation.
  void OnCompleted(MessageHandlerPtr handler) override;
  void OnError(MessageHandlerPtr handler) override;

  std::vector<MessageHandlerPtr> optional_handlers_;
};

// This is aux classes to handle single message.
// There are two common scenarious:
// 1. We send a message and wait for reply
// class Handler : public MessageSender
//
// 2. We wait for the message and reply ourselves.
// class Handler : public MessageReceiver<type of the message
// we're waiting for>
class MessageReceiverBase : public MessageHandler {
 public:
  explicit MessageReceiverBase(const InitParams& init_params);
  ~MessageReceiverBase() override;

 protected:
  virtual std::unique_ptr<wds::rtsp::Reply> HandleMessage(rtsp::Message* message) = 0;
  bool CanHandle(rtsp::Message* message) const override;
  void Handle(std::unique_ptr<rtsp::Message> message) override;

 private:
  void Start() override;
  void Reset() override;
  bool CanSend(rtsp::Message* message) const override;
  void Send(std::unique_ptr<rtsp::Message> message) override;

  bool wait_for_message_;
};

template <rtsp::Request::ID id>
class MessageReceiver : public MessageReceiverBase {
 public:
  using MessageReceiverBase::MessageReceiverBase;

 protected:
  bool CanHandle(rtsp::Message* message) const override {
    return MessageReceiverBase::CanHandle(message) && message->is_request() &&
           id == ToRequest(message)->id();
  }
};

class MessageSenderBase : public MessageHandler {
 public:
  explicit MessageSenderBase(const InitParams& init_params);
  ~MessageSenderBase() override;

 protected:
  virtual bool HandleReply(rtsp::Reply* reply) = 0;
  void Send(std::unique_ptr<rtsp::Message> message) override;
  void Reset() override;
  bool HandleTimeoutEvent(unsigned timer_id) const override;


 private:
  bool CanHandle(rtsp::Message* message) const override;
  void Handle(std::unique_ptr<rtsp::Message> message) override;

  virtual int GetResponseTimeout() const;

  struct ParcelData {
    int cseq;
    unsigned timer_id;
  };
  std::list<ParcelData> parcel_queue_;
};

// To be used for optional senders.
template <rtsp::Request::ID id>
class OptionalMessageSender : public MessageSenderBase {
 public:
  using MessageSenderBase::MessageSenderBase;

 protected:
  bool CanSend(rtsp::Message* message) const override {
    assert(message);
    return message->is_request() && ToRequest(message)->id() == id;
  }

 private:
  void Start() override {}
};

// To be used for sequensed senders.
class SequencedMessageSender : public MessageSenderBase {
 public:
  explicit SequencedMessageSender(const InitParams& init_params);
  ~SequencedMessageSender() override;

 protected:
  virtual std::unique_ptr<rtsp::Message> CreateMessage() = 0;

 private:
  void Start() override;
  void Reset() override;
  bool CanSend(rtsp::Message* message) const override;

  rtsp::Message* to_be_send_;
};

}  // namespace wds
#endif // LIBWDS_COMMON_MESSAGE_HANDLER_H_


================================================
FILE: libwds/common/rtsp_input_handler.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include "rtsp_input_handler.h"

#include "libwds/rtsp/driver.h"
#include "libwds/rtsp/message.h"

#include <cassert>

namespace wds {

using rtsp::Message;
using rtsp::Driver;

RTSPInputHandler::~RTSPInputHandler() {
}

void RTSPInputHandler::AddInput(const std::string& input) {
  rtsp_input_buffer_ += input;

  // First trying to get payload for the message obtained
  // from the previous input.
  if (message_ && !ParsePayload())
    return;

  while (ParseHeader()) {
    if (!ParsePayload())
      break;
  }
}

bool RTSPInputHandler::ParseHeader() {
  assert(!message_);
  static const char delimiter[] = "\r\n\r\n";
  static const int delimiter_length = 4;
  size_t eom = rtsp_input_buffer_.find(delimiter);
  if (eom == std::string::npos) {
    return false;
  }

  const std::string& header = rtsp_input_buffer_.substr(0, eom + delimiter_length);
  rtsp_input_buffer_.erase(0, eom + delimiter_length);
  return Parse(header);
}

bool RTSPInputHandler::ParsePayload() {
  assert(message_);
  unsigned content_length = message_->header().content_length();
  if (content_length == 0) {
    MessageParsed(std::move(message_));
    return true;
  }

  if (rtsp_input_buffer_.size() < content_length)
    return false;

  const std::string& payload = rtsp_input_buffer_.substr(0, content_length);
  rtsp_input_buffer_.erase(0, content_length);
  if (!Parse(payload))
    return false;

  MessageParsed(std::move(message_));
  return true;
}

bool RTSPInputHandler::Parse(const std::string& input) {
  Driver::Parse(input, message_);
  if (!message_) {
    ParserErrorOccurred(rtsp_input_buffer_);
    rtsp_input_buffer_.clear();
    return false;
  }

  return true;
}

}  // namespace wds


================================================
FILE: libwds/common/rtsp_input_handler.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_COMMON_RTSP_INPUT_HANDLER_H_
#define LIBWDS_COMMON_RTSP_INPUT_HANDLER_H_

#include <memory>
#include <string>

namespace wds {

namespace rtsp {
class Message;
}  // namespace rtsp

// An aux class used to obtain Message object from the given raw input.
class RTSPInputHandler {
 protected:
  RTSPInputHandler() = default;
  virtual ~RTSPInputHandler();

  void AddInput(const std::string& input);

  // To be overridden.
  virtual void MessageParsed(std::unique_ptr<rtsp::Message> message) = 0;
  virtual void ParserErrorOccurred(const std::string& invalid_input) {}

 private:
  bool ParseHeader();
  bool ParsePayload();
  bool Parse(const std::string& input);

  std::string rtsp_input_buffer_;
  std::unique_ptr<rtsp::Message> message_;
};

}

#endif // LIBWDS_COMMON_RTSP_INPUT_HANDLER_H_


================================================
FILE: libwds/common/video_format.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include "libwds/public/media_manager.h"

#include <assert.h>

#include <algorithm>

#include "libwds/public/logging.h"

namespace wds {

namespace {
// Quality weight is calculated using following formula:
// width * height * fps * 2 for progressive or 1 for interlaced frames
struct QualityInfo {
  unsigned width;
  unsigned height;
  unsigned weight;
};

const QualityInfo cea_info_table[] = {
  {640, 480, 640*480*60*2},     // CEA640x480p60
  {720, 480, 720*480*60*2},     // CEA720x480p60
  {720, 480, 720*480*60},       // CEA720x480i60
  {720, 576, 720*576*50*2},     // CEA720x576p50
  {720, 576, 720*576*50},       // CEA720x576i50
  {1280, 720, 1280*720*30*2},   // CEA1280x720p30
  {1280, 720, 1280*720*60*2},   // CEA1280x720p60
  {1920, 1080, 1920*1080*30*2}, // CEA1920x1080p30
  {1920, 1080, 1920*1080*60*2}, // CEA1920x1080p60
  {1920, 1080, 1920*1080*60},   // CEA1920x1080i60
  {1280, 720, 1280*720*25*2},   // CEA1280x720p25
  {1280, 720, 1280*720*50*2},   // CEA1280x720p50
  {1920, 1080, 1920*1080*25*2}, // CEA1920x1080p25
  {1920, 1080, 1920*1080*50*2}, // CEA1920x1080p50
  {1920, 1080, 1920*1080*50},   // CEA1920x1080i50
  {1280, 720, 1280*720*24*2},   // CEA1280x720p24
  {1920, 1080, 1920*1080*24*2}  // CEA1920x1080p24
};

#define CEA_TABLE_LENGTH  sizeof(cea_info_table) / sizeof(QualityInfo)

const QualityInfo vesa_info_table[] = {
  {800, 600, 800*600*30*2},        // VESA800x600p30
  {800, 600, 800*600*60*2},        // VESA800x600p60
  {1024, 768, 1024*768*30*2},      // VESA1024x768p30
  {1024, 768, 1024*768*60*2},      // VESA1024x768p60
  {1152, 864, 1152*864*30*2},      // VESA1152x864p30
  {1152, 864, 1152*864*60*2},      // VESA1152x864p60
  {1280, 768, 1280*768*30*2},      // VESA1280x768p30
  {1280, 768, 1280*768*60*2},      // VESA1280x768p60
  {1280, 800, 1280*800*30*2},      // VESA1280x800p30
  {1280, 800, 1280*800*60*2},      // VESA1280x800p60
  {1360, 768, 1360*768*30*2},      // VESA1360x768p30
  {1360, 768, 1360*768*60*2},      // VESA1360x768p60
  {1366, 768, 1366*768*30*2},      // VESA1366x768p30
  {1366, 768, 1366*768*60*2},      // VESA1366x768p60
  {1280, 1024, 1280*1024*30*2},    // VESA1280x1024p30
  {1280, 1024, 1280*1024*60*2},    // VESA1280x1024p60
  {1400, 1050, 1400*1050*30*2},    // VESA1400x1050p30
  {1400, 1050, 1400*1050*60*2},    // VESA1400x1050p60
  {1440, 900, 1440*900*30*2},      // VESA1440x900p30
  {1440, 900, 1440*900*60*2},      // VESA1440x900p60
  {1600, 900, 1600*900*30*2},      // VESA1600x900p30
  {1600, 900, 1600*900*60*2},      // VESA1600x900p60
  {1600, 1200, 1600*1200*30*2},    // VESA1600x1200p30
  {1600, 1200, 1600*1200*60*2},    // VESA1600x1200p60
  {1680, 1024, 1680*1024*30*2},    // VESA1680x1024p30
  {1680, 1024, 1680*1024*60*2},    // VESA1680x1024p60
  {1680, 1050, 1680*1050*30*2},    // VESA1680x1050p30
  {1680, 1050, 1680*1050*60*2},    // VESA1680x1050p60
  {1920, 1200, 1920*1200*30*2}     // VESA1920x1200p30
};

#define VESA_TABLE_LENGTH  sizeof(vesa_info_table) / sizeof(QualityInfo)

const QualityInfo hh_info_table[] = {
  {800, 480, 800*480*30*2},         // HH800x480p30
  {800, 480, 800*480*60*2},         // HH800x480p60
  {854, 480, 854*480*30*2},         // HH854x480p30
  {854, 480, 854*480*60*2},         // HH854x480p60
  {864, 480, 864*480*30*2},         // HH864x480p30
  {864, 480, 864*480*60*2},         // HH864x480p60
  {640, 360, 640*360*30*2},         // HH640x360p30
  {640, 360, 640*360*60*2},         // HH640x360p60
  {960, 540, 960*540*30*2},         // HH960x540p30
  {960, 540, 960*540*60*2},         // HH960x540p60
  {848, 480, 848*480*30*2},         // HH848x480p30
  {848, 480, 848*480*60*2}          // HH848x480p60
};

#define HH_TABLE_LENGTH  sizeof(hh_info_table) / sizeof(QualityInfo)

QualityInfo get_cea_info(const H264VideoFormat& format) {
  assert(format.rate_resolution < CEA_TABLE_LENGTH);
  return cea_info_table[format.rate_resolution];
}

QualityInfo get_vesa_info(const H264VideoFormat& format) {
  assert(format.rate_resolution < VESA_TABLE_LENGTH);
  return vesa_info_table[format.rate_resolution];
}

QualityInfo get_hh_info(const H264VideoFormat& format) {
  assert(format.rate_resolution < HH_TABLE_LENGTH);
  return hh_info_table[format.rate_resolution];
}

QualityInfo get_quality_info(const H264VideoFormat& format) {
  QualityInfo info;
  switch (format.type) {
  case CEA:
    info = get_cea_info(format);
    break;
  case VESA:
    info = get_vesa_info(format);
    break;
  case HH:
    info = get_hh_info(format);
    break;
  default:
    assert(false);
    break;
  }
  return info;
}

std::pair<unsigned, unsigned> get_resolution(const H264VideoFormat& format) {
  QualityInfo info = get_quality_info(format);
  return std::pair<unsigned, unsigned>(info.width, info.height);
}

bool video_format_sort_func(const H264VideoFormat& a, const H264VideoFormat& b) {
  if (get_quality_info(a).weight != get_quality_info(b).weight)
    return get_quality_info(a).weight < get_quality_info(b).weight;
  if (a.profile != b.profile)
    return a.profile < b.profile;
  return a.level < b.level;
}

template <typename RREnum>
void PopulateVideoFormatList(
    H264Profile profile,
    H264Level level,
    const RateAndResolutionsBitmap& bitmap,
    RREnum max_value,
    std::vector<H264VideoFormat>& formats) {
  if (bitmap.none())
    return;

  for (RateAndResolution rr = 0; rr <= static_cast<RateAndResolution>(max_value); ++rr) {
    if (bitmap.test(rr))
      formats.push_back(H264VideoFormat(profile, level, static_cast<RREnum>(rr)));
  }
}

}  // namespace

void PopulateVideoFormatList(
    const H264VideoCodec& codec, std::vector<H264VideoFormat>& formats) {
  PopulateVideoFormatList<CEARatesAndResolutions>(
      codec.profile, codec.level, codec.cea_rr, CEA1920x1080p24, formats);
  PopulateVideoFormatList<VESARatesAndResolutions>(
      codec.profile, codec.level, codec.vesa_rr, VESA1920x1200p30, formats);
  PopulateVideoFormatList<HHRatesAndResolutions>(
      codec.profile, codec.level, codec.hh_rr, HH848x480p60, formats);
}

H264VideoFormat FindOptimalVideoFormat(
    const NativeVideoFormat& native,
    const std::vector<H264VideoCodec>& local_codecs,
    const std::vector<H264VideoCodec>& remote_codecs,
    bool* success) {
  std::vector<H264VideoFormat> local_formats, remote_formats;
  for (const auto& codec : local_codecs)
    PopulateVideoFormatList(codec, local_formats);
  for (const auto& codec : remote_codecs)
    PopulateVideoFormatList(codec, remote_formats);

  std::sort(local_formats.begin(), local_formats.end(),
      video_format_sort_func);
  std::sort(remote_formats.begin(), remote_formats.end(),
      video_format_sort_func);

  auto it = local_formats.begin();
  auto end = local_formats.end();

  H264VideoFormat format;

  while(it != end) {
    auto match = std::find_if(
        remote_formats.begin(),
        remote_formats.end(),
        [&it] (const H264VideoFormat& format) {
            return ((*it).type == format.type) &&
                   (get_resolution(*it) == get_resolution(format));
        });

    if (match != remote_formats.end()) {
      format = *match;
      break;
    }
    ++it;
  }

  // Should not happen, 640x480p60 should be always supported!
  if (it == end) {
    WDS_ERROR("Failed to find compatible video format.");
    if (success)
      *success = false;
    return format;
  }

  // if remote device supports higher codec profile / level
  // downgrade them to what we support locally.
  if (format.profile > (*it).profile)
    format.profile = (*it).profile;
  if (format.level > (*it).level)
    format.level = (*it).level;
  if (success)
    *success = true;
  return format;
}

}  // namespace wds


================================================
FILE: libwds/public/audio_codec.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_AUDIO_CODEC_H_
#define LIBWDS_PUBLIC_AUDIO_CODEC_H_

#include <bitset>

namespace wds {

enum AudioFormats {
  LPCM,
  AAC,
  AC3
};

enum LPCMModes {
  LPCM_44_1K_16B_2CH,
  LPCM_48K_16B_2CH
};

enum AACModes {
  AAC_48K_16B_2CH,
  AAC_48K_16B_4CH,
  AAC_48K_16B_6CH,
  AAC_48K_16B_8CH
};

enum AC3Modes {
  AC3_48K_16B_2CH,
  AC3_48K_16B_4CH,
  AC3_48K_16B_6CH
};

using AudioModes = std::bitset<32>;

/**
 * @brief The AudioCodec struct
 *
 * Repersents a <audio-format, modes, latency> tuple used in 'wfd-audio-codecs'.
 */
struct AudioCodec {
  AudioCodec()
  : format(LPCM), modes(AudioModes().set(LPCM_48K_16B_2CH)), latency(0) {}
  AudioCodec(AudioFormats format, const AudioModes& modes, unsigned latency)
  : format(format), modes(modes), latency(latency) {}

  AudioFormats format;
  AudioModes modes;
  unsigned latency;
};

}  // namespace wds

#endif  // LIBWDS_PUBLIC_AUDIO_CODEC_H_


================================================
FILE: libwds/public/connector_type.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_CONNECTOR_TYPE_H_
#define LIBWDS_PUBLIC_CONNECTOR_TYPE_H_

namespace wds {

enum ConnectorType {
  ConnectorTypeVGA = 0,
  // TODO : Add the rest of connector types.
  ConnectorTypeUndefined = 255,
  ConnectorTypeNone
};

}  // namespace wds

#endif  // LIBWDS_PUBLIC_CONNECTOR_TYPE_H_


================================================
FILE: libwds/public/logging.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_LOGGING_H_
#define LIBWDS_PUBLIC_LOGGING_H_

#include <cstdarg>

#include "wds_export.h"

namespace wds {

/**
 * WFD logging subsystem.
 */
class WDS_EXPORT LogSystem {
 public:
  typedef void (*LogFunction)(const char*, ...);

  /**
   * Sets a function to log a normal message.
   * @param function to log a normal message
   */
  static void set_log_func(LogFunction func);
  /**
   * Gets a function to log a normal message @see set_log_func
   * @return function to log a normal message
   */
  static LogFunction log_func();

  /**
   * Sets a function to log a verbose message.
   * @param function to log a verbose message
   */
  static void set_vlog_func(LogFunction func);
  /**
   * Gets a function to log a verbose message @see set_vlog_func
   * @return function to log a verbose message
   */
  static LogFunction vlog_func();

  /**
   * Sets a function to log a warning message.
   * @param function to log a warning message
   */
  static void set_warning_func(LogFunction func);
  /**
   * Gets a function to log a warning message @see set_warning_func
   * @return function to log a warning message
   */
  static LogFunction warning_func();

  /**
   * Sets a function to log an error message.
   * @param function to log an error message
   */
  static void set_error_func(LogFunction func);
  /**
   * Gets a function to log an error message @see set_error_func
   * @return function to log an error message
   */
  static LogFunction error_func();

 private:
  static LogFunction log_func_;
  static LogFunction vlog_func_;
  static LogFunction warning_func_;
  static LogFunction error_func_;

 private:
  LogSystem() = delete;
};

}

#define WDS_LOG(...) (*wds::LogSystem::log_func())(__VA_ARGS__);
#define WDS_VLOG(...) (*wds::LogSystem::vlog_func())(__VA_ARGS__);
#define WDS_WARNING(...) (*wds::LogSystem::warning_func())(__VA_ARGS__);
#define WDS_ERROR(...) (*wds::LogSystem::error_func())(__VA_ARGS__);

#endif // LIBWDS_PUBLIC_LOGGING_H_


================================================
FILE: libwds/public/media_manager.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_MEDIA_MANAGER_H_
#define LIBWDS_PUBLIC_MEDIA_MANAGER_H_

#include <string>
#include <vector>
#include "audio_codec.h"
#include "connector_type.h"
#include "video_format.h"
#include "wds_export.h"

namespace wds {

enum SessionType {
  AudioSession = 1,  // Audio only session
  VideoSession = 1 << 1,  // Video only session
  AudioVideoSession = AudioSession | VideoSession  // Audio/video session
};

/**
 * MediaManager interface.
 *
 * MediaManager instance is used by the state machine to control media stream
 * during WFD session.
 *
 * MediaManager contains the common methods for both WFD sink and WFD source.
 * The client applications are not supposed to implement it directly, they should
 * rather implement either @c SinkMediaManager or @c SourceMediaManager.
 * @see SinkMediaManager, SourceMediaManager
 */
class MediaManager {
 public:
  virtual ~MediaManager() {}

  /**
   * Triggers playback of the media stream.
   */
  virtual void Play() = 0;

  /**
   * Pauses playback of the media stream.
   */
  virtual void Pause() = 0;

  /**
   * Destroys media stream.
   */
  virtual void Teardown() = 0;

  /**
   * Queries whether media stream is paused.
   * @return true if media stream is paused, false otherwise.
   */
  virtual bool IsPaused() const = 0;

  /**
   * Returns unique WFD session id.
   *
   * The session Id is generated by WFD source.
   *
   * @return unique id for WFD session
   */
  virtual std::string GetSessionId() const = 0;
};

/**
 * SinkMediaManager interface.
 *
 * Extends the common @c MediaManager interface with WFD sink specific methods.
 * @see MediaManager
 */
class SinkMediaManager : public MediaManager {
 public:
   ~SinkMediaManager() override { }

  /**
   * Returns RTP listening ports that are used by WFD sink to receive media streams.
   *
   * In case of coupled sink configuration video and audio data could be sent
   * to different RTP ports.
   *
   * @return pair of RTP ports, port0 and port1
   */
  virtual std::pair<int,int> GetLocalRtpPorts() const = 0;

  /**
   * Sets presentation URL for media stream.
   * Presentation URL can be referred in order to control media stream resource
   * within WFD session.
   *
   * The implementation must store the given value and return it at GetPresentationUrl.
   *
   * @param presentation URL that represents video / audio stream
   */
  virtual void SetPresentationUrl(const std::string& url) = 0;

  /**
   * Returns presentation URL for managed media resource.
   * @see SetPresentationUrl
   * @return presentation URL
   */
  virtual std::string GetPresentationUrl() const = 0;

  /**
   * Sets unique ID for WFD session.
   *
   * The implementation must store the given value and return it at GetSessionId.
   *
   * @param string that uniquely identifies WFD session
   */
  virtual void SetSessionId(const std::string& session) = 0;

  /**
   * Returns list of supported H264 video formats
   * @return vector of supported H264 video formats
   */
  virtual std::vector<H264VideoCodec> GetSupportedH264VideoCodecs() const = 0;

  /**
   * Returns native video format of a device
   * @return native video format
   */
  virtual NativeVideoFormat GetNativeVideoFormat() const = 0;

  /**
   * Sets optimal H264 format that would be used to send / receive video stream
   *
   * @param optimal H264 format
   * @return true if format can be used by media manager, false otherwise
   */
  virtual bool SetOptimalVideoFormat(const H264VideoFormat& optimal_format) = 0;

  /**
   * Returns active connector type of a device
   * @return connector type. @see ConnectorType
   */
  virtual ConnectorType GetConnectorType() const = 0;
};

/**
 * SourceMediaManager interface.
 *
 * Extends the common @c MediaManager interface with WFD source specific methods.
 * @see MediaManager
 */
class SourceMediaManager : public MediaManager {
 public:
   ~SourceMediaManager() override { }

   /**
    * Returns media type for the current session.
    * @see MediaType
    * @return media time.
    */
   virtual SessionType GetSessionType() const = 0;

  /**
   * Sets RTP ports used by WFD sink to receive media streams.
   *
   * In case of coupled sink configuration video and audio data could be sent
   * to different RTP ports.
   *
   * WFD source must use these RTP ports for outgoing UDP connection.
   *
   * The implementation must store the given values and return them at GetSinkRtpPorts.
   *
   * @param port0 RTP port for video / audio stream
   * @param port1 RTP port that could be used to send audio stream
   */
  virtual void SetSinkRtpPorts(int port1, int port2) = 0;

  /**
   * Returns RTP ports that are used by WFD sink to receive media streams.
   * @see SetRtpPorts
   * @return pair of RTP ports, port0 and port1
   */
  virtual std::pair<int,int> GetSinkRtpPorts() const = 0;

  /**
   * Returns the local WFD source RTP port transmitting the media stream.
   * @return RTP port
   */
  virtual int GetLocalRtpPort() const = 0;

  /**
   * Initializes optimal video format
   * The optimal video format will be returned by GetOptimalVideoFormat
   *
   * @param sink_native_format format of the sink device
   * @param sink_supported_formats of H264 formats that are supported by the sink device
   * @return true if optimal video format is successfully initialized, false otherwise
   */
  virtual bool InitOptimalVideoFormat(
      const NativeVideoFormat& sink_native_format,
      const std::vector<H264VideoCodec>& sink_supported_codecs) = 0;

  /**
   * Gets optimal H264 format @see InitOptimalVideoFormat
   *
   * @return optimal H264 format
   */
  virtual H264VideoFormat GetOptimalVideoFormat() const = 0;

  /**
   * Initializes optimal audio codec
   * The optimal audio codec will be returned by GetOptimalAudioFormat
   *
   * @param sink_supported_codecs list of the codecs supported by sink
   * @return true if optimal audio codec is successfully initialized, false otherwise
   */
  virtual bool InitOptimalAudioFormat(const std::vector<AudioCodec>& sink_supported_codecs) = 0;

  /**
   * Gets optimal audio codec @see InitOptimalAudioFormat
   *
   * @return optimal audio codec
   */
  virtual AudioCodec GetOptimalAudioFormat() const = 0;

  /**
   * Sends of H.264 instantaneous decoding refresh (IDR) picture
   * to recover the content streaming.
   */
  virtual void SendIDRPicture() = 0;
};

inline SourceMediaManager* ToSourceMediaManager(MediaManager* mng) {
  return static_cast<SourceMediaManager*>(mng);
}

inline SinkMediaManager* ToSinkMediaManager(MediaManager* mng) {
  return static_cast<SinkMediaManager*>(mng);
}

}  // namespace wds

#endif // LIBWDS_PUBLIC_MEDIA_MANAGER_H_



================================================
FILE: libwds/public/peer.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_PEER_H_
#define LIBWDS_PUBLIC_PEER_H_

#include <string>

#include "wds_export.h"

namespace wds {

enum ErrorType {
  /// Arrived message cannot be handled by the state machine at the time.
  UnexpectedMessageError,
  /// RTSP message cannot be created form the given input.
  MessageParseError,
  /// The connected peer became unresponsive.
  TimeoutError
};


/**
 * Peer interface.
 *
 * Peer is a base class for sink and source state machines.
 */
class WDS_EXPORT Peer {
 public:
  /**
   * Delegate interface.
   *
   * Implementation of Delegate interface is used by the state machine
   * to obtain necessary context from the client.
   */
  class Delegate {
   public:
    /**
     * The implementation should send the RTSP data over the network
     * @param data data to be send
     */
    virtual void SendRTSPData(const std::string& data) = 0;
    /**
     * Returns the local IP address
     * @return IP address
     */
    virtual std::string GetLocalIPAddress() const = 0;
    /**
     * The implementation should start a timer to be used by the state machine.
     * @param seconds the time interval in seconds
     * @return unique timer id within the session
     */
    virtual unsigned CreateTimer(int seconds) = 0;
    /**
     * The implementation should release timer by the given id.
     * @param timer_id id of the timer to be released.
     */
    virtual void ReleaseTimer(unsigned timer_id) = 0;

    /**
     * Returns the sequence number for the following RTSP request-response pair
     * @param initial_peer_cseq is provided for the WFD sink implementation at
     * the first method's call during the WFD session and it contains the
     * initial request sequence number obtained from the WFD source (the initial
     * sequence numbers of connected peers may not be identical).
     */
    virtual int GetNextCSeq(int* initial_peer_cseq = nullptr) const = 0;

   protected:
    virtual ~Delegate() {}
  };

  /**
   * Observer interface.
   *
   * This interface can be used by the client in order to get notifications
   * from the state machine.
   */
  class Observer {
   public:
    /**
     * This method is called by the state machine if an error has occurred.
     * State machine is not reset.
     *
     * @param error type of the error
     *
     * @see ErrorType
     */
    virtual void ErrorOccurred(ErrorType error) {}
    /**
     * This method is called by the state machine if the session has been
     * completed normally (with 'teardown' message).
     * State machine is not reset.
     */
    virtual void SessionCompleted() {}

   protected:
    virtual ~Observer() {}
  };

  virtual ~Peer() {}

  /**
   * Starts wds state machine (source or sink)
   */
  virtual void Start() = 0;

  /**
   * Reset wds state machine (source or sink) to the initial state.
   */
  virtual void Reset() = 0;

  /**
   * Whenever RTSP data is received, this method should be called, so that
   * the state machine could take action based on current state.
   */
  virtual void RTSPDataReceived(const std::string& data) = 0;

  // Following methods:
  // @see Teardown()
  // @see Play()
  // @see Pause()
  // send M5 wfd_trigger_method messages for Peers that implement
  // Source functionality or M7, M8 and M9 for Sink implementations

  /**
   * Sends RTSP teardown request.
   * @return true if request can be sent, false otherwise.
   */
  virtual bool Teardown() = 0;

  /**
   * Sends RTSP play request.
   * @return true if request can be sent, false otherwise.
   */
  virtual bool Play() = 0;

  /**
   * Sends RTSP pause request.
   * @return true if request can be sent, false otherwise.
   */
  virtual bool Pause() = 0;

  /**
   * This method should be called by the client to notify the state
   * machine about the timer events.
   * @param timer_id id of the timer
   * @return true if request can be sent, false otherwise.
   *
   * @see Delegate::CreateTimer()
   */
  virtual void OnTimerEvent(unsigned timer_id) = 0;
};

}

#endif // LIBWDS_PUBLIC_PEER_H_


================================================
FILE: libwds/public/sink.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_SINK_H_
#define LIBWDS_PUBLIC_SINK_H_

#include "peer.h"

namespace wds {

class SinkMediaManager;

/**
 * Sink state machine implementation
 */
class WDS_EXPORT Sink : public Peer {
 public:
  virtual ~Sink() {}

  /**
   * Factory method that creates Sink state machine.
   * @param delegate that is used for networking
   * @param media manger that is used for media stream management
   * @return newly created Sink instance
   */
  static Sink* Create(Peer::Delegate* delegate, SinkMediaManager* mng);
};

}

#endif // LIBWDS_PUBLIC_SINK_H_


================================================
FILE: libwds/public/source.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_SOURCE_H_
#define LIBWDS_PUBLIC_SOURCE_H_

#include "peer.h"

namespace wds {

class SourceMediaManager;

/**
 * Source state machine implementation
 */
class WDS_EXPORT Source : public Peer {
 public:
  /**
   * Factory method that creates Source state machine.
   * @param delegate that is used for networking
   * @param media manger that is used for media stream management
   * @param observer
   * @return newly created Source instance
   */
  static Source* Create(Peer::Delegate* delegate,
                        SourceMediaManager* mng,
                        Peer::Observer* observer = nullptr);
};

}

#endif // LIBWDS_PUBLIC_SOURCE_H_


================================================
FILE: libwds/public/video_format.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_VIDEO_FORMAT_H_
#define LIBWDS_PUBLIC_VIDEO_FORMAT_H_

#include <bitset>
#include <vector>

#include "wds_export.h"

namespace wds {

using RateAndResolution = unsigned;
using RateAndResolutionsBitmap = std::bitset<32>;

// NOTE : Do not change the elements order in the following enums!

enum ResolutionType {
  CEA,
  VESA,
  HH
};

enum CEARatesAndResolutions {
  CEA640x480p60,
  CEA720x480p60,
  CEA720x480i60,
  CEA720x576p50,
  CEA720x576i50,
  CEA1280x720p30,
  CEA1280x720p60,
  CEA1920x1080p30,
  CEA1920x1080p60,
  CEA1920x1080i60,
  CEA1280x720p25,
  CEA1280x720p50,
  CEA1920x1080p25,
  CEA1920x1080p50,
  CEA1920x1080i50,
  CEA1280x720p24,
  CEA1920x1080p24
};

enum VESARatesAndResolutions {
  VESA800x600p30,
  VESA800x600p60,
  VESA1024x768p30,
  VESA1024x768p60,
  VESA1152x864p30,
  VESA1152x864p60,
  VESA1280x768p30,
  VESA1280x768p60,
  VESA1280x800p30,
  VESA1280x800p60,
  VESA1360x768p30,
  VESA1360x768p60,
  VESA1366x768p30,
  VESA1366x768p60,
  VESA1280x1024p30,
  VESA1280x1024p60,
  VESA1400x1050p30,
  VESA1400x1050p60,
  VESA1440x900p30,
  VESA1440x900p60,
  VESA1600x900p30,
  VESA1600x900p60,
  VESA1600x1200p30,
  VESA1600x1200p60,
  VESA1680x1024p30,
  VESA1680x1024p60,
  VESA1680x1050p30,
  VESA1680x1050p60,
  VESA1920x1200p30
};

enum HHRatesAndResolutions {
  HH800x480p30,
  HH800x480p60,
  HH854x480p30,
  HH854x480p60,
  HH864x480p30,
  HH864x480p60,
  HH640x360p30,
  HH640x360p60,
  HH960x540p30,
  HH960x540p60,
  HH848x480p30,
  HH848x480p60
};

enum H264Profile {
  CBP,
  CHP
};

enum H264Level {
  k3_1,
  k3_2,
  k4,
  k4_1,
  k4_2
};


struct NativeVideoFormat {
  NativeVideoFormat()
  : type(CEA), rate_resolution(CEA640x480p60) {}
  NativeVideoFormat(CEARatesAndResolutions rr)
  : type(CEA), rate_resolution(rr) {}
  NativeVideoFormat(VESARatesAndResolutions rr)
  : type(VESA), rate_resolution(rr) {}
  NativeVideoFormat(HHRatesAndResolutions rr)
  : type(HH), rate_resolution(rr) {}

  ResolutionType type;
  RateAndResolution rate_resolution;
};

/**
 * A single video format that the source selects for streaming.
 *
 * H264VideoFormat is a H264 profile, H264 level, and a single CEA,
 * VESA or HH resolution. Sources are choosing the video format by matching what they
 * support to what the sink supports, and then they communicate the chosen format back
 * to the sink.
 */
struct H264VideoFormat {
  H264VideoFormat()
  : profile(CBP), level(k3_1), type(CEA), rate_resolution(CEA640x480p60) {}

  H264VideoFormat(H264Profile profile, H264Level level, CEARatesAndResolutions rr)
  : profile(profile), level(level), type(CEA), rate_resolution(rr) {}

  H264VideoFormat(H264Profile profile, H264Level level, VESARatesAndResolutions rr)
  : profile(profile), level(level), type(VESA), rate_resolution(rr) {}

  H264VideoFormat(H264Profile profile, H264Level level, HHRatesAndResolutions rr)
  : profile(profile), level(level), type(HH), rate_resolution(rr) {}

  H264Profile profile;
  H264Level level;
  ResolutionType type;
  RateAndResolution rate_resolution;
};

/**
 * Represents <profile, level, misc-params, max-hres, max-vres> tuple used in 'wfd-video-formats'.
 *
 * H264VideoCodec is a H264 profile, H264 level, and three sets of
 * CEA, VESA and HH resolutions. Sinks send one or several H264VideoCodec
 * to sources (for example because supported resolutions might
 * be different for CBP and CHP).
 */
struct H264VideoCodec {
  H264VideoCodec()
  : profile(CBP), level(k3_1), cea_rr(RateAndResolutionsBitmap().set(CEA640x480p60)) {}

  H264VideoCodec(H264Profile profile, H264Level level,
                  const RateAndResolutionsBitmap& cea,
                  const RateAndResolutionsBitmap& vesa,
                  const RateAndResolutionsBitmap& hh)
  : profile(profile), level(level), cea_rr(cea), vesa_rr(vesa), hh_rr(hh) {}

  H264Profile profile;
  H264Level level;
  RateAndResolutionsBitmap cea_rr;
  RateAndResolutionsBitmap vesa_rr;
  RateAndResolutionsBitmap hh_rr;
};

/**
 * An auxiliary function which populates list of @c H264VideoFormat
 * items from the given @c H264VideoCodec instance.
 *
 * @param codec the given @c H264VideoCodec instance.
 * @param formats resulting list of @c H264VideoFormat items
 */
WDS_EXPORT void PopulateVideoFormatList(
    const H264VideoCodec& codec,
    std::vector<H264VideoFormat>& formats);

/**
 * An auxiliary function to find the optimal format for streaming.
 * The quality selection algorithm will pick codec with higher bandwidth.
 *
 * @param native format of a remote device
 * @param local_codecs list of H264 codecs that are supported by local device
 * @param remote_codecs list of H264 codecs that are supported by remote device
 * @return optimal H264 video format
 */
WDS_EXPORT H264VideoFormat FindOptimalVideoFormat(
    const NativeVideoFormat& remote_native_format,
    const std::vector<H264VideoCodec>& local_codecs,
    const std::vector<H264VideoCodec>& remote_codecs,
    bool* success = nullptr);

}  // namespace wds

#endif  // LIBWDS_PUBLIC_VIDEO_FORMAT_H_


================================================
FILE: libwds/public/wds_export.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef LIBWDS_PUBLIC_WDS_EXPORT_H_
#define LIBWDS_PUBLIC_WDS_EXPORT_H_

#if defined _WIN32 || defined _WIN64
  #define WDS_EXPORT __declspec(dllexport)
#else
  #define WDS_EXPORT __attribute__((visibility("default")))
#endif


#endif  // LIBWDS_PUBLIC_WDS_EXPORT_H_


================================================
FILE: libwds/rtsp/CMakeLists.txt
================================================
#FIXME in the future: with cmake 2.8.12 and up it's better
#to use target_compile_options or add_compile_options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -std=c99 -Wall")

# Make directory for generated parser files
set(PARSER_GEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gen")
file(MAKE_DIRECTORY ${PARSER_GEN_DIR})

include_directories ("${PROJECT_SOURCE_DIR}" "${PARSER_GEN_DIR}" )

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
  set(PARSER_DEBUG_OPTIONS "--debug -v")
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")

find_package(BISON REQUIRED)
BISON_TARGET(Parser parser.ypp ${PARSER_GEN_DIR}/parser.cpp COMPILE_FLAGS "-l -p wds_ ${PARSER_DEBUG_OPTIONS}")

find_package(FLEX REQUIRED)
FLEX_TARGET(MessageLexer messagelexer.l ${PARSER_GEN_DIR}/messagescanner.cpp COMPILE_FLAGS "-L -P message_ ${PARSER_DEBUG_OPTIONS}")
ADD_FLEX_BISON_DEPENDENCY(MessageLexer Parser)
FLEX_TARGET(HeaderLexer headerlexer.l ${PARSER_GEN_DIR}/headerscanner.cpp COMPILE_FLAGS "-L -P header_ ${PARSER_DEBUG_OPTIONS}")
ADD_FLEX_BISON_DEPENDENCY(HeaderLexer Parser)
FLEX_TARGET(ErrorLexer errorlexer.l ${PARSER_GEN_DIR}/errorscanner.cpp COMPILE_FLAGS "-L -P error_ ${PARSER_DEBUG_OPTIONS}")
ADD_FLEX_BISON_DEPENDENCY(ErrorLexer Parser)

add_library(wdsrtsp OBJECT
    ${BISON_Parser_OUTPUT_SOURCE}
    ${FLEX_MessageLexer_OUTPUTS}
    ${FLEX_ErrorLexer_OUTPUTS}
    ${FLEX_HeaderLexer_OUTPUTS}
    driver.cpp message.cpp header.cpp transportheader.cpp payload.cpp
    options.cpp reply.cpp getparameter.cpp setparameter.cpp play.cpp
    pause.cpp teardown.cpp setup.cpp property.cpp genericproperty.cpp
    formats3d.cpp audiocodecs.cpp clientrtpports.cpp
    contentprotection.cpp coupledsink.cpp displayedid.cpp
    presentationurl.cpp route.cpp triggermethod.cpp
    videoformats.cpp i2c.cpp avformatchangetiming.cpp uibcsetting.cpp
    standbyresumecapability.cpp standby.cpp idrrequest.cpp connectortype.cpp
    preferreddisplaymode.cpp uibccapability.cpp propertyerrors.cpp
)


================================================
FILE: libwds/rtsp/audiocodecs.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/audiocodecs.h"

#include <assert.h>

#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

namespace {

std::string ToString(const wds::AudioCodec& codec) {
  MAKE_HEX_STRING_8(audio_modes_str,
      static_cast<unsigned int>(codec.modes.to_ulong()));
  MAKE_HEX_STRING_2(latency_str, codec.latency);
  const char* const name[] = {"LPCM", "AAC", "AC3"};
  std::string ret = name[codec.format]
    + std::string(SPACE) + audio_modes_str
    + std::string(SPACE) + latency_str;
  return ret;
}

}

AudioCodecs::AudioCodecs()
  : Property(AudioCodecsPropertyType, true) {
}

AudioCodecs::AudioCodecs(const std::vector<wds::AudioCodec>& audio_codecs)
  : Property(AudioCodecsPropertyType),
    audio_codecs_(audio_codecs) {
}

AudioCodecs::~AudioCodecs() {
}

std::string AudioCodecs::ToString() const {
  std::string ret = PropertyName::wfd_audio_codecs + std::string(SEMICOLON)
    + std::string(SPACE);

  if (audio_codecs_.empty())
    return ret + NONE;

  auto it = audio_codecs_.begin();
  auto end = audio_codecs_.end();
  while (it != end) {
    ret += wds::rtsp::ToString(*it);
    ++it;
    if (it != end)
      ret += ", ";
  }

  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/audiocodecs.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_AUDIOCODECS_H_
#define LIBWDS_RTSP_AUDIOCODECS_H_

#include <vector>

#include "libwds/public/audio_codec.h"
#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class AudioCodecs: public Property {
 public:
  AudioCodecs();
  AudioCodecs(const std::vector<wds::AudioCodec>& audio_codecs);
  ~AudioCodecs() override;

  const std::vector<wds::AudioCodec>& audio_codecs() const { return audio_codecs_; }
  std::string ToString() const override;

 private:
  std::vector<AudioCodec> audio_codecs_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_AUDIOCODECS_H_


================================================
FILE: libwds/rtsp/avformatchangetiming.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/avformatchangetiming.h"

#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

AVFormatChangeTiming::AVFormatChangeTiming(unsigned long long int pts,
    unsigned long long int dts)
  : Property(AVFormatChangeTimingPropertyType),
    pts_(pts),
    dts_(dts) {

}

AVFormatChangeTiming::~AVFormatChangeTiming() {
}

std::string AVFormatChangeTiming::ToString() const {
  MAKE_HEX_STRING_10(pts, pts_);
  MAKE_HEX_STRING_10(dts, dts_);
  std::string ret =
      PropertyName::wfd_av_format_change_timing + std::string(SEMICOLON)
     + std::string(SPACE) + pts
     + std::string(SPACE) + dts;
  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/avformatchangetiming.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_AVFORMATCHANGETIMING_H_
#define LIBWDS_RTSP_AVFORMATCHANGETIMING_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class AVFormatChangeTiming: public Property {
public:
  AVFormatChangeTiming(unsigned long long int pts, unsigned long long int dts);
  ~AVFormatChangeTiming() override;

  unsigned long long int pts() const { return pts_; }
  unsigned long long int dts() const { return dts_; }

  std::string ToString() const override;

 private:
  unsigned long long int pts_;
  unsigned long long int dts_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_AVFORMATCHANGETIMING_H_


================================================
FILE: libwds/rtsp/clientrtpports.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/clientrtpports.h"

namespace wds {
namespace rtsp {

namespace {
const char profile[] = "RTP/AVP/UDP;unicast";
const char mode[] = "mode=play";
}

ClientRtpPorts::ClientRtpPorts(unsigned short rtp_port_0,
    unsigned short rtp_port_1)
  : Property(ClientRTPPortsPropertyType),
    rtp_port_0_(rtp_port_0),
    rtp_port_1_(rtp_port_1) {
}

ClientRtpPorts::~ClientRtpPorts() {
}

std::string ClientRtpPorts::ToString() const {
  return PropertyName::wfd_client_rtp_ports + std::string(SEMICOLON)
    + std::string(SPACE) + profile
    + std::string(SPACE) + std::to_string(rtp_port_0_)
    + std::string(SPACE) + std::to_string(rtp_port_1_)
    + std::string(SPACE) + mode;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/clientrtpports.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_CLIENTRTPPORTS_H_
#define LIBWDS_RTSP_CLIENTRTPPORTS_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class ClientRtpPorts: public Property {
 public:
  ClientRtpPorts(unsigned short rtp_port_0, unsigned short rtp_port_1);
  ~ClientRtpPorts() override;

  unsigned short rtp_port_0() const { return rtp_port_0_; }
  unsigned short rtp_port_1() const { return rtp_port_1_; }
  std::string ToString() const override;

 private:
  unsigned short rtp_port_0_;
  unsigned short rtp_port_1_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_CLIENTRTPPORTS_H_


================================================
FILE: libwds/rtsp/connectortype.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/connectortype.h"

#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

ConnectorType::ConnectorType()
  : Property(ConnectorTypePropertyType, true),
    connector_type_() {
}

ConnectorType::ConnectorType(unsigned char connector_type)
  : Property(ConnectorTypePropertyType),
    connector_type_(connector_type) {
}

ConnectorType::ConnectorType(wds::ConnectorType connector_type)
  : Property(ConnectorTypePropertyType, connector_type == wds::ConnectorTypeNone) {
  connector_type_ = is_none() ? 0  // Ignored.
                              : static_cast<unsigned char>(connector_type);
}

ConnectorType::~ConnectorType() {
}

std::string ConnectorType::ToString() const {
  std::string ret = PropertyName::wfd_connector_type + std::string(SEMICOLON)
    + std::string(SPACE);

  if (is_none()) {
    ret += NONE;
  } else {
    MAKE_HEX_STRING_2(connector_type, connector_type_);
    ret += connector_type;
  }

  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/connectortype.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_CONNECTORTYPE_H_
#define LIBWDS_RTSP_CONNECTORTYPE_H_

#include "libwds/public/connector_type.h"
#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class ConnectorType: public Property {
 public:
  ConnectorType();
  explicit ConnectorType(unsigned char connector_type);
  explicit ConnectorType(wds::ConnectorType connector_type);
  ~ConnectorType() override;

  unsigned char connector_type() const { return connector_type_; }
  std::string ToString() const override;

 private:
  unsigned char connector_type_;
};

}  // namespace rtsp
}  // namespace wds
#endif  // LIBWDS_RTSP_CONNECTORTYPE_H_


================================================
FILE: libwds/rtsp/constants.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_CONSTANTS_H_
#define LIBWDS_RTSP_CONSTANTS_H_

namespace wds {
namespace rtsp {

const char SEMICOLON[] = ":";
const char SPACE[] = " ";
const char NONE[] = "none";
const char CRLF[] = "\r\n";
const char RTSP_END[] = "RTSP/1.0";

enum PropertyType {
  AVFormatChangeTimingPropertyType,
  AudioCodecsPropertyType,
  ClientRTPPortsPropertyType,
  ConnectorTypePropertyType,
  ContentProtectionPropertyType,
  CoupledSinkPropertyType,
  DisplayEdidPropertyType,
  GenericPropertyType,
  I2CPropertyType,
  IDRRequestPropertyType,
  PreferredDisplayModePropertyType,
  PresentationURLPropertyType,
  RoutePropertyType,
  StandbyPropertyType,
  StandbyResumeCapabilityPropertyType,
  TriggerMethodPropertyType,
  UIBCCapabilityPropertyType,
  UIBCSettingPropertyType,
  Video3DFormatsPropertyType,
  VideoFormatsPropertyType
};

namespace PropertyName {
  const char wfd_audio_codecs[] = "wfd_audio_codecs";
  const char wfd_video_formats[] = "wfd_video_formats";
  const char wfd_3d_video_formats[] = "wfd_3d_video_formats";
  const char wfd_content_protection[] = "wfd_content_protection";
  const char wfd_display_edid[] = "wfd_display_edid";
  const char wfd_coupled_sink[] = "wfd_coupled_sink";
  const char wfd_trigger_method[] = "wfd_trigger_method";
  const char wfd_presentation_url[] = "wfd_presentation_URL";
  const char wfd_client_rtp_ports[] = "wfd_client_rtp_ports";
  const char wfd_route[] = "wfd_route";
  const char wfd_I2C[] = "wfd_I2C";
  const char wfd_av_format_change_timing[] = "wfd_av_format_change_timing";
  const char wfd_preferred_display_mode[] = "wfd_preferred_display_mode";
  const char wfd_uibc_capability[] = "wfd_uibc_capability";
  const char wfd_uibc_setting[] = "wfd_uibc_setting";
  const char wfd_standby_resume_capability[] = "wfd_standby_resume_capability";
  const char wfd_standby[] = "wfd_standby";
  const char wfd_connector_type[] = "wfd_connector_type";
  const char wfd_idr_request[] = "wfd_idr_request";
}  // namespace PropertyName

enum Method {
  OPTIONS,
  SET_PARAMETER,
  GET_PARAMETER,
  SETUP,
  PLAY,
  TEARDOWN,
  PAUSE,
  ORG_WFA_WFD_1_0
};

namespace MethodName {
  const char OPTIONS[] = "OPTIONS";
  const char SET_PARAMETER[] = "SET_PARAMETER";
  const char GET_PARAMETER[] = "GET_PARAMETER";
  const char SETUP[] = "SETUP";
  const char PLAY[] = "PLAY";
  const char TEARDOWN[] = "TEARDOWN";
  const char PAUSE[] = "PAUSE";
  const char ORG_WFA_WFD1_0[] = "org.wfa.wfd1.0";

  const char* const name[] = { OPTIONS,
                              SET_PARAMETER,
                              GET_PARAMETER,
                              SETUP,
                              PLAY,
                              TEARDOWN,
                              PAUSE,
                              ORG_WFA_WFD1_0 };
}

enum RTSPStatusCode {
  STATUS_OK = 200,
  STATUS_SeeOther = 303,
  STATUS_NotAcceptable = 406,
  STATUS_UnsupportedMediaType = 415,
  STATUS_NotImplemented = 501
};

} // namespace rtsp
} // namespace wds

#endif // LIBWDS_RTSP_CONSTANTS_H_


================================================
FILE: libwds/rtsp/contentprotection.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/contentprotection.h"

#include <assert.h>

namespace wds {
namespace rtsp {

namespace {
  const char* name[] = {"HDCP2.0", "HDCP2.1"};
  const char port_prefix[] = "port=";
}

ContentProtection::ContentProtection(HDCPSpec hdcp_spec, unsigned int port)
  : Property (ContentProtectionPropertyType),
    hdcp_spec_(hdcp_spec),
    port_(port) {
}

ContentProtection::ContentProtection(): Property (ContentProtectionPropertyType, true) {
}

ContentProtection::~ContentProtection() {
}

ContentProtection::HDCPSpec ContentProtection::hdcp_spec() const {
  assert(hdcp_spec_ != HDCP_SPEC_2_0
      || hdcp_spec_ != HDCP_SPEC_2_1);
  return hdcp_spec_;
}

std::string ContentProtection::ToString() const {
  std::string ret =
      PropertyName::wfd_content_protection
    + std::string(SEMICOLON) + std::string(SPACE);

  if (is_none())
    ret += NONE;
  else
    ret += name[hdcp_spec()] + std::string(SPACE)
        + port_prefix + std::to_string(port_);
  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/contentprotection.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_CONTENTPROTECTION_H_
#define LIBWDS_RTSP_CONTENTPROTECTION_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class ContentProtection: public Property {
 public:
  enum HDCPSpec {
    HDCP_SPEC_2_0,
    HDCP_SPEC_2_1
  };

 public:
  ContentProtection();
  ContentProtection(HDCPSpec hdcp_spec, unsigned int port);
  ~ContentProtection() override;

  HDCPSpec hdcp_spec() const;
  unsigned int port() const { return port_; }
  std::string ToString() const override;

 private:
  HDCPSpec hdcp_spec_;
  unsigned int port_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_CONTENTPROTECTION_H_


================================================
FILE: libwds/rtsp/coupledsink.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/coupledsink.h"

#include <climits>
#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

CoupledSink::CoupledSink(unsigned char status,
    unsigned long long int sink_address)
    : Property(CoupledSinkPropertyType),
      status_(status),
      sink_address_(sink_address) {
}

CoupledSink::CoupledSink(): Property(CoupledSinkPropertyType, true){
}

CoupledSink::~CoupledSink(){
}

std::string CoupledSink::ToString() const {
  std::string ret =
      PropertyName::wfd_coupled_sink + std::string(SEMICOLON)
    + std::string(SPACE);

  if (is_none()) {
    ret += NONE;
  } else {
    MAKE_HEX_STRING_2(status, status_);
    ret += status + std::string(SPACE);

    if (sink_address_ != ULLONG_MAX) {
      MAKE_HEX_STRING_12(sink_address, sink_address_);
      ret += sink_address;
    } else {
      ret += NONE;
    }
  }

  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/coupledsink.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_COUPLEDSINK_H_
#define LIBWDS_RTSP_COUPLEDSINK_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class CoupledSink: public Property {
 public:
  CoupledSink();
  CoupledSink(unsigned char status, unsigned long long int sink_address);
  ~CoupledSink() override;

  unsigned char status() const { return status_; }
  unsigned long long int sink_address() const { return sink_address_; }
  std::string ToString() const override;

 private:
  unsigned short status_;
  unsigned long long int sink_address_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_COUPLEDSINK_H_


================================================
FILE: libwds/rtsp/displayedid.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/displayedid.h"

#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

DisplayEdid::DisplayEdid(): Property(DisplayEdidPropertyType, true) {
}

DisplayEdid::DisplayEdid(unsigned short edid_block_count,
    const std::string& edid_payload)
  : Property(DisplayEdidPropertyType),
    edid_block_count_(edid_block_count),
    edid_payload_(edid_payload.length() ? edid_payload : NONE) {
}

DisplayEdid::~DisplayEdid() {
}

std::string DisplayEdid::ToString() const {

  std::string ret =
      PropertyName::wfd_display_edid + std::string(SEMICOLON)
    + std::string(SPACE);

  if (is_none()) {
    ret += NONE;
  } else {
    MAKE_HEX_STRING_2(edid_block_count, edid_block_count_);
    ret += edid_block_count + std::string(SPACE) + edid_payload_;
  }

  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/displayedid.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_DISPLAYEDID_H_
#define LIBWDS_RTSP_DISPLAYEDID_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class DisplayEdid: public Property {
 public:
  DisplayEdid();
  DisplayEdid(unsigned short edid_block_count, const std::string& edid_payload);
  ~DisplayEdid() override;

  unsigned short block_count() const { return edid_block_count_; }
  const std::string& payload() const { return edid_payload_; }
  std::string ToString() const override;

 private:
  unsigned short edid_block_count_;
  std::string edid_payload_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_DISPLAYEDID_H_


================================================
FILE: libwds/rtsp/driver.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/driver.h"

#include <cctype>
#include <sstream>

#include "libwds/public/logging.h"
#include "libwds/rtsp/message.h"
#include "libwds/rtsp/reply.h"

#include "errorscanner.h"
#include "headerscanner.h"
#include "messagescanner.h"

int wds_lex(YYSTYPE* yylval, void* scanner,
    std::unique_ptr<wds::rtsp::Message>& message) {
  if (!message) {
    return header_lex(yylval, scanner);
  } else if (message->is_reply()) {
    wds::rtsp::Reply* reply = static_cast<wds::rtsp::Reply*>(message.get());
    if (reply->response_code() == wds::rtsp::STATUS_SeeOther)
      return error_lex(yylval, scanner);

    return message_lex(yylval, scanner);
  }

  return message_lex(yylval, scanner);
}

void wds_error(void* scanner, std::unique_ptr<wds::rtsp::Message>& message,
    const char* error_message) {
  WDS_ERROR("Parser error: %s", error_message);
  message.reset(nullptr);
}

namespace wds {
namespace rtsp {

void Driver::Parse(const std::string& input, std::unique_ptr<Message>& message) {
  void* scanner = nullptr;
#if YYDEBUG
  bool enable_debug = true;
  wds_debug = 1;
#else
  bool enable_debug = false;
#endif

  if (!message) {
    header_lex_init(&scanner);
    header_set_debug(enable_debug, scanner);
    header__scan_string(input.c_str(), scanner);
    wds_parse(scanner, message);
    header_lex_destroy(scanner);
  } else if (message->is_reply()) {
    Reply* reply = static_cast<Reply*>(message.get());
    if (reply->response_code() == STATUS_SeeOther) {
      error_lex_init(&scanner);
      error_set_debug(enable_debug, scanner);
      error__scan_string(input.c_str(), scanner);
      wds_parse(scanner, message);
      error_lex_destroy(scanner);
    } else {
      message_lex_init(&scanner);
      message_set_debug(enable_debug, scanner);
      message_set_extra(message->is_reply(), scanner);
      message__scan_string(input.c_str(), scanner);
      wds_parse(scanner, message);
      message_lex_destroy(scanner);
    }
  } else {
    message_lex_init(&scanner);
    message_set_debug(enable_debug, scanner);
    message__scan_string(input.c_str(), scanner);
    wds_parse(scanner, message);
    message_lex_destroy(scanner);
  }
}

} // namespace rtsp
} // namespace wds



================================================
FILE: libwds/rtsp/driver.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_DRIVER_H_
#define LIBWDS_RTSP_DRIVER_H_

#include <string>
#include <memory>

#include "parser.h"

namespace wds {
namespace rtsp {

class Message;

class Driver {
 public:
  static void Parse(const std::string& input, std::unique_ptr<Message>& message /*out*/);
};

}  // namespace rtsp
}  // namespace wds

// Required by bison.
int wds_lex(YYSTYPE* yylval, void* scanner, std::unique_ptr<wds::rtsp::Message>& message);
void wds_error (void* scanner, std::unique_ptr<wds::rtsp::Message>& message, const char* error_message);

#endif  // LIBWDS_RTSP_DRIVER_H_


================================================
FILE: libwds/rtsp/errorlexer.l
================================================
%option nodefault nounput nomain
%option bison-bridge reentrant noyywrap
%option never-interactive
%option warn stack noyy_top_state noyy_pop_state noyy_push_state
%option case-insensitive
%option extra-type="bool"
%option outfile="gen/errorscanner.cpp" header-file="gen/errorscanner.h"

%top{
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <stdint.h>

#define YY_NO_UNISTD_H 1
}

%{
#include <string>

#include "parser.h"

#define yyterminate() return(END)
%}

DIGITS [0-9]+
SP [ \t]
CR [\r]
LF [\n]
CRLF {CR}{LF}

%%
  /* skip these */
{CRLF} { }
{LF} { }
{CR} { }

 /* Convert these */
","  { return ','; }
":"  { return ':'; }

{SP}+ return WFD_SP;

^"wfd_audio_codecs" {
    return WFD_AUDIO_CODECS_ERROR;
  }

^"wfd_video_formats" {
    return WFD_VIDEO_FORMATS_ERROR;
  }

^"wfd_3d_video_formats" {
    return WFD_3D_FORMATS_ERROR;
  }

^"wfd_content_protection" {
    return WFD_CONTENT_PROTECTION_ERROR;
  }

^"wfd_display_edid" {
    return WFD_DISPLAY_EDID_ERROR;
  }

^"wfd_coupled_sink" {
    return WFD_COUPLED_SINK_ERROR;
  }

^"wfd_trigger_method" {
    return WFD_TRIGGER_METHOD_ERROR;
  }

^"wfd_presentation_url" {
    return WFD_PRESENTATION_URL_ERROR;
  }

^"wfd_client_rtp_ports" {
    return WFD_CLIENT_RTP_PORTS_ERROR;
  }

^"wfd_route" {
    return WFD_ROUTE_ERROR;
  }

^"wfd_I2C" {
    return WFD_I2C_ERROR;
  }

^"wfd_av_format_change_timing" {
    return WFD_AV_FORMAT_CHANGE_TIMING_ERROR;
  }

^"wfd_preferred_display_mode" {
    return WFD_PREFERRED_DISPLAY_MODE_ERROR;
  }

^"wfd_uibc_capability" {
    return WFD_UIBC_CAPABILITY_ERROR;
  }

^"wfd_uibc_setting" {
    return WFD_UIBC_SETTING_ERROR;
  }

^"wfd_standby_resume_capability" {
    return WFD_STANDBY_RESUME_CAPABILITY_ERROR;
  }

^"wfd_standby" {
    return WFD_STANDBY_ERROR;
  }

^"wfd_connector_type" {
    return WFD_CONNECTOR_TYPE_ERROR;
  }

^"wfd_idr_request" {
    return WFD_IDR_REQUEST_ERROR;
  }

^[[:alpha:]][[:alnum:]\-\_]* {
    yylval->sval = new std::string(yytext, yyleng);
    return WFD_GENERIC_PROPERTY_ERROR;
  }

{DIGITS} {
    std::string str(yytext, yyleng);
    str += '\0';
    errno = 0;
    yylval->nval = strtoull(str.c_str(), NULL, 10);
    if (errno)
      yyterminate();
    return WFD_NUM;
  }

 /* all unmatched */
<*>. {}
%%


================================================
FILE: libwds/rtsp/formats3d.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/formats3d.h"

#include "libwds/rtsp/macros.h"

namespace wds {
namespace rtsp {

Formats3d::Formats3d() : Property(Video3DFormatsPropertyType, true) {
}

Formats3d::Formats3d(unsigned char native,
    unsigned char preferred_display_mode,
    const H264Codecs3d& h264_codecs_3d)
  : Property(Video3DFormatsPropertyType),
    native_(native),
    preferred_display_mode_(preferred_display_mode),
    h264_codecs_3d_(h264_codecs_3d) {
}

Formats3d::~Formats3d() {
  // TODO Auto-generated destructor stub
}

std::string H264Codec3d::ToString() const {
  std::string ret;
  MAKE_HEX_STRING_2(profile, profile_);
  MAKE_HEX_STRING_2(level, level_);
  MAKE_HEX_STRING_16(video_capability_3d, video_capability_3d_);
  MAKE_HEX_STRING_2(latency,latency_);
  MAKE_HEX_STRING_4(min_slice_size, min_slice_size_);
  MAKE_HEX_STRING_4(slice_enc_params, slice_enc_params_);
  MAKE_HEX_STRING_2(frame_rate_control_support, frame_rate_control_support_);

  ret = profile + std::string(SPACE)
      + level + std::string(SPACE)
      + video_capability_3d + std::string(SPACE)
      + latency + std::string(SPACE)
      + min_slice_size + std::string(SPACE)
      + slice_enc_params + std::string(SPACE)
      + frame_rate_control_support + std::string(SPACE);

  if (max_hres_ > 0) {
    MAKE_HEX_STRING_4(max_hres, max_hres_);
    ret += max_hres;
  } else {
    ret += NONE;
  }
  ret += std::string(SPACE);

  if (max_vres_ > 0) {
    MAKE_HEX_STRING_4(max_vres, max_vres_);
    ret += max_vres;
  } else {
    ret += NONE;
  }

  return ret;
}

std::string Formats3d::ToString() const {
  std::string ret;

  ret = PropertyName::wfd_3d_video_formats
      + std::string(SEMICOLON)+ std::string(SPACE);

  if (is_none())
    return ret + NONE;

  MAKE_HEX_STRING_2(native, native_);
  MAKE_HEX_STRING_2(preferred_display_mode, preferred_display_mode_);

  ret += native + std::string(SPACE)
      + preferred_display_mode + std::string(SPACE);

  auto it = h264_codecs_3d_.begin();
  auto end = h264_codecs_3d_.end();
  while(it != end) {
    ret += (*it).ToString();
    ++it;
    if (it != end)
      ret += ", ";
  }

  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/formats3d.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_FORMATS3D_H_
#define LIBWDS_RTSP_FORMATS3D_H_

#include "libwds/rtsp/property.h"

#include <vector>

namespace wds {
namespace rtsp {

// todo(shalamov): refactor, looks almost similar to VideoFormats

struct H264Codec3d {
 public:
  H264Codec3d(unsigned char profile, unsigned char level,
      unsigned long long int video_capability_3d, unsigned char latency,
      unsigned short min_slice_size, unsigned short slice_enc_params,
      unsigned char frame_rate_control_support,
      unsigned short max_hres, unsigned short max_vres)
    : profile_(profile),
      level_(level),
      video_capability_3d_(video_capability_3d),
      latency_(latency),
      min_slice_size_(min_slice_size),
      slice_enc_params_(slice_enc_params),
      frame_rate_control_support_(frame_rate_control_support),
      max_hres_(max_hres),
      max_vres_(max_vres) {}

  std::string ToString() const;

  unsigned char profile_;
  unsigned char level_;
  unsigned long long int video_capability_3d_;
  unsigned char latency_;
  unsigned short min_slice_size_;
  unsigned short slice_enc_params_;
  unsigned char frame_rate_control_support_;
  unsigned short max_hres_;
  unsigned short max_vres_;
};

typedef std::vector<H264Codec3d> H264Codecs3d;

class Formats3d: public Property {
 public:
  Formats3d();
  Formats3d(unsigned char native,
            unsigned char preferred_display_mode,
            const H264Codecs3d& h264_codecs_3d);
  ~Formats3d() override;

  unsigned char native_resolution() const { return native_; }
  unsigned char preferred_display_mode() const { return preferred_display_mode_;}
  const H264Codecs3d& codecs() const { return h264_codecs_3d_; }

  std::string ToString() const override;

 private:
  unsigned char native_;
  unsigned char preferred_display_mode_;
  H264Codecs3d h264_codecs_3d_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_FORMATS3D_H_


================================================
FILE: libwds/rtsp/genericproperty.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include <string>

#include "libwds/rtsp/genericproperty.h"

namespace wds {
namespace rtsp {

GenericProperty::GenericProperty() : Property(GenericPropertyType) {
}

GenericProperty::GenericProperty(const std::string& key, const std::string& value)
  : Property(GenericPropertyType),
    key_(key),
    value_(value) {
}

GenericProperty::~GenericProperty() {
}

std::string GenericProperty::ToString() const {
  return key_ + ": " + value_;
}

std::string GenericProperty::GetName() const {
  return key_;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/genericproperty.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_GENERIC_PROPERTY_H_
#define LIBWDS_RTSP_GENERIC_PROPERTY_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class GenericProperty: public Property {
 public:
  GenericProperty();
  GenericProperty(const std::string& key, const std::string& value);

  ~GenericProperty() override;

  const std::string& key() const { return key_; }
  const std::string& value() const { return value_; }

  std::string ToString() const override;
  std::string GetName() const override;

 private:
  std::string key_;
  std::string value_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_GENERIC_PROPERTY_H_


================================================
FILE: libwds/rtsp/getparameter.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/getparameter.h"

namespace wds {
namespace rtsp {

GetParameter::GetParameter(const std::string& request_uri)
 : Request(Request::MethodGetParameter, request_uri) {
}

GetParameter::~GetParameter() {
}

std::string GetParameter::ToString() const {
  std::string ret = MethodName::GET_PARAMETER
      + std::string(SPACE) + request_uri()
      + std::string(SPACE) + std::string(RTSP_END) + std::string(CRLF);
  return ret + Message::ToString();
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/getparameter.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_GETPARAMETER_H_
#define LIBWDS_RTSP_GETPARAMETER_H_

#include "libwds/rtsp/message.h"

namespace wds {
namespace rtsp {

class GetParameter : public Request {
 public:
    explicit GetParameter(const std::string& request_uri);
    ~GetParameter() override;
    std::string ToString() const override;
};

} // namespace rtsp
} // namespace wds

#endif // LIBWDS_RTSP_GETPARAMETER_H_


================================================
FILE: libwds/rtsp/header.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/header.h"

#include <algorithm>

namespace wds {
namespace rtsp {

namespace {
  const char kContentLenght[] = "Content-Length: ";
  const char kContentType[] = "Content-Type: ";
  const char kContentLength[] = "Content-Length: ";
  const char kCSeq[] = "CSeq: ";
  const char kSession[] = "Session: ";
  const char kTimeout[] = ";timeout=";
  const char kPublic[] = "Public: ";
  const char kRequire[] = "Require: org.wfa.wfd1.0";
}

Header::Header() :
    cseq_(0),
    content_length_(0),
    timeout_(0),
    require_wfd_support_(false) {
}

Header::~Header() {
}

int Header::cseq() const {
  return cseq_;
}

void Header::set_cseq(int cseq) {
  cseq_ = cseq;
}

int Header::content_length() const {
  return content_length_;
}

void Header::set_content_length(int content_length) {
  content_length_ = content_length;
}

const std::string& Header::content_type() const {
  return content_type_;
}

void Header::set_content_type(const std::string& content_type) {
  content_type_ = content_type;
}

const std::string& Header::session() const {
    return session_;
}

void Header::set_session(const std::string& session) {
    session_ = session;
}

unsigned int Header::timeout() const {
    return timeout_;
}

void Header::set_timeout(int timeout) {
    timeout_ = timeout;
}

TransportHeader& Header::transport() const {
    if (!transport_)
        transport_.reset(new TransportHeader());
    return *transport_;
}

void Header::set_transport(TransportHeader* transport) {
    transport_.reset(transport);
}

bool Header::require_wfd_support() const {
  return require_wfd_support_;
}

void Header::set_require_wfd_support(bool require_wfd_support) {
  require_wfd_support_ = require_wfd_support;
}

const std::vector<Method>& Header::supported_methods() const {
  return supported_methods_;
}

void Header::add_generic_header(const std::string& key ,const std::string& value) {
    generic_headers_[key] = value;
}

const GenericHeaderMap& Header::generic_headers() const {
    return generic_headers_;
}

void Header::set_supported_methods(
    const std::vector<Method>& supported_methods) {
  supported_methods_ = supported_methods;
}

bool Header::has_method(const Method& method) const {
  return std::find (supported_methods_.begin(),
      supported_methods_.end(),
      method) != supported_methods_.end();
}

std::string Header::ToString() const {
  std::string ret;

  ret += kCSeq + std::to_string(cseq_) + CRLF;

  if (!session_.empty()) {
      if (timeout_ > 0)
          ret += kSession + session_
            + kTimeout + std::to_string(timeout_) + CRLF;
      else
          ret += kSession + session_ + CRLF;
  }

  if (content_type_.length())
    ret += kContentType + content_type_ + CRLF;

  if (content_length_)
    ret += kContentLenght + std::to_string(content_length_) + CRLF;

  ret += transport().ToString();

  if (supported_methods_.size()) {
    auto i = supported_methods_.begin();
    auto end = supported_methods_.end();
    ret += kPublic;
    while (i != end) {
      ret += MethodName::name[*i];
      if (i != --supported_methods_.end()) {
        ret += ", ";
      }
      ++i;
    }
    ret += CRLF;
  }

  if (require_wfd_support_)
    ret += std::string(kRequire) + CRLF;

  for (auto it = generic_headers_.begin(); it != generic_headers_.end(); it++)
    ret += (*it).first + ": " + (*it).second + CRLF;

  return ret + CRLF;
}

} // namespace rtsp
} // namespace wds


================================================
FILE: libwds/rtsp/header.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_HEADER_H_
#define LIBWDS_RTSP_HEADER_H_

#include <string>
#include <vector>
#include <map>
#include <memory>

#include "libwds/rtsp/constants.h"
#include "libwds/rtsp/transportheader.h"

typedef std::map<std::string, std::string> GenericHeaderMap;

namespace wds {
namespace rtsp {

class Header {
  public:
    Header();
    virtual ~Header();

    int cseq() const;
    void set_cseq(int cseq);

    int content_length() const;
    void set_content_length(int content_length);

    const std::string& content_type() const;
    void set_content_type(const std::string& content_type);

    const std::string& session() const;
    void set_session(const std::string& session);

    unsigned int timeout() const;
    void set_timeout(int timeout);

    TransportHeader& transport() const;
    void set_transport(TransportHeader* transport);

    bool require_wfd_support() const;
    void set_require_wfd_support(bool require_wfd_support);

    const std::vector<Method>& supported_methods() const;
    void set_supported_methods(const std::vector<Method>& supported_methods);
    bool has_method(const Method& method) const;

    void add_generic_header(const std::string& key ,const std::string& value);
    const GenericHeaderMap& generic_headers () const;

    std::string ToString() const;

 private:
    int cseq_;
    int content_length_;
    unsigned int timeout_;
    std::string session_;
    mutable std::unique_ptr<TransportHeader> transport_;
    std::string content_type_;
    bool require_wfd_support_;
    std::vector<Method> supported_methods_;
    GenericHeaderMap generic_headers_;
};

} // namespace rtsp
} // namespace wds

#endif // LIBWDS_RTSP_HEADER_H_


================================================
FILE: libwds/rtsp/headerlexer.l
================================================
%option nodefault nounput nomain
%option bison-bridge reentrant noyywrap
%option never-interactive
%option warn stack noyy_top_state noyy_pop_state noyy_push_state
%option case-insensitive
%option extra-type="bool"
%option outfile="gen/headerscanner.cpp" header-file="gen/headerscanner.h"

%top{
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <stdint.h>

#define YY_NO_UNISTD_H 1
}

%{
#include <string>

#include "parser.h"
#define yyterminate() return(END)
%}

%x MATCH_STRING_STATE
%x MATCH_RESPONSE_CODE_STATE

%s SUPPORTED_METHODS_STATE
%s CONTENT_TYPE_STATE
%s SESSION_STATE

DIGIT [0-9]
DIGITS [0-9]+
HEXDIG [0-9a-fA-F]
HEXDIGITS [0-9a-fA-F]+
SP [ \t]
CR [\r]
LF [\n]
CRLF {CR}{LF}

%%

<*>{CRLF} { BEGIN(INITIAL); }
<*>{LF} { BEGIN(INITIAL); }
<*>{CR} { BEGIN(INITIAL); }

 /* Convert these */
"="  { return '='; }
"-"  { return '-'; }
","  { return ','; }
"\*" { return '*'; }
";"  { return ';'; }
":"  { return ':'; }
"/"  { return '/'; }

{SP}+ return WFD_SP;

";timeout=" return WFD_TIMEOUT;
";server_port=" return WFD_SERVER_PORT;

^(?-i:"OPTIONS") {
    BEGIN(INITIAL);
    return WFD_OPTIONS;
  }

^(?-i:"SET_PARAMETER") {
    BEGIN(INITIAL);
    return WFD_SET_PARAMETER;
  }

^(?-i:"GET_PARAMETER") {
    BEGIN(INITIAL);
    return WFD_GET_PARAMETER;
  }

^(?-i:"SETUP") {
    BEGIN(INITIAL);
    return WFD_SETUP;
  }

^(?-i:"PLAY") {
    BEGIN(INITIAL);
    return WFD_PLAY;
  }

^(?-i:"TEARDOWN") {
    BEGIN(INITIAL);
    return WFD_TEARDOWN;
  }

^(?-i:"PAUSE") {
    BEGIN(INITIAL);
    return WFD_PAUSE;
  }

  /* RTSP response, get reply code, RTSP/1.0 200 OK */
^"RTSP/"{DIGIT}"."{DIGIT}{SP}+ {
    BEGIN(MATCH_RESPONSE_CODE_STATE);
    return WFD_RESPONSE;
  }

  /* CSeq: i */
^"CSeq:" {
    BEGIN(INITIAL);
    return WFD_CSEQ;
  }

^"Public:" {
    BEGIN(SUPPORTED_METHODS_STATE);
    return WFD_RESPONSE_METHODS;
  }

^"Require: org.wfa.wfd1.0" {
    return WFD_SUPPORT_CHECK;
  }

^"Content-Type:" {
    BEGIN(CONTENT_TYPE_STATE);
    return WFD_CONTENT_TYPE;
  }

^"Content-Length:" {
    BEGIN(INITIAL);
    return WFD_CONTENT_LENGTH;
  }

^"Session:" {
    BEGIN(SESSION_STATE);
    return WFD_SESSION;
  }

^"Transport: RTP/AVP/UDP;unicast;client_port=" {
    return WFD_TRANSPORT;
  }

^[[:alpha:]][[:alnum:]\-\_]*":" {
    BEGIN(MATCH_STRING_STATE);
    yylval->sval = new std::string(yytext, yyleng - 1);
    return WFD_HEADER;
  }

<SESSION_STATE>[^ ;\t\r\n]+ {
    BEGIN(INITIAL);
    yylval->sval = new std::string(yytext, yyleng);
    return WFD_SESSION_ID;
  }

<MATCH_RESPONSE_CODE_STATE>{DIGITS} {
    BEGIN(MATCH_STRING_STATE);
    yylval->nval = atoi(yytext);
    return WFD_RESPONSE_CODE;
  }

<MATCH_STRING_STATE>[^ \r\n][^\r\n]+/"\r\n" {
    BEGIN(INITIAL);
    yylval->sval = new std::string(yytext);
    return WFD_STRING;
  }

<SUPPORTED_METHODS_STATE>"OPTIONS" {
    return WFD_OPTIONS;
  }

<SUPPORTED_METHODS_STATE>"SET_PARAMETER" {
    return WFD_SET_PARAMETER;
  }

<SUPPORTED_METHODS_STATE>"GET_PARAMETER" {
    return WFD_GET_PARAMETER;
  }

<SUPPORTED_METHODS_STATE>"SETUP" {
    return WFD_SETUP;
  }

<SUPPORTED_METHODS_STATE>"PLAY" {
    return WFD_PLAY;
  }

<SUPPORTED_METHODS_STATE>"TEARDOWN" {
    return WFD_TEARDOWN;
  }

<SUPPORTED_METHODS_STATE>"PAUSE" {
    return WFD_PAUSE;
  }

<SUPPORTED_METHODS_STATE>"org.wfa.wfd1.0" {
  return WFD_TAG;
  }

<CONTENT_TYPE_STATE>[-[:alnum:]]+\/[-[:alnum:]]+ {
    BEGIN(INITIAL);
    yylval->sval = new std::string(yytext);
    return WFD_MIME;
  }

{DIGITS} {
    std::string str(yytext, yyleng);
    str += '\0';
    errno = 0;
    yylval->nval = strtoull(str.c_str(), NULL, 10);
    if (errno)
      yyterminate();
    return WFD_NUM;
  }

  /* RTSP request rule,  e.g., OPTIONS * RTSP/1.0 */
"RTSP/"{DIGIT}"."{DIGIT} {
    return WFD_END;
  }

  /* GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0 */
"rtsp://"[^ \t\n]+ {
    yylval->sval = new std::string(yytext);
    return WFD_REQUEST_URI;
  }

 /* all unmatched */
<*>. {}
%%


================================================
FILE: libwds/rtsp/i2c.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/i2c.h"

namespace wds {
namespace rtsp {

I2C::I2C(int port) : Property(I2CPropertyType), port_(port) {
}

I2C::~I2C() {
}

std::string I2C::ToString() const {
  std::string ret = PropertyName::wfd_I2C + std::string(SEMICOLON)
    + std::string(SPACE) + (is_supported() ? std::to_string(port()) : NONE);
  return ret;
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/i2c.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_I2C_H_
#define LIBWDS_RTSP_I2C_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class I2C: public Property {
 public:
  explicit I2C(int port);
  ~I2C() override;

  bool is_supported() const { return port_ > 0; }
  int port() const { return port_; }
  std::string ToString() const override;

 private:
  int port_;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_I2C_H_


================================================
FILE: libwds/rtsp/idrrequest.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/idrrequest.h"

namespace wds {
namespace rtsp {

IDRRequest::IDRRequest() : Property(IDRRequestPropertyType) {
}

IDRRequest::~IDRRequest() {
}

std::string IDRRequest::ToString() const {
  return std::string("wfd_idr_request");
}

}  // namespace rtsp
}  // namespace wds


================================================
FILE: libwds/rtsp/idrrequest.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_IDRREQUEST_H_
#define LIBWDS_RTSP_IDRREQUEST_H_

#include "libwds/rtsp/property.h"

namespace wds {
namespace rtsp {

class IDRRequest: public Property {
public:
  IDRRequest();
  ~IDRRequest() override;

  std::string ToString() const override;
};

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_IDRREQUEST_H_


================================================
FILE: libwds/rtsp/macros.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_MACROS_H_
#define LIBWDS_RTSP_MACROS_H_

#include <stdio.h>

#define MAKE_HEX_STRING_2(NAME, PROPERTY) \
  char NAME[3]; \
  std::snprintf(NAME, sizeof(NAME), "%02X", PROPERTY) \

#define MAKE_HEX_STRING_4(NAME, PROPERTY) \
  char NAME[5]; \
  std::snprintf(NAME, sizeof(NAME), "%04X", PROPERTY) \

#define MAKE_HEX_STRING_6(NAME, PROPERTY) \
  char NAME[7]; \
  std::snprintf(NAME, sizeof(NAME), "%06X", PROPERTY) \

#define MAKE_HEX_STRING_8(NAME, PROPERTY) \
  char NAME[9]; \
  std::snprintf(NAME, sizeof(NAME), "%08X", PROPERTY) \

#define MAKE_HEX_STRING_10(NAME, PROPERTY) \
  char NAME[11]; \
  std::snprintf(NAME, sizeof(NAME), "%010llX", PROPERTY) \

#define MAKE_HEX_STRING_12(NAME, PROPERTY) \
  char NAME[13]; \
  std::snprintf(NAME, sizeof(NAME), "%012llX", PROPERTY) \

#define MAKE_HEX_STRING_16(NAME, PROPERTY) \
  char NAME[17]; \
  std::snprintf(NAME, sizeof(NAME), "%016llX", PROPERTY) \

#endif  // LIBWDS_RTSP_MACROS_H_



================================================
FILE: libwds/rtsp/message.cpp
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#include "libwds/rtsp/message.h"

#include <cassert>

namespace wds {
namespace rtsp {

namespace {
  const char kDefaultContentType[] = "text/parameters";
}

Message::Message(Type type)
  : type_(type) {
}

Message::~Message() {
}

int Message::cseq() const {
  assert(header_);
  return header_->cseq();
}

Header& Message::header() {
  if (!header_)
    header_.reset(new Header());
  return *header_;
}

std::string Message::ToString() const {
  std::string ret;
  if (payload_)
    ret = payload_->ToString();

  if (header_) {
    header_->set_content_length (ret.length());
    if(ret.length() > 0 && header_->content_type().length() == 0)
        header_->set_content_type (kDefaultContentType);
    ret = header_->ToString() + ret;
  }

  return ret;
}

Request::Request(RTSPMethod method, const std::string& request_uri)
  : Message(REQUEST),
    id_(UNKNOWN),
    method_(method),
    request_uri_(request_uri) {
}

Request::~Request() {
}

} // namespace rtsp
} // namespace wds


================================================
FILE: libwds/rtsp/message.h
================================================
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */


#ifndef LIBWDS_RTSP_MESSAGE_H_
#define LIBWDS_RTSP_MESSAGE_H_

#include <memory>

#include "libwds/rtsp/header.h"
#include "libwds/rtsp/payload.h"

namespace wds {
namespace rtsp {

class Message {
 public:
  enum Type {
    REQUEST,
    REPLY
  };

  explicit Message(Type type);
  virtual ~Message();

  bool is_reply() const { return type_ == REPLY; }
  bool is_request() const { return type_ == REQUEST; }

  int cseq() const;

  void set_header(std::unique_ptr<Header> header) {
    header_ = std::move(header);
  }

  Header& header();

  void set_payload(std::unique_ptr<Payload> payload) {
    payload_ = std::move(payload);
  }

  Payload* payload() { return payload_.get(); }

  virtual std::string ToString() const;

 protected:
  std::unique_ptr<Header> header_;
  std::unique_ptr<Payload> payload_;

 private:
  Type type_;
};

class Request : public Message {
 public:
  enum ID {
    UNKNOWN, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14,
    M15, M16
  };

  enum RTSPMethod {
    MethodOptions = 1,
    MethodSetParameter,
    MethodGetParameter,
    MethodSetup,
    MethodPlay,
    MethodTeardown,
    MethodPause
  };

  Request(RTSPMethod method, const std::string& request_uri = std::string());
  ~Request() override;

  const std::string& request_uri() const { return request_uri_; }
  void set_request_uri(const std::string& request_uri) {
    request_uri_ = request_uri;
  }

  ID id() const { return id_; }
  void set_id(ID id) { id_ = id; }

  RTSPMethod method() const { return method_; }
  void set_method(RTSPMethod method) { method_ = method; }

 private:
  ID id_;
  RTSPMethod method_;
  std::string request_uri_;
};

inline Request* ToRequest(Message* message) {
  return static_cast<Request*>(message);
}

}  // namespace rtsp
}  // namespace wds

#endif  // LIBWDS_RTSP_MESSAGE_H_


================================================
FILE: libwds/rtsp/messagelexer.l
================================================
%option nodefault nounput nomain
%option bison-bridge reentrant noyywrap
%option never-interactive
%option warn stack noyy_top_state noyy_pop_state noyy_push_state
%option case-insensitive
%option extra-type="bool"
%option outfile="gen/messagescanner.cpp" header-file="gen/messagescanner.h"

%top{
/*
 * This file is part of Wireless Display Software for Linux OS
 *
 * Copyright (C) 2015 Intel Corporation.
 *
 * This library 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.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <stdint.h>

#define YY_NO_UNISTD_H 1
}

%{
#include <string>

#include "parser.h"
#define yyterminate() return(END)
%}

%x MATCH_STRING_STATE
%x MATCH_RESPONSE_CODE_STATE

%s SUPPORTED_METHODS_STATE
%s CONTENT_TYPE_STATE
%s SESSION_STATE
%s MATCH_PRESENTATION_
Download .txt
gitextract_id6ruww0/

├── CMakeLists.txt
├── COPYING
├── README.md
├── TODO
├── data/
│   ├── CMakeLists.txt
│   └── wds.pc.in
├── datadumps/
│   ├── gstreamer-pipelines.txt
│   ├── information-elements.pcapng
│   └── rtsp-capture-win8.txt
├── desktop_source/
│   ├── CMakeLists.txt
│   ├── desktop_media_manager.cpp
│   ├── desktop_media_manager.h
│   ├── main.cpp
│   ├── mirac_broker_source.cpp
│   ├── mirac_broker_source.h
│   ├── source-app.cpp
│   └── source-app.h
├── libwds/
│   ├── CMakeLists.txt
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── logging.cpp
│   │   ├── message_handler.cpp
│   │   ├── message_handler.h
│   │   ├── rtsp_input_handler.cpp
│   │   ├── rtsp_input_handler.h
│   │   └── video_format.cpp
│   ├── public/
│   │   ├── audio_codec.h
│   │   ├── connector_type.h
│   │   ├── logging.h
│   │   ├── media_manager.h
│   │   ├── peer.h
│   │   ├── sink.h
│   │   ├── source.h
│   │   ├── video_format.h
│   │   └── wds_export.h
│   ├── rtsp/
│   │   ├── CMakeLists.txt
│   │   ├── audiocodecs.cpp
│   │   ├── audiocodecs.h
│   │   ├── avformatchangetiming.cpp
│   │   ├── avformatchangetiming.h
│   │   ├── clientrtpports.cpp
│   │   ├── clientrtpports.h
│   │   ├── connectortype.cpp
│   │   ├── connectortype.h
│   │   ├── constants.h
│   │   ├── contentprotection.cpp
│   │   ├── contentprotection.h
│   │   ├── coupledsink.cpp
│   │   ├── coupledsink.h
│   │   ├── displayedid.cpp
│   │   ├── displayedid.h
│   │   ├── driver.cpp
│   │   ├── driver.h
│   │   ├── errorlexer.l
│   │   ├── formats3d.cpp
│   │   ├── formats3d.h
│   │   ├── genericproperty.cpp
│   │   ├── genericproperty.h
│   │   ├── getparameter.cpp
│   │   ├── getparameter.h
│   │   ├── header.cpp
│   │   ├── header.h
│   │   ├── headerlexer.l
│   │   ├── i2c.cpp
│   │   ├── i2c.h
│   │   ├── idrrequest.cpp
│   │   ├── idrrequest.h
│   │   ├── macros.h
│   │   ├── message.cpp
│   │   ├── message.h
│   │   ├── messagelexer.l
│   │   ├── messages_rules.txt
│   │   ├── options.cpp
│   │   ├── options.h
│   │   ├── parser.ypp
│   │   ├── pause.cpp
│   │   ├── pause.h
│   │   ├── payload.cpp
│   │   ├── payload.h
│   │   ├── play.cpp
│   │   ├── play.h
│   │   ├── preferreddisplaymode.cpp
│   │   ├── preferreddisplaymode.h
│   │   ├── presentationurl.cpp
│   │   ├── presentationurl.h
│   │   ├── property.cpp
│   │   ├── property.h
│   │   ├── propertyerrors.cpp
│   │   ├── propertyerrors.h
│   │   ├── reply.cpp
│   │   ├── reply.h
│   │   ├── route.cpp
│   │   ├── route.h
│   │   ├── setparameter.cpp
│   │   ├── setparameter.h
│   │   ├── setup.cpp
│   │   ├── setup.h
│   │   ├── standby.cpp
│   │   ├── standby.h
│   │   ├── standbyresumecapability.cpp
│   │   ├── standbyresumecapability.h
│   │   ├── teardown.cpp
│   │   ├── teardown.h
│   │   ├── tests/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README
│   │   │   ├── dict/
│   │   │   │   ├── wfd_header.dict
│   │   │   │   ├── wfd_payload_error.dict
│   │   │   │   ├── wfd_payload_reply.dict
│   │   │   │   └── wfd_payload_request.dict
│   │   │   ├── run_afl_fuzzer.sh
│   │   │   ├── seed/
│   │   │   │   ├── header/
│   │   │   │   │   ├── error.txt
│   │   │   │   │   ├── get_parameter.txt
│   │   │   │   │   ├── options.txt
│   │   │   │   │   ├── pause.txt
│   │   │   │   │   ├── play.txt
│   │   │   │   │   ├── reply.txt
│   │   │   │   │   ├── set_parameter.txt
│   │   │   │   │   ├── setup.txt
│   │   │   │   │   └── teardown.txt
│   │   │   │   ├── payload_error/
│   │   │   │   │   ├── payload_error01.txt
│   │   │   │   │   └── payload_error02.txt
│   │   │   │   ├── payload_reply/
│   │   │   │   │   ├── payload_reply01.txt
│   │   │   │   │   └── payload_reply02.txt
│   │   │   │   └── payload_request/
│   │   │   │       ├── payload_request01.txt
│   │   │   │       └── payload_request02.txt
│   │   │   ├── tests.cpp
│   │   │   └── wdsfuzzer.cpp
│   │   ├── transportheader.cpp
│   │   ├── transportheader.h
│   │   ├── triggermethod.cpp
│   │   ├── triggermethod.h
│   │   ├── uibccapability.cpp
│   │   ├── uibccapability.h
│   │   ├── uibcsetting.cpp
│   │   ├── uibcsetting.h
│   │   ├── videoformats.cpp
│   │   └── videoformats.h
│   ├── sink/
│   │   ├── CMakeLists.txt
│   │   ├── cap_negotiation_state.cpp
│   │   ├── cap_negotiation_state.h
│   │   ├── init_state.cpp
│   │   ├── init_state.h
│   │   ├── session_state.cpp
│   │   ├── session_state.h
│   │   ├── sink.cpp
│   │   ├── streaming_state.cpp
│   │   └── streaming_state.h
│   └── source/
│       ├── CMakeLists.txt
│       ├── cap_negotiation_state.cpp
│       ├── cap_negotiation_state.h
│       ├── init_state.cpp
│       ├── init_state.h
│       ├── session_state.cpp
│       ├── session_state.h
│       ├── source.cpp
│       ├── streaming_state.cpp
│       └── streaming_state.h
├── mirac_network/
│   ├── CMakeLists.txt
│   ├── gst-test.cpp
│   ├── mirac-broker.cpp
│   ├── mirac-broker.hpp
│   ├── mirac-exception.hpp
│   ├── mirac-glib-logging.cpp
│   ├── mirac-glib-logging.hpp
│   ├── mirac-gst-bus-handler.cpp
│   ├── mirac-gst-bus-handler.hpp
│   ├── mirac-gst-sink.cpp
│   ├── mirac-gst-sink.hpp
│   ├── mirac-gst-test-source.cpp
│   ├── mirac-gst-test-source.hpp
│   ├── mirac-network.cpp
│   ├── mirac-network.hpp
│   └── network-test.cpp
├── p2p/
│   ├── CMakeLists.txt
│   ├── connman-client.cpp
│   ├── connman-client.h
│   ├── connman-peer.cpp
│   ├── connman-peer.h
│   ├── information-element.cpp
│   ├── information-element.h
│   ├── main.cpp
│   └── test-ie.cpp
├── rtsp-message-exchanges.txt
└── sink/
    ├── CMakeLists.txt
    ├── gst_sink_media_manager.cpp
    ├── gst_sink_media_manager.h
    ├── main.cpp
    ├── sink-app.cpp
    ├── sink-app.h
    ├── sink.cpp
    └── sink.h
Download .txt
SYMBOL INDEX (381 symbols across 135 files)

FILE: desktop_source/desktop_media_manager.cpp
  function GetH264VideoCodecs (line 74) | std::vector<wds::H264VideoCodec> GetH264VideoCodecs() {

FILE: desktop_source/desktop_media_manager.h
  function class (line 29) | class DesktopMediaManager : public wds::SourceMediaManager {

FILE: desktop_source/main.cpp
  function gboolean (line 33) | static gboolean _sig_handler (gpointer data_ptr)
  function parse_input_and_call_source (line 42) | static void parse_input_and_call_source(
  function gboolean (line 66) | static gboolean _user_input_handler (
  function main (line 92) | int main (int argc, char *argv[])

FILE: desktop_source/mirac_broker_source.h
  function namespace (line 29) | namespace wds {
  function class (line 34) | class MiracBrokerSource : public MiracBroker {

FILE: desktop_source/source-app.h
  function MiracBrokerSource (line 36) | MiracBrokerSource* source() { return source_.get(); }

FILE: libwds/common/logging.cpp
  type wds (line 24) | namespace wds {
    function Dummy (line 26) | static void Dummy(const char*, ...) {}

FILE: libwds/common/message_handler.cpp
  type wds (line 27) | namespace wds {

FILE: libwds/common/message_handler.h
  function MessageHandlerPtr (line 48) | inline MessageHandlerPtr make_ptr(MessageHandler* handler) {
  function class (line 52) | class MessageHandler : public std::enable_shared_from_this<MessageHandle...
  function Start (line 133) | void Start() override;

FILE: libwds/common/rtsp_input_handler.cpp
  type wds (line 29) | namespace wds {

FILE: libwds/common/rtsp_input_handler.h
  function namespace (line 28) | namespace wds {

FILE: libwds/common/video_format.cpp
  type wds (line 30) | namespace wds {
    type QualityInfo (line 35) | struct QualityInfo {
    function QualityInfo (line 114) | QualityInfo get_cea_info(const H264VideoFormat& format) {
    function QualityInfo (line 119) | QualityInfo get_vesa_info(const H264VideoFormat& format) {
    function QualityInfo (line 124) | QualityInfo get_hh_info(const H264VideoFormat& format) {
    function QualityInfo (line 129) | QualityInfo get_quality_info(const H264VideoFormat& format) {
    function get_resolution (line 148) | std::pair<unsigned, unsigned> get_resolution(const H264VideoFormat& fo...
    function video_format_sort_func (line 153) | bool video_format_sort_func(const H264VideoFormat& a, const H264VideoF...
    function PopulateVideoFormatList (line 162) | void PopulateVideoFormatList(
    function PopulateVideoFormatList (line 179) | void PopulateVideoFormatList(
    function H264VideoFormat (line 189) | H264VideoFormat FindOptimalVideoFormat(

FILE: libwds/public/audio_codec.h
  function namespace (line 27) | namespace wds {

FILE: libwds/public/connector_type.h
  function namespace (line 25) | namespace wds {

FILE: libwds/public/logging.h
  function namespace (line 29) | namespace wds {

FILE: libwds/public/media_manager.h
  type SessionType (line 34) | enum SessionType {
  function class (line 51) | class MediaManager {
  function class (line 92) | class SinkMediaManager : public MediaManager {

FILE: libwds/public/peer.h
  function namespace (line 29) | namespace wds {

FILE: libwds/public/sink.h
  function namespace (line 27) | namespace wds {

FILE: libwds/public/source.h
  function namespace (line 27) | namespace wds {

FILE: libwds/public/video_format.h
  function namespace (line 30) | namespace wds {

FILE: libwds/rtsp/audiocodecs.cpp
  type wds (line 29) | namespace wds {
    type rtsp (line 30) | namespace rtsp {
      function ToString (line 34) | std::string ToString(const wds::AudioCodec& codec) {

FILE: libwds/rtsp/audiocodecs.h
  function namespace (line 31) | namespace wds {

FILE: libwds/rtsp/avformatchangetiming.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/avformatchangetiming.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/clientrtpports.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/clientrtpports.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/connectortype.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/connectortype.h
  function namespace (line 29) | namespace wds {

FILE: libwds/rtsp/constants.h
  function namespace (line 26) | namespace wds {

FILE: libwds/rtsp/contentprotection.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/contentprotection.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/coupledsink.cpp
  type wds (line 28) | namespace wds {
    type rtsp (line 29) | namespace rtsp {

FILE: libwds/rtsp/coupledsink.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/displayedid.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/displayedid.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/driver.cpp
  function wds_lex (line 36) | int wds_lex(YYSTYPE* yylval, void* scanner,
  function wds_error (line 51) | void wds_error(void* scanner, std::unique_ptr<wds::rtsp::Message>& message,
  type wds (line 57) | namespace wds {
    type rtsp (line 58) | namespace rtsp {

FILE: libwds/rtsp/driver.h
  function namespace (line 31) | namespace wds {

FILE: libwds/rtsp/formats3d.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/formats3d.h
  function namespace (line 30) | namespace wds {

FILE: libwds/rtsp/genericproperty.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/genericproperty.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/getparameter.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/getparameter.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/header.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {
      function TransportHeader (line 91) | TransportHeader& Header::transport() const {
      function GenericHeaderMap (line 117) | const GenericHeaderMap& Header::generic_headers() const {

FILE: libwds/rtsp/header.h
  type std (line 34) | typedef std::map<std::string, std::string> GenericHeaderMap;
  function namespace (line 36) | namespace wds {

FILE: libwds/rtsp/i2c.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/i2c.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/idrrequest.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/idrrequest.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/message.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {
      function Header (line 46) | Header& Message::header() {

FILE: libwds/rtsp/message.h
  function namespace (line 31) | namespace wds {

FILE: libwds/rtsp/options.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/options.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/pause.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/pause.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/payload.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/payload.h
  function namespace (line 37) | namespace wds {

FILE: libwds/rtsp/play.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/play.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/preferreddisplaymode.cpp
  type wds (line 27) | namespace wds {
    type rtsp (line 28) | namespace rtsp {

FILE: libwds/rtsp/preferreddisplaymode.h
  function namespace (line 30) | namespace wds {

FILE: libwds/rtsp/presentationurl.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/presentationurl.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/property.cpp
  type wds (line 26) | namespace wds {
    type rtsp (line 27) | namespace rtsp {
      function GetPropertyName (line 52) | std::string GetPropertyName(PropertyType type) {

FILE: libwds/rtsp/property.h
  function namespace (line 31) | namespace wds {

FILE: libwds/rtsp/propertyerrors.cpp
  type wds (line 28) | namespace wds {
    type rtsp (line 29) | namespace rtsp {

FILE: libwds/rtsp/propertyerrors.h
  function namespace (line 30) | namespace wds {

FILE: libwds/rtsp/reply.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/reply.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/route.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/route.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/setparameter.cpp
  type wds (line 26) | namespace wds {
    type rtsp (line 27) | namespace rtsp {

FILE: libwds/rtsp/setparameter.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/setup.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/setup.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/standby.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/standby.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/standbyresumecapability.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/standbyresumecapability.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/teardown.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/teardown.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/tests/tests.cpp
  function property_type_exists (line 87) | static bool property_type_exists (std::vector<std::string> properties,
  function test_audio_codec (line 95) | static bool test_audio_codec (wds::AudioCodec codec, wds::AudioFormats f...
  function test_h264_codec_3d (line 105) | static bool test_h264_codec_3d (wds::rtsp::H264Codec3d codec,
  function test_valid_options (line 123) | static bool test_valid_options ()
  function test_valid_options_reply (line 142) | static bool test_valid_options_reply ()
  function test_valid_extra_properties (line 178) | static bool test_valid_extra_properties ()
  function test_valid_extra_errors (line 218) | static bool test_valid_extra_errors ()
  function test_valid_extra_properties_in_get (line 258) | static bool test_valid_extra_properties_in_get ()
  function test_valid_get_parameter (line 288) | static bool test_valid_get_parameter ()
  function test_valid_get_parameter_reply_with_all_none (line 338) | static bool test_valid_get_parameter_reply_with_all_none ()
  function test_valid_get_parameter_reply (line 452) | static bool test_valid_get_parameter_reply ()
  function test_invalid_property_value (line 561) | static bool test_invalid_property_value ()
  function test_case_insensitivity (line 580) | static bool test_case_insensitivity ()
  function test_valid_get_parameter_reply_with_errors (line 618) | static bool test_valid_get_parameter_reply_with_errors ()
  function test_valid_set_parameter (line 658) | static bool test_valid_set_parameter ()
  function test_valid_set_parameter_url_with_port (line 720) | static bool test_valid_set_parameter_url_with_port ()
  function test_valid_set_parameter_with_all_ipv4_url (line 753) | static bool test_valid_set_parameter_with_all_ipv4_url ()
  function test_valid_setup (line 791) | static bool test_valid_setup ()
  function test_valid_setup_reply (line 820) | static bool test_valid_setup_reply ()
  function test_valid_play (line 850) | static bool test_valid_play ()
  function test_number_conversion_header (line 873) | static bool test_number_conversion_header()
  function test_number_conversion_body (line 884) | static bool test_number_conversion_body()
  function test_hex_number_conversion_body (line 901) | static bool test_hex_number_conversion_body()
  function test_hex_number_conversion_body_2 (line 918) | static bool test_hex_number_conversion_body_2()
  function test_number_conversion_in_errors (line 935) | static bool test_number_conversion_in_errors ()
  function main (line 954) | int main(const int argc, const char **argv)

FILE: libwds/rtsp/tests/wdsfuzzer.cpp
  function PrintError (line 41) | int PrintError(const char* program) {
  function GetBufferFromStdin (line 48) | std::string GetBufferFromStdin(int num_lines) {
  function GetBufferFromFile (line 59) | std::string GetBufferFromFile(const std::string& file) {
  function main (line 72) | int main(const int argc, const char **argv)

FILE: libwds/rtsp/transportheader.cpp
  type wds (line 26) | namespace wds {
    type rtsp (line 27) | namespace rtsp {

FILE: libwds/rtsp/transportheader.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/triggermethod.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/triggermethod.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/uibccapability.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/uibccapability.h
  function namespace (line 31) | namespace wds {

FILE: libwds/rtsp/uibcsetting.cpp
  type wds (line 25) | namespace wds {
    type rtsp (line 26) | namespace rtsp {

FILE: libwds/rtsp/uibcsetting.h
  function namespace (line 28) | namespace wds {

FILE: libwds/rtsp/videoformats.cpp
  type wds (line 28) | namespace wds {
    type rtsp (line 29) | namespace rtsp {
      function EnumListToMask (line 33) | unsigned int EnumListToMask(const std::vector<EnumType>& from) {
      function EnumType (line 139) | EnumType MaskToEnum(ArgType from, EnumType biggest_value) {
      function MaskToEnumList (line 155) | std::vector<EnumType> MaskToEnumList(ArgType from, EnumType biggest_...
      function H264Profile (line 175) | inline H264Profile ToH264Profile(unsigned char profile) {
      function H264Level (line 179) | inline H264Level ToH264Level(unsigned char level) {
      function H264VideoCodec (line 185) | H264VideoCodec H264Codec::ToH264VideoCodec() const {
      function NativeVideoFormat (line 233) | NativeVideoFormat GetFormatFromIndex(unsigned index, EnumType bigges...
      function NativeVideoFormat (line 242) | NativeVideoFormat VideoFormats::GetNativeFormat() const {

FILE: libwds/rtsp/videoformats.h
  function namespace (line 31) | namespace wds {

FILE: libwds/sink/cap_negotiation_state.cpp
  type wds (line 46) | namespace wds {
    type sink (line 52) | namespace sink {
      class M5Handler (line 171) | class M5Handler final : public MessageReceiver<Request::M5> {
        method M5Handler (line 173) | M5Handler(const InitParams& init_params)
        method HandleMessage (line 176) | std::unique_ptr<Reply> HandleMessage(Message* message) override {

FILE: libwds/sink/cap_negotiation_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/sink/init_state.cpp
  type wds (line 27) | namespace wds {
    type sink (line 28) | namespace sink {
      class M1Handler (line 33) | class M1Handler final : public MessageReceiver<Request::M1> {
        method M1Handler (line 35) | M1Handler(const InitParams& init_params, int& source_init_cseq)
        method HandleMessage (line 39) | virtual std::unique_ptr<Reply> HandleMessage(Message* message) ove...
      class M2Handler (line 54) | class M2Handler final : public SequencedMessageSender {
        method M2Handler (line 56) | M2Handler(const InitParams& init_params, int& source_init_cseq)
        method CreateMessage (line 61) | virtual std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 68) | virtual bool HandleReply(Reply* reply) override {

FILE: libwds/sink/init_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/sink/session_state.cpp
  type wds (line 33) | namespace wds {
    type sink (line 38) | namespace sink {
      class M7Handler (line 84) | class M7Handler final : public SequencedMessageSender {
        method CreateMessage (line 88) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 97) | bool HandleReply(Reply* reply) override {

FILE: libwds/sink/session_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/sink/sink.cpp
  type wds (line 37) | namespace wds {
    function InitializeRequestId (line 45) | bool InitializeRequestId(Request* request) {
    class SinkStateMachine (line 80) | class SinkStateMachine : public MessageSequenceHandler {
      method SinkStateMachine (line 82) | SinkStateMachine(const InitParams& init_params)
      method SinkStateMachine (line 93) | SinkStateMachine(Peer::Delegate* sender, SinkMediaManager* mng)
    class SinkImpl (line 100) | class SinkImpl final : public Sink, public RTSPInputHandler, public Me...
    function Sink (line 215) | Sink* Sink::Create(Delegate* delegate, SinkMediaManager* mng) {

FILE: libwds/sink/streaming_state.cpp
  type wds (line 34) | namespace wds {
    type sink (line 40) | namespace sink {
      class M5Handler (line 43) | class M5Handler final : public MessageReceiver<Request::M5> {
        method M5Handler (line 45) | explicit M5Handler(const InitParams& init_params)
        method CanHandle (line 49) | bool CanHandle(Message* message) const override {
        method HandleMessage (line 63) | std::unique_ptr<Reply> HandleMessage(Message* message) override {
      class M7Sender (line 68) | class M7Sender final : public SequencedMessageSender {
        method CreateMessage (line 72) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 79) | bool HandleReply(Reply* reply) override {
      class PlayHandler (line 88) | class PlayHandler : public MessageSequenceHandler {
        method PlayHandler (line 90) | explicit PlayHandler(const InitParams& init_params)
      class M8Sender (line 97) | class M8Sender final : public SequencedMessageSender {
        method CreateMessage (line 101) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 108) | bool HandleReply(Reply* reply) override {
      class M9Sender (line 124) | class M9Sender final : public SequencedMessageSender {
        method CreateMessage (line 128) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 135) | bool HandleReply(Reply* reply) override {
      class PauseHandler (line 144) | class PauseHandler : public MessageSequenceHandler {
        method PauseHandler (line 146) | explicit PauseHandler(const InitParams& init_params)
      class M7SenderOptional (line 153) | class M7SenderOptional final : public OptionalMessageSender<Request:...
        method M7SenderOptional (line 155) | M7SenderOptional(const InitParams& init_params)
        method HandleReply (line 159) | bool HandleReply(Reply* reply) override {
        method CanSend (line 167) | bool CanSend(Message* message) const override {
      class M8SenderOptional (line 175) | class M8SenderOptional final : public OptionalMessageSender<Request:...
        method M8SenderOptional (line 177) | M8SenderOptional(const InitParams& init_params)
        method HandleReply (line 181) | bool HandleReply(Reply* reply) override {
      class M9SenderOptional (line 192) | class M9SenderOptional final : public OptionalMessageSender<Request:...
        method M9SenderOptional (line 194) | M9SenderOptional(const InitParams& init_params)
        method HandleReply (line 198) | bool HandleReply(Reply* reply) override {
        method CanSend (line 206) | bool CanSend(Message* message) const override {

FILE: libwds/sink/streaming_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/source/cap_negotiation_state.cpp
  type wds (line 34) | namespace wds {
    type source (line 47) | namespace source {
      class M3Handler (line 49) | class M3Handler final : public SequencedMessageSender {
      class M4Handler (line 58) | class M4Handler final : public SequencedMessageSender {

FILE: libwds/source/cap_negotiation_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/source/init_state.cpp
  type wds (line 27) | namespace wds {
    type source (line 33) | namespace source {
      class M1Handler (line 35) | class M1Handler final : public SequencedMessageSender {
        method CreateMessage (line 39) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 46) | bool HandleReply(Reply* reply) override {
      class M2Handler (line 52) | class M2Handler final : public MessageReceiver<Request::M2> {
        method M2Handler (line 54) | M2Handler(const InitParams& init_params)
        method HandleMessage (line 57) | std::unique_ptr<Reply> HandleMessage(

FILE: libwds/source/init_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/source/session_state.cpp
  type wds (line 30) | namespace wds {
    type source (line 37) | namespace source {
      class M5Handler (line 39) | class M5Handler final : public SequencedMessageSender {
        method CreateMessage (line 44) | std::unique_ptr<Message> CreateMessage() override {
        method HandleReply (line 54) | bool HandleReply(Reply* reply) override {
      class M6Handler (line 60) | class M6Handler final : public MessageReceiver<Request::M6> {
        method M6Handler (line 62) | M6Handler(const InitParams& init_params, unsigned& timer_id)
        method HandleMessage (line 67) | std::unique_ptr<Reply> HandleMessage(
        method Handle (line 82) | void Handle(std::unique_ptr<Message> message) override {

FILE: libwds/source/session_state.h
  function namespace (line 27) | namespace wds {

FILE: libwds/source/source.cpp
  type wds (line 36) | namespace wds {
    function InitializeRequestId (line 44) | bool InitializeRequestId(Request* request) {
    class SourceStateMachine (line 89) | class SourceStateMachine : public MessageSequenceHandler {
      method SourceStateMachine (line 91) | SourceStateMachine(const InitParams& init_params, unsigned& timer_id)
    class SourceImpl (line 101) | class SourceImpl final : public Source, public RTSPInputHandler, publi...
    function CreateM5 (line 179) | std::unique_ptr<Message> CreateM5(int send_cseq, rtsp::TriggerMethod::...
    function Source (line 257) | Source* Source::Create(Delegate* delegate, SourceMediaManager* mng, Pe...

FILE: libwds/source/streaming_state.cpp
  type wds (line 29) | namespace wds {
    type source (line 35) | namespace source {
      class M8Handler (line 37) | class M8Handler final : public MessageReceiver<rtsp::Request::M8> {
        method M8Handler (line 39) | M8Handler(const InitParams& init_params)
        method HandleMessage (line 44) | std::unique_ptr<rtsp::Reply> HandleMessage(
      class M9Handler (line 51) | class M9Handler final : public MessageReceiver<Request::M9> {
        method M9Handler (line 53) | M9Handler(const InitParams& init_params)
        method HandleMessage (line 57) | std::unique_ptr<Reply> HandleMessage(
      class M5Sender (line 68) | class M5Sender final : public OptionalMessageSender<Request::M5> {
        method M5Sender (line 70) | M5Sender(const InitParams& init_params)
        method HandleReply (line 73) | bool HandleReply(Reply* reply) override {
      class M13Handler (line 78) | class M13Handler final : public MessageReceiver<Request::M13> {
        method M13Handler (line 80) | M13Handler(const InitParams& init_params)
        method HandleMessage (line 84) | std::unique_ptr<Reply> HandleMessage(

FILE: libwds/source/streaming_state.h
  function namespace (line 27) | namespace wds {

FILE: mirac_network/gst-test.cpp
  function gboolean (line 35) | static gboolean _sig_handler (gpointer data_ptr)
  function main (line 45) | int main (int argc, char *argv[])

FILE: mirac_network/mirac-broker.cpp
  type TimerCallbackData (line 28) | struct TimerCallbackData {
    method TimerCallbackData (line 29) | TimerCallbackData(MiracBroker* delegate)
  function gboolean (line 36) | gboolean MiracBroker::send_cb (gint fd, GIOCondition condition, gpointer...
  function gboolean (line 43) | gboolean MiracBroker::receive_cb (gint fd, GIOCondition condition, gpoin...
  function gboolean (line 50) | gboolean MiracBroker::listen_cb (gint fd, GIOCondition condition, gpoint...
  function gboolean (line 57) | gboolean MiracBroker::connect_cb (gint fd, GIOCondition condition, gpoin...
  function gboolean (line 64) | gboolean MiracBroker::try_connect (gpointer data_ptr)
  function gboolean (line 71) | gboolean MiracBroker::send_cb (gint fd, GIOCondition condition)
  function gboolean (line 85) | gboolean MiracBroker::receive_cb (gint fd, GIOCondition condition)
  function gboolean (line 100) | gboolean MiracBroker::listen_cb (gint fd, GIOCondition condition)
  function gboolean (line 113) | gboolean MiracBroker::connect_cb (gint fd, GIOCondition condition)
  function gboolean (line 243) | static gboolean on_timeout(gpointer user_data) {
  function uint (line 253) | uint MiracBroker::CreateTimer(int seconds) {

FILE: mirac_network/mirac-broker.hpp
  class MiracBroker (line 34) | class MiracBroker : public wds::Peer::Delegate
    type ConnectionFailure (line 46) | enum ConnectionFailure {
    method got_message (line 58) | virtual void got_message(const std::string& data) {}

FILE: mirac_network/mirac-exception.hpp
  class MiracException (line 31) | class MiracException : public std::exception
    method MiracException (line 34) | MiracException () throw ()
    method MiracException (line 36) | MiracException (int error_code, const char *function = NULL) throw ()
    method MiracException (line 42) | MiracException (const char *error_msg, const char *function = NULL) th...
    method MiracException (line 47) | MiracException (int error_code, const char *error_msg, const char *fun...
    method add_func (line 67) | void add_func (const char *function) throw ()

FILE: mirac_network/mirac-glib-logging.cpp
  function MiracGlibLog (line 28) | void MiracGlibLog(const char* format, ...) {
  function MiracGlibVLog (line 35) | void MiracGlibVLog(const char* format, ...) {
  function MiracGlibWarning (line 42) | void MiracGlibWarning(const char* format, ...) {
  function MiracGlibError (line 49) | void MiracGlibError(const char* format, ...) {
  function InitGlibLogging (line 58) | void InitGlibLogging() {

FILE: mirac_network/mirac-gst-bus-handler.cpp
  function gboolean (line 26) | gboolean

FILE: mirac_network/mirac-gst-sink.cpp
  function _set_udp_caps (line 28) | void _set_udp_caps(GstElement *playbin, GstElement *source, gpointer    ...

FILE: mirac_network/mirac-gst-sink.hpp
  class MiracGstSink (line 28) | class MiracGstSink

FILE: mirac_network/mirac-gst-test-source.cpp
  function GstState (line 68) | GstState MiracGstTestSource::GetState() const

FILE: mirac_network/mirac-gst-test-source.hpp
  type wfd_test_stream_t (line 29) | enum wfd_test_stream_t {WFD_TEST_AUDIO, WFD_TEST_VIDEO, WFD_TEST_BOTH, W...
  class MiracGstTestSource (line 32) | class MiracGstTestSource

FILE: mirac_network/mirac-network.cpp
  type addrinfo (line 89) | struct addrinfo
  type addrinfo (line 99) | struct addrinfo
  type addrinfo (line 100) | struct addrinfo
  type addrinfo (line 101) | struct addrinfo
  function MiracNetwork (line 136) | MiracNetwork * MiracNetwork::Accept ()
  type addrinfo (line 158) | struct addrinfo
  type addrinfo (line 162) | struct addrinfo
  type addrinfo (line 174) | struct addrinfo
  type addrinfo (line 177) | struct addrinfo
  type addrinfo (line 177) | struct addrinfo
  type sockaddr (line 205) | struct sockaddr
  type sockaddr (line 208) | struct sockaddr
  type sockaddr (line 224) | struct sockaddr
  type sockaddr (line 227) | struct sockaddr
  type sockaddr (line 228) | struct sockaddr
  type sockaddr_in (line 231) | struct sockaddr_in
  type sockaddr_in (line 232) | struct sockaddr_in
  type sockaddr_in6 (line 237) | struct sockaddr_in6
  type sockaddr_in6 (line 238) | struct sockaddr_in6

FILE: mirac_network/mirac-network.hpp
  class MiracConnectionLostException (line 34) | class MiracConnectionLostException : public MiracException
    method MiracConnectionLostException (line 37) | MiracConnectionLostException (const char *function = NULL) throw ()
  class MiracNetwork (line 48) | class MiracNetwork
    method GetHandle (line 57) | int GetHandle () const

FILE: mirac_network/network-test.cpp
  function gboolean (line 33) | static gboolean _sig_handler (gpointer data_ptr)
  function gboolean (line 43) | static gboolean _send_cb (gint fd, GIOCondition condition,
  function gboolean (line 61) | static gboolean _receive_cb (gint fd, GIOCondition condition,
  function gboolean (line 86) | static gboolean _listen_cb (gint fd, GIOCondition condition, gpointer da...
  function gboolean (line 105) | static gboolean _sendmsg_cb (gint fd, GIOCondition condition, gpointer d...
  function gboolean (line 123) | static gboolean _connect_cb (gint fd, GIOCondition condition, gpointer d...
  function main (line 142) | int main (int argc, char *argv[])

FILE: p2p/connman-client.cpp
  type P2P (line 28) | namespace P2P {

FILE: p2p/connman-client.h
  function namespace (line 31) | namespace P2P {

FILE: p2p/connman-peer.cpp
  type P2P (line 28) | namespace P2P {

FILE: p2p/connman-peer.h
  function namespace (line 28) | namespace P2P {

FILE: p2p/information-element.cpp
  type P2P (line 29) | namespace P2P {
    function Subelement (line 31) | Subelement* new_subelement (SubelementId id)
    function delete_subelement (line 59) | void delete_subelement (Subelement *element)
    function DeviceType (line 116) | const DeviceType InformationElement::get_device_type() const

FILE: p2p/information-element.h
  function namespace (line 32) | namespace P2P {
  function class (line 144) | class InformationElement {

FILE: p2p/main.cpp
  function main (line 30) | int main (int argc, const char **argv)

FILE: p2p/test-ie.cpp
  function main (line 30) | int main (int argc, const char **argv)

FILE: sink/gst_sink_media_manager.h
  function class (line 30) | class GstSinkMediaManager : public wds::SinkMediaManager {

FILE: sink/main.cpp
  function gboolean (line 34) | static gboolean _sig_handler (gpointer data_ptr)
  function parse_input_and_call_sink (line 43) | static void parse_input_and_call_sink(
  function gboolean (line 60) | static gboolean _user_input_handler (
  function main (line 86) | int main (int argc, char *argv[])

FILE: sink/sink-app.h
  function on_availability_changed (line 40) | void on_availability_changed(P2P::Client *client) override {}
  function on_initialized (line 43) | void on_initialized(P2P::Peer *peer) override {}

FILE: sink/sink.h
  function class (line 32) | class Sink : public MiracBroker {
Condensed preview — 190 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (589K chars).
[
  {
    "path": "CMakeLists.txt",
    "chars": 547,
    "preview": "cmake_minimum_required(VERSION 2.8)\n\nproject(wds CXX)\n\nset(WDS_VERSION_MAJOR 1)\nset(WDS_VERSION_MINOR 1)\nset(WDS_VERSION"
  },
  {
    "path": "COPYING",
    "chars": 26522,
    "preview": "                  GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 2.1, February 1999\n\n Copyright (C) 19"
  },
  {
    "path": "README.md",
    "chars": 3854,
    "preview": "DISCONTINUATION OF PROJECT.\n\nThis project will no longer be maintained by Intel.\n\nIntel has ceased development and contr"
  },
  {
    "path": "TODO",
    "chars": 606,
    "preview": "GOAL: Make a release with the proper librarization by the time all dependencies are released, namely\n\ta. wpa_supplicant,"
  },
  {
    "path": "data/CMakeLists.txt",
    "chars": 153,
    "preview": "configure_file(wds.pc.in wds.pc @ONLY)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/wds.pc\n        DESTINATION lib/${CMAKE_"
  },
  {
    "path": "data/wds.pc.in",
    "chars": 332,
    "preview": "prefix=@CMAKE_INSTALL_PREFIX@\nexec_prefix=${prefix}\nlibdir=${prefix}/@CMAKE_INSTALL_LIBDIR@\nincludedir=${exec_prefix}/in"
  },
  {
    "path": "datadumps/gstreamer-pipelines.txt",
    "chars": 791,
    "preview": "WFD source:\n\n Only video:\n gst-launch-1.0 videotestsrc ! x264enc ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port="
  },
  {
    "path": "datadumps/rtsp-capture-win8.txt",
    "chars": 5659,
    "preview": "OPTIONS * RTSP/1.0\nCSeq: 1\nRequire: org.wfa.wfd1.0\nUser-Agent: WiDiApp/4.5.35.0 RDS/1.0.0\n\nRTSP/1.0 200 OK\nCSeq: 1\nDate:"
  },
  {
    "path": "desktop_source/CMakeLists.txt",
    "chars": 1069,
    "preview": "#FIXME in the future: with cmake 2.8.12 and up it's better\n#to use target_compile_options or add_compile_options\nset(CMA"
  },
  {
    "path": "desktop_source/desktop_media_manager.cpp",
    "chars": 3958,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/desktop_media_manager.h",
    "chars": 2120,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/main.cpp",
    "chars": 3931,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/mirac_broker_source.cpp",
    "chars": 1928,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/mirac_broker_source.h",
    "chars": 1576,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/source-app.cpp",
    "chars": 3148,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "desktop_source/source-app.h",
    "chars": 1786,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/CMakeLists.txt",
    "chars": 830,
    "preview": "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden\")\nset(CMAKE_C_FLAGS \"${CMAKE_CXX_FLAGS} -st"
  },
  {
    "path": "libwds/common/CMakeLists.txt",
    "chars": 370,
    "preview": "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC\")\nset(CMAKE_C_FLAGS \"${CMAKE_CXX_FLAG"
  },
  {
    "path": "libwds/common/logging.cpp",
    "chars": 1787,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2016 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/common/message_handler.cpp",
    "chars": 9582,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/common/message_handler.h",
    "chars": 7311,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/common/rtsp_input_handler.cpp",
    "chars": 2551,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/common/rtsp_input_handler.h",
    "chars": 1665,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/common/video_format.cpp",
    "chars": 8540,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/audio_codec.h",
    "chars": 1775,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/connector_type.h",
    "chars": 1163,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/logging.h",
    "chars": 2848,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/media_manager.h",
    "chars": 7542,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/peer.h",
    "chars": 4907,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/sink.h",
    "chars": 1423,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/source.h",
    "chars": 1526,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/video_format.h",
    "chars": 5892,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/public/wds_export.h",
    "chars": 1122,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/CMakeLists.txt",
    "chars": 2024,
    "preview": "#FIXME in the future: with cmake 2.8.12 and up it's better\n#to use target_compile_options or add_compile_options\nset(CMA"
  },
  {
    "path": "libwds/rtsp/audiocodecs.cpp",
    "chars": 2086,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/audiocodecs.h",
    "chars": 1472,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/avformatchangetiming.cpp",
    "chars": 1542,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/avformatchangetiming.h",
    "chars": 1501,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/clientrtpports.cpp",
    "chars": 1595,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/clientrtpports.h",
    "chars": 1473,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/connectortype.cpp",
    "chars": 1864,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/connectortype.h",
    "chars": 1493,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/constants.h",
    "chars": 3887,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/contentprotection.cpp",
    "chars": 1890,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/contentprotection.h",
    "chars": 1510,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/coupledsink.cpp",
    "chars": 1778,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/coupledsink.h",
    "chars": 1486,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/displayedid.cpp",
    "chars": 1700,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/displayedid.h",
    "chars": 1499,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/driver.cpp",
    "chars": 3079,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/driver.h",
    "chars": 1437,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/errorlexer.l",
    "chars": 3071,
    "preview": "%option nodefault nounput nomain\n%option bison-bridge reentrant noyywrap\n%option never-interactive\n%option warn stack no"
  },
  {
    "path": "libwds/rtsp/formats3d.cpp",
    "chars": 3045,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/formats3d.h",
    "chars": 2774,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/genericproperty.cpp",
    "chars": 1408,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/genericproperty.h",
    "chars": 1507,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/getparameter.cpp",
    "chars": 1367,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/getparameter.h",
    "chars": 1258,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/header.cpp",
    "chars": 4302,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/header.h",
    "chars": 2552,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/headerlexer.l",
    "chars": 4763,
    "preview": "%option nodefault nounput nomain\n%option bison-bridge reentrant noyywrap\n%option never-interactive\n%option warn stack no"
  },
  {
    "path": "libwds/rtsp/i2c.cpp",
    "chars": 1240,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/i2c.h",
    "chars": 1292,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/idrrequest.cpp",
    "chars": 1151,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/idrrequest.h",
    "chars": 1205,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/macros.h",
    "chars": 1819,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/message.cpp",
    "chars": 1847,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/message.h",
    "chars": 2688,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/messagelexer.l",
    "chars": 6825,
    "preview": "%option nodefault nounput nomain\n%option bison-bridge reentrant noyywrap\n%option never-interactive\n%option warn stack no"
  },
  {
    "path": "libwds/rtsp/messages_rules.txt",
    "chars": 12823,
    "preview": "Rules and lexer\n\nDIGIT = %x30-39\nHEXDIG = DIGIT / %x41-46\nSP = %x20\nCR = %x0D\nLF = %x0A\nCRLF = CR LF\nIPADDRESS = 1*3(DIG"
  },
  {
    "path": "libwds/rtsp/options.cpp",
    "chars": 1327,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/options.h",
    "chars": 1230,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/parser.ypp",
    "chars": 32949,
    "preview": "%pure-parser\n%no-lines\n%output \"gen/parser.cpp\"\n%defines \"gen/parser.h\"\n\n%code requires {\n/*\n * This file is part of Wir"
  },
  {
    "path": "libwds/rtsp/pause.cpp",
    "chars": 1310,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/pause.h",
    "chars": 1218,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/payload.cpp",
    "chars": 3633,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/payload.h",
    "chars": 4100,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/play.cpp",
    "chars": 1283,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/play.h",
    "chars": 1190,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/preferreddisplaymode.cpp",
    "chars": 2768,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/preferreddisplaymode.h",
    "chars": 2625,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/presentationurl.cpp",
    "chars": 1599,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/presentationurl.h",
    "chars": 1558,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/property.cpp",
    "chars": 3281,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/property.h",
    "chars": 1518,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/propertyerrors.cpp",
    "chars": 1951,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/propertyerrors.h",
    "chars": 1735,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/reply.cpp",
    "chars": 1373,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/reply.h",
    "chars": 1381,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/route.cpp",
    "chars": 1388,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/route.h",
    "chars": 1397,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/setparameter.cpp",
    "chars": 1371,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/setparameter.h",
    "chars": 1230,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/setup.cpp",
    "chars": 1310,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/setup.h",
    "chars": 1218,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/standby.cpp",
    "chars": 1126,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/standby.h",
    "chars": 1186,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/standbyresumecapability.cpp",
    "chars": 1457,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/standbyresumecapability.h",
    "chars": 1309,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/teardown.cpp",
    "chars": 1334,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/teardown.h",
    "chars": 1236,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/tests/CMakeLists.txt",
    "chars": 775,
    "preview": "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC\")\nset(CMAKE_C_FLAGS \"${CMAKE_CXX_FLAG"
  },
  {
    "path": "libwds/rtsp/tests/README",
    "chars": 1041,
    "preview": "=======================\nHow to fuzz WDS parser\n=======================\n\n1) Get afl-fuzz from http://lcamtuf.coredump.cx/"
  },
  {
    "path": "libwds/rtsp/tests/dict/wfd_header.dict",
    "chars": 1640,
    "preview": "# This file is part of Wireless Display Software for Linux OS\n#\n# Copyright (C) 2016 Intel Corporation.\n#\n# This library"
  },
  {
    "path": "libwds/rtsp/tests/dict/wfd_payload_error.dict",
    "chars": 1834,
    "preview": "# This file is part of Wireless Display Software for Linux OS\n#\n# Copyright (C) 2016 Intel Corporation.\n#\n# This library"
  },
  {
    "path": "libwds/rtsp/tests/dict/wfd_payload_reply.dict",
    "chars": 2623,
    "preview": "# This file is part of Wireless Display Software for Linux OS\n#\n# Copyright (C) 2016 Intel Corporation.\n#\n# This library"
  },
  {
    "path": "libwds/rtsp/tests/dict/wfd_payload_request.dict",
    "chars": 1821,
    "preview": "# This file is part of Wireless Display Software for Linux OS\n#\n# Copyright (C) 2016 Intel Corporation.\n#\n# This library"
  },
  {
    "path": "libwds/rtsp/tests/run_afl_fuzzer.sh",
    "chars": 1601,
    "preview": "#!/bin/bash\n\n# This file is part of Wireless Display Software for Linux OS\n#\n# Copyright (C) 2016 Intel Corporation.\n#\n#"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/error.txt",
    "chars": 72,
    "preview": "RTSP/1.0 303 OK\nCSeq: 0\nContent-Type: text/parameters\nContent-Length: 55"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/get_parameter.txt",
    "chars": 104,
    "preview": "GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\nCSeq: 2\nContent-Type: text/parameters\nContent-Length: 141"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/options.txt",
    "chars": 50,
    "preview": "OPTIONS * RTSP/1.0\nCSeq: 1\nRequire: org.wfa.wfd1.0"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/pause.txt",
    "chars": 78,
    "preview": "PAUSE rtsp://10.82.24.140/wfd1.0/streamid=0 RTSP/1.0\nCSeq: 6\nSession: 6B8B4567"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/play.txt",
    "chars": 77,
    "preview": "PLAY rtsp://10.82.24.140/wfd1.0/streamid=0 RTSP/1.0\nCSeq: 5\nSession: 6B8B4567"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/reply.txt",
    "chars": 142,
    "preview": "RTSP/1.0 200 OK\nCSeq: 4\nDate: Sun, Aug 21 2011 04:20:53 GMT\nPublic: org.wfa.wfd1.0, SETUP, TEARDOWN, PLAY, PAUSE, GET_PA"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/set_parameter.txt",
    "chars": 104,
    "preview": "SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\nCSeq: 3\nContent-Type: text/parameters\nContent-Length: 302"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/setup.txt",
    "chars": 108,
    "preview": "SETUP rtsp://10.82.24.140/wfd1.0/streamid=0 RTSP/1.0\nCSeq: 4\nTransport: RTP/AVP/UDP;unicast;client_port=1028"
  },
  {
    "path": "libwds/rtsp/tests/seed/header/teardown.txt",
    "chars": 81,
    "preview": "TEARDOWN rtsp://10.82.24.140/wfd1.0/streamid=0 RTSP/1.0\nCSeq: 8\nSession: 6B8B4567"
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_error/payload_error01.txt",
    "chars": 295,
    "preview": "wfd_3d_video_formats: 415, 457\nwfd_I2C: 404\nwfd_audio_codecs: 415, 457\nwfd_client_rtp_ports: 415, 457\nwfd_connector_type"
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_error/payload_error02.txt",
    "chars": 469,
    "preview": "wfd-audio-codecs: 415, 457\nwfd-video-formats: 415, 457\nwfd-3d-formats: 415, 457\nwfd-content-protection: 404\nwfd-display-"
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_reply/payload_reply01.txt",
    "chars": 523,
    "preview": "wfd_I2C: 404\nwfd_audio_codecs: LPCM 00000003 00, AAC 00000001 00\nwfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode="
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_reply/payload_reply02.txt",
    "chars": 334,
    "preview": "wfd_audio_codecs: LPCM 00000003 00\nwfd_3d_video_formats: none\nwfd_content_protection: none\nwfd_display_edid: none\nwfd_co"
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_request/payload_request01.txt",
    "chars": 55,
    "preview": "wfd_video_formats\nwfd_audio_codecs\nwfd_client_rtp_ports"
  },
  {
    "path": "libwds/rtsp/tests/seed/payload_request/payload_request02.txt",
    "chars": 354,
    "preview": "wfd-audio-codecs\nwfd-video-formats\nwfd-3d-formats\nwfd-content-protection\nwfd-display-edid\nwfd-coupled-sink\nwfd-trigger-m"
  },
  {
    "path": "libwds/rtsp/tests/tests.cpp",
    "chars": 39303,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/tests/wdsfuzzer.cpp",
    "chars": 3478,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2016 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/transportheader.cpp",
    "chars": 2564,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/transportheader.h",
    "chars": 1725,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/triggermethod.cpp",
    "chars": 1439,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/triggermethod.h",
    "chars": 1441,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/uibccapability.cpp",
    "chars": 4547,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/uibccapability.h",
    "chars": 2012,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/uibcsetting.cpp",
    "chars": 1404,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/uibcsetting.h",
    "chars": 1317,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/videoformats.cpp",
    "chars": 8642,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/rtsp/videoformats.h",
    "chars": 2888,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/CMakeLists.txt",
    "chars": 347,
    "preview": "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC\")\nset(CMAKE_C_FLAGS \"${CMAKE_CXX_FLAG"
  },
  {
    "path": "libwds/sink/cap_negotiation_state.cpp",
    "chars": 8417,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/cap_negotiation_state.h",
    "chars": 1750,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/init_state.cpp",
    "chars": 3241,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/init_state.h",
    "chars": 1274,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/session_state.cpp",
    "chars": 3990,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/session_state.h",
    "chars": 2004,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/sink.cpp",
    "chars": 6623,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/streaming_state.cpp",
    "chars": 7263,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/sink/streaming_state.h",
    "chars": 1476,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/CMakeLists.txt",
    "chars": 352,
    "preview": "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fvisibility=hidden -fPIC\")\nset(CMAKE_C_FLAGS \"${CMAKE_CXX_FLAG"
  },
  {
    "path": "libwds/source/cap_negotiation_state.cpp",
    "chars": 5982,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/cap_negotiation_state.h",
    "chars": 1354,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/init_state.cpp",
    "chars": 2635,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/init_state.h",
    "chars": 1275,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/session_state.cpp",
    "chars": 4055,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/session_state.h",
    "chars": 1822,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/source.cpp",
    "chars": 8136,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/streaming_state.cpp",
    "chars": 3211,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "libwds/source/streaming_state.h",
    "chars": 1390,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/CMakeLists.txt",
    "chars": 1212,
    "preview": "#FIXME in the future: with cmake 2.8.12 and up it's better\n#to use target_compile_options or add_compile_options\nset(CMA"
  },
  {
    "path": "mirac_network/gst-test.cpp",
    "chars": 4114,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/mirac-broker.cpp",
    "chars": 8185,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-broker.hpp",
    "chars": 3516,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-exception.hpp",
    "chars": 2415,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/mirac-glib-logging.cpp",
    "chars": 1834,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-glib-logging.hpp",
    "chars": 1000,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-gst-bus-handler.cpp",
    "chars": 1982,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-gst-bus-handler.hpp",
    "chars": 1062,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2015 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-gst-sink.cpp",
    "chars": 3564,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-gst-sink.hpp",
    "chars": 1274,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "mirac_network/mirac-gst-test-source.cpp",
    "chars": 3677,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/mirac-gst-test-source.hpp",
    "chars": 1424,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/mirac-network.cpp",
    "chars": 8862,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/mirac-network.hpp",
    "chars": 2256,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "mirac_network/network-test.cpp",
    "chars": 4618,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * Cont"
  },
  {
    "path": "p2p/CMakeLists.txt",
    "chars": 803,
    "preview": "#FIXME in the future: with cmake 2.8.12 and up it's better\n#to use target_compile_options or add_compile_options\nset(CMA"
  },
  {
    "path": "p2p/connman-client.cpp",
    "chars": 11504,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/connman-client.h",
    "chars": 3425,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/connman-peer.cpp",
    "chars": 7315,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/connman-peer.h",
    "chars": 2982,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/information-element.cpp",
    "chars": 4754,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/information-element.h",
    "chars": 4129,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/main.cpp",
    "chars": 2241,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "p2p/test-ie.cpp",
    "chars": 2415,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "rtsp-message-exchanges.txt",
    "chars": 3996,
    "preview": "\n**************************************************\n* RTSP messages during WFD session establishment *\n*****************"
  },
  {
    "path": "sink/CMakeLists.txt",
    "chars": 956,
    "preview": "#FIXME in the future: with cmake 2.8.12 and up it's better\n#to use target_compile_options or add_compile_options\nset(CMA"
  },
  {
    "path": "sink/gst_sink_media_manager.cpp",
    "chars": 3014,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/gst_sink_media_manager.h",
    "chars": 1991,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/main.cpp",
    "chars": 3850,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/sink-app.cpp",
    "chars": 3131,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/sink-app.h",
    "chars": 1635,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/sink.cpp",
    "chars": 1845,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  },
  {
    "path": "sink/sink.h",
    "chars": 1600,
    "preview": "/*\n * This file is part of Wireless Display Software for Linux OS\n *\n * Copyright (C) 2014 Intel Corporation.\n *\n * This"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the 01org/wds GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 190 files (543.7 KB), approximately 149.8k tokens, and a symbol index with 381 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!