문제

I'm dying to know how I can make a GUI for ffmpeg and jhead in OSX. I've been looking for a solution for a while and thought you, stackoverflow's users, could help me. Maybe you know some document I haven't come across of or, better, a tutorial to make a GUI.

I love those two tools but I like the simplicity of drag/drop operations.

Note: I don't need a GUI for them, I want to make one.

도움이 되었습니까?

해결책

There is a tutorial for wrapping command-line tools using NSTask, on the Cocoa Dev Central site:

It's a few years old now, but should get you started.

다른 팁

If you are asking "How do I create a GUI application in Mac OS X that interfaces to a command line tool" the answer is NSTask. Although, if the command line tool provides a programming API, using that would be preferable to invoking the command line tool itself.

If you are asking "How do I create a GUI application in Mac OS X" the answer is to read a book about it and look at the Apple tutorial docs. Cocoa Programming on Mac OS X by Aaron Hillegass was my starting point.

First create a Modal Dialog NIB with the needed GUI.
When called in C , create an NSReleasePool, and then the magic sauce.

[NSApplication sharedApplication]     
ProcessSerialNumber psn;
GetCurrentProcess( &psn );
TransformProcessType(&psn,kProcessTransformToForegroundApplication);
SetFrontProcess( &psn );

Later after you load the NIB from the Bundle, issue

[NSApp runModalForWindow:[controller window]];
[[controller window] close];

Without the TransfromProcessType(), the Terminal app will get keystrokes, not the Modal Dialog.

This may not be the best answer but in the book "Xcode unleashed" is a chapter how to embed a Command Line Tool inside a Cocoa Application. Maybe you should have a look. Nice book anyway.

You can use a scripting language like Tcl, Python or Ruby with a toolkit like Tk which uses native widgets on the mac.

On your Leopard/Snow Leopard disk you can find XCode, but you can also download it from the Apple Developer Community. XCode comes with the Interface Builder, which lets you build GUI's and you can rig to your commands using the Cocoa framework.

You are too late, there is already a GUI frontend for ffmpeg called ffmpegX, but anyway, you would create a model that either wraps or uses the library or executable.... if it uses the executable you can use popen to invoke the executable, write to its STDIN, and read from its STDOUT. The view and controller would be basically the same as you would design it for any other GUI application. Since this is a Cocoa post, you could use Objective-C and Cocoa to the make the GUI, but it really can be implemented in any language.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top