tipsやちょっとしたスクリプト

mpgtx-1_3_1forWin32/wo video output

mpgtxを mpeg形式のファイルからオーディオをデータを抜き出すのに使っている。 mpgtxが2年ぶりにバージョンアップしたので追随してみる。そのままではwindowsではコンパイルが通らないのでパッチ+ビデオデータは出力しない改造バージョン。

Index: commandline.cxx
===================================================================
RCS file: /home/tito/cvsroot/mpgtx/src/commandline.cxx,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -c -r1.1.1.1 -r1.3
*** commandline.cxx	2005/01/29 07:41:49	1.1.1.1
--- commandline.cxx	2005/01/29 09:27:26	1.3
***************
*** 113,119 ****
--- 113,121 ----
  
  #ifdef ENABLE_OPTIMIZATION
  #include <sys/time.h>
+ #ifndef _WIN32
  #include <unistd.h>
+ #endif
  #include <stdlib.h>
  
  struct timeval tv;
Index: id3command.cxx
===================================================================
RCS file: /home/tito/cvsroot/mpgtx/src/id3command.cxx,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** id3command.cxx	2005/01/29 07:41:49	1.1.1.1
--- id3command.cxx	2005/01/29 08:49:56	1.2
***************
*** 878,884 ****
  		tempdest=new char[strlen(dest)+1+move2dirsize];
  		strcpy(tempdest,dest);
  	}
! 
  	//handle the ~/ (home dir)
  	else if(dest[0]=='~' && dest[1]=='/'){
  		struct passwd* mypassentry;
--- 878,884 ----
  		tempdest=new char[strlen(dest)+1+move2dirsize];
  		strcpy(tempdest,dest);
  	}
! #ifndef _WIN32
  	//handle the ~/ (home dir)
  	else if(dest[0]=='~' && dest[1]=='/'){
  		struct passwd* mypassentry;
***************
*** 901,907 ****
  		}
  
  	}
! 
  	//handle the ./
  	else if (dest[0]=='.' && dest[1]=='/'){
  		//explicitely relative path
--- 901,907 ----
  		}
  
  	}
! #endif
  	//handle the ./
  	else if (dest[0]=='.' && dest[1]=='/'){
  		//explicitely relative path
***************
*** 954,961 ****
--- 954,963 ----
  							printf("Would Create directory %s (if not created before)\n",tempdest);
  						}
  						else{
+ #ifndef _WIN32
  							if(AskDirCreation(tempdest)) mkdir(tempdest,0777);			
  							else return;
+ #endif
  						}
  						break;
  					case ENOTDIR:
Index: id3command.hh
===================================================================
RCS file: /home/tito/cvsroot/mpgtx/src/id3command.hh,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -c -r1.1.1.1 -r1.3
*** id3command.hh	2005/01/29 07:41:49	1.1.1.1
--- id3command.hh	2005/01/29 09:27:26	1.3
***************
*** 16,25 ****
--- 16,29 ----
  // needed by move
  #include <sys/types.h>
  #include <sys/stat.h>
+ #ifndef _WIN32
  #include <unistd.h>
+ #endif
  #include <errno.h>
  //for the home dir
+ #ifndef _WIN32
  #include <pwd.h>
+ #endif
  // end needed
  
  bool id3_Show_Only =false;
Index: make.bat
===================================================================
RCS file: make.bat
diff -N make.bat
*** /dev/null	Wed May  6 05:32:27 1998
--- /tmp/cvsdMYrhj	Sat Jan 29 21:19:58 2005
***************
*** 0 ****
--- 1 ----
+ cl -D_WIN32 -DNOSIGNAL_H *.cxx /Fempgtx.exe /O2 /G5  
Index: mpegOut.cxx
===================================================================
RCS file: /home/tito/cvsroot/mpgtx/src/mpegOut.cxx,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** mpegOut.cxx	2005/01/29 07:41:49	1.1.1.1
--- mpegOut.cxx	2005/01/29 08:49:56	1.2
***************
*** 11,16 ****
--- 11,21 ----
  #include "common.hh"
  #include <stdio.h>
  #include <stdlib.h>
+ #ifdef _WIN32
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #endif
+ 
  // original was 0.015
  #define base_TS_correction 0.015
  // hate me for the globals ... Begin philipp mod
***************
*** 31,40 ****
  mpegOut::mpegOut(char* filename) {
  	BTRACK;
  	//	fprintf(stderr, "constructing mpegOut %s\n",filename);
! 	if (!access(filename, F_OK)) {
  		// file already exist
  		//fprintf(stderr,"File %s already exist\n",filename);
  	}
  	//open file for writing/truncate
  	MpegOut = fopen(filename, "wb");
  
--- 36,53 ----
  mpegOut::mpegOut(char* filename) {
  	BTRACK;
  	//	fprintf(stderr, "constructing mpegOut %s\n",filename);
! #ifndef _WIN32
!  	if (!access(filename, F_OK)) {
  		// file already exist
  		//fprintf(stderr,"File %s already exist\n",filename);
  	}
+ #else
+     struct _stat stat_buf;
+ 	if (!_stat(filename, &stat_buf)) {
+ 		// file already exist
+ 		//fprintf(stderr,"File %s already exist\n",filename);
+ 	}
+ #endif
  	//open file for writing/truncate
  	MpegOut = fopen(filename, "wb");
  
***************
*** 1555,1561 ****
  				//file has to be opened
  				filename  = new char[300];
  				n_audio++;
! 				sprintf(filename,"%s-%d.mp%d", basename, streamnumber, Mpeg->Audio->layer);
  				AudioFile[streamnumber] = openfile(filename);					
  				delete[] filename;
  			}
--- 1568,1579 ----
  				//file has to be opened
  				filename  = new char[300];
  				n_audio++;
!                 if( streamnumber ) {
!                   sprintf(filename,"%s-%d.mp%d", basename, streamnumber, Mpeg->Audio->layer);
!                 }
!                 else{
!                   sprintf(filename,"%s.mp%d", basename, Mpeg->Audio->layer);
!                 }
  				AudioFile[streamnumber] = openfile(filename);					
  				delete[] filename;
  			}
***************
*** 1567,1573 ****
  
  				//video packet
  				streamnumber=mark&0x0F;
! 				if (VideoFile[streamnumber]){
  					//file is already opened
  				}
  				else{
--- 1585,1591 ----
  
  				//video packet
  				streamnumber=mark&0x0F;
! 				if ( 1 || VideoFile[streamnumber]){
  					//file is already opened
  				}
  				else{
Index: mpegOut.hh
===================================================================
RCS file: /home/tito/cvsroot/mpgtx/src/mpegOut.hh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** mpegOut.hh	2005/01/29 07:41:49	1.1.1.1
--- mpegOut.hh	2005/01/29 08:49:56	1.2
***************
*** 12,19 ****
  #include "mpeg.hh"
  // required by access()
  // FIXME: Still needed, because we have mpgtx_access()?
  #include <unistd.h>
! 
  
  class mpeg;
  
--- 12,20 ----
  #include "mpeg.hh"
  // required by access()
  // FIXME: Still needed, because we have mpgtx_access()?
+ #ifndef _WIN32
  #include <unistd.h>
! #endif
  
  class mpeg;

バイナリとソース

ftp://gpm.jp/mpgtx/mpgtx.exe
windows用バイナリ。ただコンパイルを通しただけ。動作未確認。

ソース:ftp://gpm.jp/mpgtx/mpgtx-1.3.1-r_win32-1.lzh


ftp://gpm.jp/mpgtx/mpgtxa.exe

  • videoデータは出力しない。
  • 出力ファイル名の仕様を変更。

変更前:

foo-0.mp2 foo-1.mp2 foo-2.mp2

変更後:

foo.mp2   foo-1.mp2 foo-2.mp2

ソース:ftp://gpm.jp/mpgtx/mpgtx-1.3.1-r_win32-woV-1.lzh


使用コンパイラ VisualC++ toolkit 2003

>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

添付ファイル: filempgtx-win32-patch.txt 1478件 [詳細]

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-07-16 (金) 08:59:01 (5032d)