remove unnecessary ffmsindex.cpp
Originally committed to SVN as r2349.
This commit is contained in:
parent
eb38d1820f
commit
ecfc2b96c3
2 changed files with 62 additions and 93 deletions
|
@ -19,41 +19,30 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#include "ffmsindex.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "ffms.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
try {
|
||||
ParseCMDLine(argc, argv);
|
||||
} catch (const char *Error) {
|
||||
std::cout << std::endl << Error << std::endl;
|
||||
return 1;
|
||||
} catch (std::string Error) {
|
||||
std::cout << std::endl << Error << std::endl;
|
||||
return 1;
|
||||
} catch (...) {
|
||||
std::cout << std::endl << "Unknown error" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
int TrackMask;
|
||||
bool Overwrite;
|
||||
std::string InputFile;
|
||||
std::string CacheFile;
|
||||
std::string AudioFile;
|
||||
|
||||
FFMS_Init();
|
||||
FrameIndex *Index;
|
||||
|
||||
try {
|
||||
DoIndexing();
|
||||
} catch (const char *Error) {
|
||||
std::cout << Error << std::endl;
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 1;
|
||||
} catch (...) {
|
||||
std::cout << std::endl << "Unknown error" << std::endl;
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 0;
|
||||
void PrintUsage () {
|
||||
using namespace std;
|
||||
cout << "FFmpegSource2 indexing app" << endl
|
||||
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl
|
||||
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
|
||||
<< "Options:" << endl
|
||||
<< "-f Overwrite existing index file if it exists (default: no)" << endl
|
||||
<< "-t N Set the audio trackmask to N (-1 means decode all tracks, 0 means decode none; default: 0)" << endl
|
||||
<< "-a NAME Set the audio output base filename to NAME (default: input filename)";
|
||||
}
|
||||
|
||||
|
||||
void ParseCMDLine (int argc, char *argv[]) {
|
||||
if (argc <= 1) {
|
||||
PrintUsage();
|
||||
|
@ -108,16 +97,24 @@ void ParseCMDLine (int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
void PrintUsage () {
|
||||
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private) {
|
||||
using namespace std;
|
||||
cout << "FFmpegSource2 indexing app" << endl
|
||||
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl
|
||||
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
|
||||
<< "Options:" << endl
|
||||
<< "-f Overwrite existing index file if it exists (default: no)" << endl
|
||||
<< "-t N Set the audio trackmask to N (-1 means decode all tracks, 0 means decode none; default: 0)" << endl
|
||||
<< "-a NAME Set the audio output base filename to NAME (default: input filename)";
|
||||
int *LastPercentage = (int *)Private;
|
||||
int Percentage = int((double(Current)/double(Total)) * 100);
|
||||
|
||||
if (Percentage <= *LastPercentage)
|
||||
return 0;
|
||||
|
||||
*LastPercentage = Percentage;
|
||||
|
||||
if (Percentage < 10)
|
||||
cout << "\b\b";
|
||||
else
|
||||
cout << "\b\b\b";
|
||||
|
||||
cout << Percentage << "%";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,22 +151,34 @@ void DoIndexing () {
|
|||
}
|
||||
|
||||
|
||||
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private) {
|
||||
using namespace std;
|
||||
int *LastPercentage = (int *)Private;
|
||||
int Percentage = int((double(Current)/double(Total)) * 100);
|
||||
int main(int argc, char *argv[]) {
|
||||
try {
|
||||
ParseCMDLine(argc, argv);
|
||||
} catch (const char *Error) {
|
||||
std::cout << std::endl << Error << std::endl;
|
||||
return 1;
|
||||
} catch (std::string Error) {
|
||||
std::cout << std::endl << Error << std::endl;
|
||||
return 1;
|
||||
} catch (...) {
|
||||
std::cout << std::endl << "Unknown error" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Percentage <= *LastPercentage)
|
||||
return 0;
|
||||
FFMS_Init();
|
||||
|
||||
*LastPercentage = Percentage;
|
||||
try {
|
||||
DoIndexing();
|
||||
} catch (const char *Error) {
|
||||
std::cout << Error << std::endl;
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 1;
|
||||
} catch (...) {
|
||||
std::cout << std::endl << "Unknown error" << std::endl;
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Percentage < 10)
|
||||
cout << "\b\b";
|
||||
else
|
||||
cout << "\b\b\b";
|
||||
|
||||
cout << Percentage << "%";
|
||||
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) 2008 Karl Blomster
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "ffms.h"
|
||||
|
||||
|
||||
int TrackMask;
|
||||
bool Overwrite;
|
||||
std::string InputFile;
|
||||
std::string CacheFile;
|
||||
std::string AudioFile;
|
||||
|
||||
FrameIndex *Index;
|
||||
|
||||
void PrintUsage();
|
||||
void ParseCMDLine(int argc, char *argv[]);
|
||||
void DoIndexing();
|
||||
|
||||
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private);
|
Loading…
Reference in a new issue