TSファイルにフルセグとワンセグがあった場合は、フルセグをおそらく優先します。
TSファイルにフルセグとワンセグがあった場合は、フルセグをおそらく優先します。
#module _bsort_ #deffunc bsort array rando, int flag,array motopos, local i,local d1, local d2 i = 0 repeat length(rando) motopos.cnt = cnt loop repeat length(rando)-1 repeat length(rando)-1-i // 比較のため一時的にデータを取り出す d1=rando(cnt) : d2=rando(cnt+1) _d1 = motopos(cnt) : _d2 = motopos(cnt+1) // データを比較して大きい場合入れ替え // 降順の場合は小さいときに入れ替える if (flag == 0){ if d1>d2 : rando(cnt)=d2 : rando(cnt+1)=d1 : motopos(cnt)=_d2 : motopos(cnt+1)=_d1 }else{ if d1<d2 : rando(cnt)=d2 : rando(cnt+1)=d1 : motopos(cnt)=_d2 : motopos(cnt+1)=_d1 } loop i++ loop return #defcfunc arraycheck array rando, str _str, local i i = 0 repeat length(rando) if (str(rando(cnt)) == _str) : i++ loop return i #defcfunc getarraystart array rando, str _str, local i i = -1 repeat length(rando) if (str(rando(cnt)) == _str) : i = cnt : break loop return i #global #module MediaInfo #uselib "MediaInfo.dll" #func MediaInfo_New "MediaInfo_New" #func MediaInfo_New_Quick "MediaInfo_New_Quick" wptr,wptr #func MediaInfo_Delete "MediaInfo_Delete" wptr #func MediaInfo_Open "MediaInfo_Open" wptr,wptr #func MediaInfo_Open_Buffer "MediaInfo_Open_Buffer" wptr,wptr,wptr,wptr,wptr #func MediaInfo_Open_Buffer_Init "MediaInfo_Open_Buffer_Init" wptr,wptr,wptr #func MediaInfo_Open_Buffer_Continue "MediaInfo_Open_Buffer_Continue" wptr,wptr,wptr #func MediaInfo_Open_Buffer_Continue_GoTo_Get "MediaInfo_Open_Buffer_Continue_GoTo_Get" wptr #func MediaInfo_Open_Buffer_Finalize "MediaInfo_Open_Buffer_Finalize" wptr #func MediaInfo_Open_NextPacket "MediaInfo_Open_NextPacket" wptr #func MediaInfo_Save "MediaInfo_Save" wptr #func MediaInfo_Close "MediaInfo_Close" wptr #func MediaInfo_Inform "MediaInfo_Inform" wptr,wptr #func MediaInfo_GetI "MediaInfo_GetI" wptr,wptr,wptr,wptr,wptr #func MediaInfo_Get "MediaInfo_Get" wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfo_SetI "MediaInfo_SetI" wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfo_Set "MediaInfo_Set" wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfo_Output_Buffer_Get "MediaInfo_Output_Buffer_Get" wptr,wptr #func MediaInfo_Output_Buffer_GetI "MediaInfo_Output_Buffer_GetI" wptr,wptr #func MediaInfo_Option "MediaInfo_Option" wptr,wptr,wptr #func MediaInfo_State_Get "MediaInfo_State_Get" wptr #func MediaInfo_Count_Get "MediaInfo_Count_Get" wptr,wptr,wptr #func MediaInfoA_New "MediaInfoA_New" #func MediaInfoA_New_Quick "MediaInfoA_New_Quick" sptr,sptr #func MediaInfoA_Delete "MediaInfoA_Delete" sptr #func MediaInfoA_Open "MediaInfoA_Open" sptr,sptr #func MediaInfoA_Open_Buffer "MediaInfoA_Open_Buffer" sptr,sptr,sptr,sptr,sptr #func MediaInfoA_Open_Buffer_Init "MediaInfoA_Open_Buffer_Init" sptr,sptr,sptr #func MediaInfoA_Open_Buffer_Continue "MediaInfoA_Open_Buffer_Continue" sptr,sptr,sptr #func MediaInfoA_Open_Buffer_Continue_GoTo_Get "MediaInfoA_Open_Buffer_Continue_GoTo_Get" sptr #func MediaInfoA_Open_Buffer_Finalize "MediaInfoA_Open_Buffer_Finalize" sptr #func MediaInfoA_Open_NextPacket "MediaInfoA_Open_NextPacket" sptr #func MediaInfoA_Save "MediaInfoA_Save" sptr #func MediaInfoA_Close "MediaInfoA_Close" sptr #func MediaInfoA_Inform "MediaInfoA_Inform" sptr,sptr #func MediaInfoA_GetI "MediaInfoA_GetI" sptr,sptr,sptr,sptr,sptr #func MediaInfoA_Get "MediaInfoA_Get" sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoA_SetI "MediaInfoA_SetI" sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoA_Set "MediaInfoA_Set" sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoA_Output_Buffer_Get "MediaInfoA_Output_Buffer_Get" sptr,sptr #func MediaInfoA_Output_Buffer_GetI "MediaInfoA_Output_Buffer_GetI" sptr,sptr #func MediaInfoA_Option "MediaInfoA_Option" sptr,sptr,sptr #func MediaInfoA_State_Get "MediaInfoA_State_Get" sptr #func MediaInfoA_Count_Get "MediaInfoA_Count_Get" sptr,sptr,sptr #func MediaInfo_Info_Version "MediaInfo_Info_Version" #func MediaInfoList_New "MediaInfoList_New" #func MediaInfoList_New_Quick "MediaInfoList_New_Quick" wptr,wptr #func MediaInfoList_Delete "MediaInfoList_Delete" wptr #func MediaInfoList_Open "MediaInfoList_Open" wptr,wptr,wptr #func MediaInfoList_Open_Buffer "MediaInfoList_Open_Buffer" wptr,wptr,wptr,wptr,wptr #func MediaInfoList_Save "MediaInfoList_Save" wptr,wptr #func MediaInfoList_Close "MediaInfoList_Close" wptr,wptr #func MediaInfoList_Inform "MediaInfoList_Inform" wptr,wptr,wptr #func MediaInfoList_GetI "MediaInfoList_GetI" wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfoList_Get "MediaInfoList_Get" wptr,wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfoList_SetI "MediaInfoList_SetI" wptr,wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfoList_Set "MediaInfoList_Set" wptr,wptr,wptr,wptr,wptr,wptr,wptr #func MediaInfoList_Option "MediaInfoList_Option" wptr,wptr,wptr #func MediaInfoList_State_Get "MediaInfoList_State_Get" wptr #func MediaInfoList_Count_Get "MediaInfoList_Count_Get" wptr,wptr,wptr,wptr #func MediaInfoList_Count_Get_Files "MediaInfoList_Count_Get_Files" wptr #func MediaInfoListA_New "MediaInfoListA_New" #func MediaInfoListA_New_Quick "MediaInfoListA_New_Quick" sptr,sptr #func MediaInfoListA_Delete "MediaInfoListA_Delete" sptr #func MediaInfoListA_Open "MediaInfoListA_Open" sptr,sptr,sptr #func MediaInfoListA_Open_Buffer "MediaInfoListA_Open_Buffer" sptr,sptr,sptr,sptr,sptr #func MediaInfoListA_Save "MediaInfoListA_Save" sptr,sptr #func MediaInfoListA_Close "MediaInfoListA_Close" sptr,sptr #func MediaInfoListA_Inform "MediaInfoListA_Inform" sptr,sptr,sptr #func MediaInfoListA_GetI "MediaInfoListA_GetI" sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoListA_Get "MediaInfoListA_Get" sptr,sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoListA_SetI "MediaInfoListA_SetI" sptr,sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoListA_Set "MediaInfoListA_Set" sptr,sptr,sptr,sptr,sptr,sptr,sptr #func MediaInfoListA_Option "MediaInfoListA_Option" sptr,sptr,sptr #func MediaInfoListA_State_Get "MediaInfoListA_State_Get" sptr #func MediaInfoListA_Count_Get "MediaInfoListA_Count_Get" sptr,sptr,sptr,sptr #func MediaInfoListA_Count_Get_Files "MediaInfoListA_Count_Get_Files" sptr #enum StreamKind_General = 0 #enum StreamKind_Video #enum StreamKind_Audio #enum StreamKind_Text #enum StreamKind_Chapters #enum StreamKind_Image #enum InfoKind_Name = 0 #enum InfoKind_Text #enum InfoKind_Measure #enum InfoKind_Options #enum InfoKind_NameText #enum InfoKind_MeasureText #enum InfoKind_Info #enum InfoKind_HowTo #enum InfoOptions_ShowInInform = 0 #enum InfoOptions_Support #enum InfoOptions_ShowInSupported #enum InfoOptions_TypeOfValue #enum InformOptions_Nothing = 0 #enum InformOptions_Custom #enum InformOptions_HTML // ファイル名, エラーコード返却用変数 #deffunc GetTSAudioDelay str _fname, var error error = 0 fname = _fname // ハンドルを取得 MediaInfoA_New handle = stat // ハンドルを使用してファイル読み込み MediaInfoA_Open handle, fname if (stat){ // 設定(これを設定すると詳細に取得できます) //MediaInfoA_Option handle, "Complete", "1" // 取得 rev_size = 4096 // バッファサイズ /* MediaInfoA_Inform handle, rev_size dupptr info, stat, rev_size, 2 screen 1,640,480 mesbox info, 640, 480 gsel 0, 0 */ // グローバルの情報取得 MediaInfoA_Get handle, StreamKind_General, 0, "Format", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 gFormatList.cnt = tmp MediaInfoA_Get handle, StreamKind_General, 0, "Duration/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 gTimeList.cnt = tmp // オーディオストリームの数を取得 MediaInfoA_Count_Get handle, StreamKind_Audio, -1 aNum = stat repeat aNum MediaInfoA_Get handle, StreamKind_Audio, cnt, "ID", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aIDList.cnt = int(tmp) MediaInfoA_Get handle, StreamKind_Audio, cnt, "Format", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aCodecList.cnt = tmp MediaInfoA_Get handle, StreamKind_Audio, cnt, "StreamSize", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aSizeList.cnt = double(tmp) aSizeList2.cnt = double(tmp) MediaInfoA_Get handle, StreamKind_Audio, cnt, "Duration", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aTimeList.cnt = double(tmp)/1000 aTimeList2.cnt = double(tmp)/1000 MediaInfoA_Get handle, StreamKind_Audio, cnt, "Duration/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aTimeList3.cnt = tmp MediaInfoA_Get handle, StreamKind_Audio, cnt, "Video0_Delay", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aDelayList.cnt = double(tmp) MediaInfoA_Get handle, StreamKind_Audio, cnt, "Channel(s)/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aChList.cnt = tmp MediaInfoA_Get handle, StreamKind_Audio, cnt, "SamplingRate/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aSRList.cnt = tmp MediaInfoA_Get handle, StreamKind_Audio, cnt, "BitRate/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 aBRList.cnt = tmp loop // ビデオストリームの数を取得 MediaInfoA_Count_Get handle, StreamKind_Video, -1 vNum = stat repeat vNum MediaInfoA_Get handle, StreamKind_Video, cnt, "ID", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vIDList.cnt = int(tmp) MediaInfoA_Get handle, StreamKind_Video, cnt, "Format", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vCodecList.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "Format_Version", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vCodecFormatList.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "Width", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vWidthList.cnt = int(tmp) vWidthList2.cnt = int(tmp) MediaInfoA_Get handle, StreamKind_Video, cnt, "Height", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vHeightList.cnt = int(tmp) MediaInfoA_Get handle, StreamKind_Video, cnt, "Duration", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vTimeList.cnt = double(tmp)/1000 vTimeList2.cnt = double(tmp)/1000 MediaInfoA_Get handle, StreamKind_Video, cnt, "Duration/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vTimeList3.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "BitRate/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vBRList.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "BitRate_Maximum/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vBRMaxList.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "DisplayAspectRatio/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vDARList.cnt = tmp MediaInfoA_Get handle, StreamKind_Video, cnt, "FrameRate/String", InfoKind_Text, rev_size dupptr tmp, stat, rev_size, 2 vFPSList.cnt = tmp loop // 初期値 UseAudioID = -1 UseAudioDelay = 0x80000000 UseVideoID = -1 SelectID = -1 // エラーチェック if ( aNum <= 0 ){ error = -1 }else : if (vNum <= 0 ){ error = -2 }else{ // ストリームがある場合はこちら // 使用するストリームの判定 // オーディオストリームが1つの場合はそれにする if (aNum == 1){ UseAudioID = aIDList.0 UseAudioDelay = aDelayList.0 SelectID = 0 }else{ // ストリームが複数の場合 if (arraycheck(aCodecList, "AAC") == 1){ // AACが1つしかない場合は確定 UseAudioID = aIDList.getarraystart(aCodecList, "AAC") UseAudioDelay = aDelayList.getarraystart(aCodecList, "AAC") SelectID = getarraystart(aCodecList, "AAC") }else{ // AACが複数の場合 // サイズの大きい順にソートする bsort aSizeList2, 1, moto if (aCodecList.int(moto.0) == "AAC"){ // 一番大きいストリームがAACだった場合 UseAudioID = aIDList.int(moto.0) UseAudioDelay = aDelayList.int(moto.0) SelectID = int(moto.0) }else{ // 時間の長い順にソートする bsort aTimeList2, 1, moto if (aCodecList.int(moto.0) == "AAC"){ // 一番大きいストリームがAACだった場合 UseAudioID = aIDList.int(moto.0) SelectID = int(moto.0) }else{ // error = -3 } } } } // ビデオストリームが1つの場合はそれにする if (vNum == 1){ UseVideoID = vIDList.0 SelectID = 0 }else{ // ストリームが複数の場合 if (arraycheck(vCodecList, "MPEG Video") == 1){ // MPEG Videoが1つしかない場合は確定 UseVideoID = vIDList.getarraystart(vCodecList, "MPEG Video") SelectID = getarraystart(vCodecList, "MPEG Video") }else{ // MPEG Videoが複数の場合 // 時間の長い順にソートする bsort vTimeList2, 1, moto if (vCodecList.int(moto.0) == "MPEG Video"){ // 一番長いストリームがMPEG Videoだった場合 UseVideoID = vIDList.int(moto.0) SelectID = int(moto.0) }else{ // 幅が長い順にソートする bsort vWidthList2, 1, moto if (vCodecList.int(moto.0) == "MPEG Video"){ // 一番幅が長いストリームがMPEG Videoだった場合 UseVideoID = vIDList.int(moto.0) SelectID = int(moto.0) }else{ // error = -4 } } } } } /* // 情報表示 if (SelectID != -1){ mes "------------- MediaInfo --------------" mes "--------------- Global ---------------" mes "FileName:\t"+getpath(fname, 8) mes "Format:\t\t"+gFormatList.SelectID mes "Duration:\t"+gTimeList.SelectID mes "" mes "---------------- Video ---------------" mes "ID:\t\t"+UseVideoID mes "Format:\t\t"+vCodecList.SelectID+" "+vCodecFormatList.SelectID mes "Duration:\t"+vTimeList3.SelectID mes "Bitrate:\t"+vBRList.SelectID mes "MaxBitrate:\t"+vBRMaxList.SelectID mes "Size:\t\t"+vWidthList.SelectID+"x"+vHeightList.SelectID mes "DAR:\t\t"+vDARList.SelectID mes "FPS:\t\t"+vFPSList.SelectID mes "" mes "---------------- Audio ---------------" mes "ID:\t\t"+UseAudioID mes "Format:\t\t"+aCodecList.SelectID mes "Duration:\t"+aTimeList3.SelectID mes "Bitrate:\t"+aBRList.SelectID mes "Delay:\t\t"+UseAudioDelay mes "CH:\t\t"+aChList.SelectID mes "SampleRate:\t"+aSRList.SelectID mes "" gosub *cnvts }else{ end } */ MediaInfoA_Close handle }else{ error = -5 } // 使用後はハンドル解放 MediaInfoA_Delete handle return int(UseAudioDelay) #global