X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.h;h=7ff159b852b4cb69df4004b1f6a813ad2131e182;hb=8bef34f672815c3c9b4236d06fdee8dfd0bffbc2;hp=36c24c2b3353629614ada8999c0c1cb970b56674;hpb=46cd0fe7b5b514f0d9456b25f670679cc584a218;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 36c24c2b3..7ff159b85 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -23,68 +23,107 @@ #include #include "video_content.h" #include "audio_content.h" +#include "subtitle_content.h" +#include "audio_mapping.h" + +struct AVFormatContext; +struct AVStream; class Filter; +class ffmpeg_pts_offset_test; -class FFmpegAudioStream +class FFmpegStream { public: - FFmpegAudioStream (std::string n, int i, int f, int c) - : name (n) - , id (i) - , frame_rate (f) + FFmpegStream (std::string n, int i) + : name (n) + , id (i) + , _legacy_id (false) + {} + + FFmpegStream (boost::shared_ptr, int); + + void as_xml (xmlpp::Node *) const; + + /** @param c An AVFormatContext. + * @return Stream index within the AVFormatContext. + */ + int index (AVFormatContext const * c) const; + AVStream* stream (AVFormatContext const * c) const; + + std::string name; + int id; + +private: + /** If this is true, id is in fact the index */ + bool _legacy_id; +}; + +class FFmpegAudioStream : public FFmpegStream +{ +public: + FFmpegAudioStream (std::string n, int i, int f, int c) + : FFmpegStream (n, i) + , frame_rate (f) , channels (c) , mapping (c) - {} + { + mapping.make_default (); + } - FFmpegAudioStream (boost::shared_ptr); + FFmpegAudioStream (boost::shared_ptr, int); void as_xml (xmlpp::Node *) const; - - std::string name; - int id; - int frame_rate; + + int frame_rate; int channels; AudioMapping mapping; - boost::optional