- root->add_child("Name")->add_child_text (name);
- root->add_child("Id")->add_child_text (lexical_cast<string> (id));
- if (_legacy_id) {
- /* Write this so that version > 4 files are read in correctly
- if the Id came originally from a version <= 4 file.
- */
- root->add_child("LegacyId")->add_child_text ("1");
- }
-}
-
-FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node, int version)
- : FFmpegStream (node, version)
- , mapping (node->node_child ("Mapping"), version)
-{
- frame_rate = node->number_child<int> ("FrameRate");
- channels = node->number_child<int64_t> ("Channels");
- first_audio = node->optional_number_child<double> ("FirstAudio");
-}
-
-void
-FFmpegAudioStream::as_xml (xmlpp::Node* root) const
-{
- FFmpegStream::as_xml (root);
- root->add_child("FrameRate")->add_child_text (lexical_cast<string> (frame_rate));
- root->add_child("Channels")->add_child_text (lexical_cast<string> (channels));
- if (first_audio) {
- root->add_child("FirstAudio")->add_child_text (lexical_cast<string> (first_audio.get ()));
- }
- mapping.as_xml (root->add_child("Mapping"));
-}
-
-int
-FFmpegStream::index (AVFormatContext const * fc) const
-{
- if (_legacy_id) {
- return id;
- }
-
- size_t i = 0;
- while (i < fc->nb_streams) {
- if (fc->streams[i]->id == id) {
- return i;
- }
- ++i;
- }
-
- assert (false);
-}
-
-AVStream *
-FFmpegStream::stream (AVFormatContext const * fc) const
-{
- if (_legacy_id) {
- return fc->streams[id];
- }
-
- size_t i = 0;
- while (i < fc->nb_streams) {
- if (fc->streams[i]->id == id) {
- return fc->streams[i];
- }
- ++i;
- }
-
- assert (false);
- return 0;
-}
-
-/** Construct a SubtitleStream from a value returned from to_string().
- * @param t String returned from to_string().
- * @param v State file version.
- */
-FFmpegSubtitleStream::FFmpegSubtitleStream (shared_ptr<const cxml::Node> node, int version)
- : FFmpegStream (node, version)
-{
-
-}
-
-void
-FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
-{
- FFmpegStream::as_xml (root);