-operator!= (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b)
-{
- return a.id != b.id;
-}
-
-bool
-operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
-{
- return a.id == b.id;
-}
-
-bool
-operator!= (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
-{
- return a.id != b.id;
-}
-
-FFmpegStream::FFmpegStream (shared_ptr<const cxml::Node> node, int version)
- : _legacy_id (false)
-{
- name = node->string_child ("Name");
- id = node->number_child<int> ("Id");
- if (version == 4 || node->optional_bool_child ("LegacyId")) {
- _legacy_id = true;
- }
-}
-
-void
-FFmpegStream::as_xml (xmlpp::Node* root) const
-{
- 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