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
00028
00029
00032
00033 #ifdef HAVE_CONFIG_H
00034 #include "autoconfig.h"
00035 #endif
00036
00037 #ifdef EXTERNAL_TRANSCODING
00038
00039 #include "transcoding.h"
00040 #include "tools.h"
00041
00042 using namespace zmm;
00043
00044 TranscodingProfile::TranscodingProfile()
00045 {
00046 first_resource = false;
00047 buffer_size = 0;
00048 chunk_size = 0;
00049 initial_fill_size = 0;
00050 tr_type = TR_None;
00051 theora = false;
00052 accept_url = true;
00053 dvd_only = false;
00054 force_chunked = true;
00055 hide_orig_res = false;
00056 thumbnail = false;
00057 sample_frequency = SOURCE;
00058 number_of_channels = SOURCE;
00059 attributes = Ref<Dictionary>(new Dictionary());
00060 fourcc_list = Ref<Array<StringBase> >(new Array<StringBase>());
00061 fourcc_mode = FCC_None;
00062 }
00063
00064 TranscodingProfile::TranscodingProfile(transcoding_type_t tr_type, String name)
00065 {
00066 this->name = name;
00067 this->tr_type = tr_type;
00068 theora = false;
00069 first_resource = false;
00070 accept_url = true;
00071 dvd_only = false;
00072 force_chunked = true;
00073 hide_orig_res = false;
00074 thumbnail = false;
00075 sample_frequency = SOURCE;
00076 number_of_channels = SOURCE;
00077 buffer_size = 0;
00078 chunk_size = 0;
00079 initial_fill_size = 0;
00080 tr_type = TR_None;
00081 attributes = Ref<Dictionary>(new Dictionary());
00082 fourcc_list = Ref<Array<StringBase> >(new Array<StringBase>());
00083 fourcc_mode = FCC_None;
00084 }
00085
00086 void TranscodingProfile::setBufferOptions(size_t bs, size_t cs, size_t ifs)
00087 {
00088 buffer_size = bs;
00089 chunk_size = cs;
00090 initial_fill_size = ifs;
00091 }
00092
00093 void TranscodingProfile::addAttribute(zmm::String name, zmm::String value)
00094 {
00095 attributes->put(name, value);
00096 }
00097
00098 Ref<Dictionary> TranscodingProfile::getAttributes()
00099 {
00100 return attributes;
00101 }
00102
00103
00104 void TranscodingProfile::setAVIFourCCList(Ref<Array<StringBase> > list,
00105 avi_fourcc_listmode_t mode)
00106 {
00107 fourcc_list = list;
00108 fourcc_mode = mode;
00109 }
00110
00111 Ref<Array<StringBase> > TranscodingProfile::getAVIFourCCList()
00112 {
00113 return fourcc_list;
00114 }
00115
00116
00117 TranscodingProfileList::TranscodingProfileList()
00118 {
00119 list = Ref<ObjectDictionary<ObjectDictionary<TranscodingProfile> > >(new ObjectDictionary<ObjectDictionary<TranscodingProfile> >());
00120 }
00121
00122 void TranscodingProfileList::add(zmm::String sourceMimeType, zmm::Ref<TranscodingProfile> prof)
00123 {
00124 Ref<ObjectDictionary<TranscodingProfile> > inner = list->get(sourceMimeType);
00125
00126 if (inner == nil)
00127 inner = Ref<ObjectDictionary<TranscodingProfile> >(new ObjectDictionary<TranscodingProfile>());
00128
00129 inner->put(prof->getName(), prof);
00130 list->put(sourceMimeType, inner);
00131 }
00132
00133 Ref<ObjectDictionary<TranscodingProfile> > TranscodingProfileList::get(zmm::String sourceMimeType)
00134 {
00135 return list->get(sourceMimeType);
00136 }
00137
00138 Ref<TranscodingProfile> TranscodingProfileList::getByName(zmm::String name)
00139 {
00140 Ref<Array<ObjectDictionaryElement<ObjectDictionary<TranscodingProfile> > > > mt_list = list->getElements();
00141
00142 for (int i = 0; i < mt_list->size(); i++)
00143 {
00144 Ref<ObjectDictionary<TranscodingProfile> > names = mt_list->get(i)->getValue();
00145 if (names != nil)
00146 {
00147 Ref<TranscodingProfile> tp = names->get(name);
00148 if (tp != nil)
00149 return tp;
00150 }
00151 }
00152 return nil;
00153 }
00154
00155 #endif//EXTERNAL_TRANSCODING