X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_decoder.h;h=26b5d69792f42084d8b72cbad9c6cac5415e6282;hb=44b57d623dec97a3f9955082f0b8a7a8d27b7518;hp=d66acad48fee72a243b56900a6c7bb812ec4d685;hpb=bb767c7e338414beee132af3e96829c1448e214b;p=dcpomatic.git diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index d66acad48..26b5d6979 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -25,6 +25,7 @@ #include #include #include +#include extern "C" { #include #include @@ -39,6 +40,7 @@ struct AVFormatContext; struct AVFrame; struct AVBufferContext; struct AVCodec; +struct AVStream; class Job; class FilmState; class Options; @@ -55,13 +57,16 @@ public: ~FFmpegDecoder (); /* Methods to query our input video */ - int length_in_frames () const; - int decoding_frames () const; float frames_per_second () const; Size native_size () const; int audio_channels () const; int audio_sample_rate () const; AVSampleFormat audio_sample_format () const; + int64_t audio_channel_layout () const; + bool has_subtitles () const; + + std::vector audio_streams () const; + std::vector subtitle_streams () const; private: @@ -75,16 +80,30 @@ private: void setup_general (); void setup_video (); void setup_audio (); + void setup_subtitle (); + + void maybe_add_subtitle (); + + std::string stream_name (AVStream* s) const; AVFormatContext* _format_context; int _video_stream; - int _audio_stream; + int _audio_stream; ///< may be < 0 if there is no audio + int _subtitle_stream; ///< may be < 0 if there is no subtitle AVFrame* _frame; + + std::vector _audio_streams; + std::vector _subtitle_streams; AVCodecContext* _video_codec_context; AVCodec* _video_codec; - AVCodecContext* _audio_codec_context; - AVCodec* _audio_codec; + AVCodecContext* _audio_codec_context; ///< may be 0 if there is no audio + AVCodec* _audio_codec; ///< may be 0 if there is no audio + AVCodecContext* _subtitle_codec_context; ///< may be 0 if there is no subtitle + AVCodec* _subtitle_codec; ///< may be 0 if there is no subtitle AVPacket _packet; + + boost::optional _first_video; + boost::optional _first_audio; };