chapters.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _CHAPTER_H_
00028 #define _CHAPTER_H_
00029
00030 #include "mkv.hpp"
00031
00032 class chapter_translation_c
00033 {
00034 public:
00035 chapter_translation_c()
00036 :p_translated(NULL)
00037 {}
00038
00039 ~chapter_translation_c()
00040 {
00041 delete p_translated;
00042 }
00043
00044 KaxChapterTranslateID *p_translated;
00045 unsigned int codec_id;
00046 std::vector<uint64_t> editions;
00047 };
00048
00049 class chapter_codec_cmds_c;
00050 class chapter_item_c
00051 {
00052 public:
00053 chapter_item_c()
00054 :i_start_time(0)
00055 ,i_end_time(-1)
00056 ,i_user_start_time(-1)
00057 ,i_user_end_time(-1)
00058 ,i_seekpoint_num(-1)
00059 ,b_display_seekpoint(true)
00060 ,b_user_display(false)
00061 ,psz_parent(NULL)
00062 ,b_is_leaving(false)
00063 {}
00064
00065 virtual ~chapter_item_c();
00066
00067 int64_t RefreshChapters( bool b_ordered, int64_t i_prev_user_time );
00068 int PublishChapters( input_title_t & title, int & i_user_chapters, int i_level = 0 );
00069 virtual chapter_item_c * FindTimecode( mtime_t i_timecode, const chapter_item_c * p_current, bool & b_found );
00070 void Append( const chapter_item_c & edition );
00071 chapter_item_c * FindChapter( int64_t i_find_uid );
00072 virtual chapter_item_c *BrowseCodecPrivate( unsigned int codec_id,
00073 bool (*match)(const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ),
00074 const void *p_cookie,
00075 size_t i_cookie_size );
00076 std::string GetCodecName( bool f_for_title = false ) const;
00077 bool ParentOf( const chapter_item_c & item ) const;
00078 int16 GetTitleNumber( ) const;
00079
00080 int64_t i_start_time, i_end_time;
00081 int64_t i_user_start_time, i_user_end_time;
00082 std::vector<chapter_item_c*> sub_chapters;
00083 int i_seekpoint_num;
00084 int64_t i_uid;
00085 bool b_display_seekpoint;
00086 bool b_user_display;
00087 std::string psz_name;
00088 chapter_item_c *psz_parent;
00089 bool b_is_leaving;
00090
00091 std::vector<chapter_codec_cmds_c*> codecs;
00092
00093 static bool CompareTimecode( const chapter_item_c * itemA, const chapter_item_c * itemB )
00094 {
00095 return ( itemA->i_user_start_time < itemB->i_user_start_time || (itemA->i_user_start_time == itemB->i_user_start_time && itemA->i_user_end_time < itemB->i_user_end_time) );
00096 }
00097
00098 bool Enter( bool b_do_subchapters );
00099 bool Leave( bool b_do_subchapters );
00100 bool EnterAndLeave( chapter_item_c *p_item, bool b_enter = true );
00101 };
00102
00103 class chapter_edition_c : public chapter_item_c
00104 {
00105 public:
00106 chapter_edition_c()
00107 :b_ordered(false)
00108 {}
00109
00110 void RefreshChapters( );
00111 mtime_t Duration() const;
00112 std::string GetMainName() const;
00113 chapter_item_c * FindTimecode( mtime_t i_timecode, const chapter_item_c * p_current );
00114
00115 bool b_ordered;
00116 };
00117
00118 #endif