Hello I have built VLC Qt Library in QT 5.5.1 on Ubuntu.
Now I want to add snapshot feature in it. Is there anyway or any idea?
Please mention. If you have even little bit of idea.
you should use the VlcVideo class in this library.
at first create a new object from this class. then use this function:
bool VlcVideo::takeSnapshot ( const QString & path ) const
you can find more details about the VlcVideo class from this link:
https://vlc-qt.tano.si/reference/1.1/classVlcVideo.html#a4f3a741285dd9030f76bb996eaa011d4
a very simple code can be like this:
#include "MayClass.h"
#include "VLCQtCore/Video.h"
void MayClass::initMembers()
{
_instance = new VlcInstance(VlcCommon::args(), this);
_player = new VlcMediaPlayer(_instance);
_video = new VlcVideo(_player);
}
void MayClass::takeSnapShot(QString filename)
{
_video->takeSnapshot(filename);
}
Related
I am making a new mod and my block textures work fine but my item textures dont
i need assistance on this because i just started to code java
This Is My Script:
package com.HaydenMod.item;
import com.HaydenMod.lib.RefStrings;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class DiamondShard {
public static void MainRegistery(){
intializeItem();
registerItem();
}
public static Item Dshard;
public static void intializeItem(){
Dshard = new Item().setUnlocalizedName("Dshard").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(RefStrings.MODID + ":Diamond_Shard").setMaxStackSize(16);
}
public static void registerItem(){
GameRegistry.registerItem(Dshard, Dshard.getUnlocalizedName());
}
}
Try
.setTextureName(RefStrings.MODID + ":" + "Diamond_Shard")
If it dosn't work can you attach a pastebin with the error log
YourItemName= new Item().setUnlocalizedName("YourItemName").setTextureName("yourModFile:YourtextureImageNAme").setCreativeTab(TheCreativeTabYouWantToPutItIn);
This is what is used and it works perfectly. The TextureName has to be exactly the same as the TextureName in the source folder.
For example, my TextureName is blah.png and in my source folder. When calling it, should write it as setTextureName("yourModFile:blah").
It's been asked before, but no clear (current) answer seems to be out there.. Is it actually possible to build a Cocoa app, WITH a Main Menu, exclusively from code (no MainMenu.xib, etc.) in such a way that it will still pass scrutiny when submitted to the app store? If so, what is the magic incantation(s) to get this to work?
Extra credit if someone can point me to a tutorial or document that's not from 2002 and works on mavericks..
Well, it certainly used to be possible.
I’d start by looking in main.m, and replace NSApplicationMain() with NSApplicationLoad(), so you get an NSApplication object.
Then you can create an NSMenu using standard NSMenu methods (-addItem:, etc), and then call
[NSApplication sharedApplication].mainMenu = myMenu;
Then, you know, make an NSWindow, show that, etc.
Of course, there are a lot of menu items that Apple sets up for you when you launch, that you might not get when you do this. You’d have to add them by hand if so.
This really isn’t something I recommend, but there you go.
http://blog.moostep.com/xamarin-mac-helloworld-application-without-xib/
http://blog.moostep.com/creating-menu-for-xamarin-mac-app-using-csharp/
I don't know enough about Mac App Store to know if this will pass muster. I assume you can translate it from C# to Objective-C. It doesn't use any special Mono or Xamarin features.
Read the blog articles for some background. Meanwhile, I'll paste my versions of main.cs and AppDelegate.cs here:
main.cs:
using System;
using MonoMac.AppKit;
namespace XibFreeCocoaApp
{
public class XibFreeCocoaApp
{
static void Main (string[] args)
{
NSApplication.Init ();
var application = NSApplication.SharedApplication;
application.Delegate = new AppDelegate();
application.Run ();
}
}
}
AppDelegate.cs:
using System;
using System.Drawing;
using MonoMac.AppKit;
using MonoMac.Foundation;
namespace XibFreeCocoaApp
{
public class AppDelegate : NSApplicationDelegate
{
public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
{
CreateMenu (NSProcessInfo.ProcessInfo.ProcessName);
var window = new NSWindow (
new RectangleF (0, 0, 400, 300),
NSWindowStyle.Titled,
NSBackingStore.Buffered,
false) {
Title = "Xib Free Cocoa App with Menu"
};
window.CascadeTopLeftFromPoint (new PointF (20, 20));
window.MakeKeyAndOrderFront(null);
}
void CreateMenu (string appName)
{
var mainMenu = new NSMenu();
var appMenuItem = new NSMenuItem ();
mainMenu.AddItem (appMenuItem);
var appMenu = new NSMenu ();
var quitMenuItem = new NSMenuItem (String.Format ("Quit {0}", appName), "q", delegate {
NSApplication.SharedApplication.Terminate(mainMenu);
});
appMenu.AddItem (quitMenuItem);
appMenuItem.Submenu = appMenu;
NSApplication.SharedApplication.MainMenu = mainMenu;
}
}
}
Be aware that the code above will not change the title of menu items that have a submenu - to do this you need to assign title to the Submenu as well like so:
NSMenuItem someMenuItem = new NSMenuItem("Title 1");
NSMenu someMenuItemSubMenu = new NSMenu();
someMenuItemSubMenu.Title = "Title 2";
someMenuItem.Submenu = someMenuItemSubMenu;
The displayed tile in this case will be "Title 2", not "Title 1" (actually "Title 1" will be completely ignored).
I'm new to JavaCV and I have difficult time finding good tutorials about different issues on the topics that I'm interested in. I've succeed to implement some sort of real time video streaming from my webcam but the problem is that I use this code snippet which I found on the net :
#Override
public void run() {
FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next
// camera
int i = 0;
try {
grabber.start();
IplImage img;
while (true) {
img = grabber.grab();
if (img != null) {
cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise
cvSaveImage((i++) + "-aa.jpg", img);
// show image on window
canvas.showImage(img);
}
that results in multiple jpg files.
What I really want to do is capture my webcam input and along with showing it I want to save it in a proper video file. I find out about FFmpegFrameRecorder but don't know how to implement it. Also I've been wondering what are the different options for the format of the video file, because flv maybe would be more useful for me.
It's been quite a journey. Still a few things that I'm not sure what's the meaning behind them, but here is a working example for capturing and recording video from a webcam using JavaCV:
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.OpenCVFrameGrabber;
import com.googlecode.javacv.cpp.avutil;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
public class CameraTest {
public static final String FILENAME = "output.mp4";
public static void main(String[] args) throws Exception {
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
grabber.start();
IplImage grabbedImage = grabber.grab();
CanvasFrame canvasFrame = new CanvasFrame("Cam");
canvasFrame.setCanvasSize(grabbedImage.width(), grabbedImage.height());
System.out.println("framerate = " + grabber.getFrameRate());
grabber.setFrameRate(grabber.getFrameRate());
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(FILENAME, grabber.getImageWidth(),grabber.getImageHeight());
recorder.setVideoCodec(13);
recorder.setFormat("mp4");
recorder.setPixelFormat(avutil.PIX_FMT_YUV420P);
recorder.setFrameRate(30);
recorder.setVideoBitrate(10 * 1024 * 1024);
recorder.start();
while (canvasFrame.isVisible() && (grabbedImage = grabber.grab()) != null) {
canvasFrame.showImage(grabbedImage);
recorder.record(grabbedImage);
}
recorder.stop();
grabber.stop();
canvasFrame.dispose();
}
}
It was somewhat hard for me to make this work so in addition to those that may have the same issue, if you follow the official guide about how to setup JavaCV on Windows 7/64bit and want to capture video using the code above you should create a new directory in C:\ : C:\ffmpeg and extract the files from the ffmped release that you've been told to download in the official guide. Then you should add C:\ffmpeg\bin to your Enviorment variable PATH and that's all. About this step all credits go to karlphillip
and his post here
import com.sun.speech.freetts.*;
import java.util.*;
public class Demofreetts
{
private String speaktext;
public void doSpeak(String speak, String voice)
{
speaktext = speak;
try
{
VoiceManager voiceManager = VoiceManager.getInstance();
Voice voices = voiceManager.getVoice(voice);
Voice sp = null;
if(voices != null)
sp = voices;
else
System.out.println("No Voice Available");
sp.allocate();
sp.speak(speaktext);
sp.deallocate();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[]args)
{
Demofreetts obj = new Demofreetts();
obj.doSpeak(args[0],"Kelvin16");
}
}
The above code causes the following error:
System property "mbrola.base" is undefined. Will not use MBROLA voices
No Voice Available
java.lang.NullPointerException
at Demofreetts.doSpeak(Demofreetts.java:24)
at Demofreetts.main(Demofreetts.java:39)
You can convert the text to speech in Java using freetts1.2 API. It is quite simple to use. This link could be useful for you. It has an example program
http://learnsharelive.blogspot.com/2011/01/convert-text-to-speech-java-freetts12.html
just add System.setProperty
System.setProperty("mbrola.base", "C:\\Users\\iup\\workspace\\newpro\\mbrola");
VoiceManager voiceManager = VoiceManager.getInstance();
Here is the solution
Change the string voice parameter to one of the following.
1.kevin16 (all letters should be written in small case)
2.alan (this is also your next option alternate to kevin16 voice.
but the message
System property "mbrola.base" is undefined. Will not use MBROLA voices. Still exist but you can get the voice that you need.fortunately you can solve this problem by setting the property of mbrola voice. Using
System.setProperty (" mbrola.base" ,"here the pathof property");.
Anyways it works for me please give it a try.
How can I get the list of all DLL dependencies of a given DLL or EXE file?
In other words, I'd like to do the same as the "Dependency walker" tool, but programmatically.
What is the Windows (ideally .NET) API for that?
You can use EnumProcessModules function. Managed API like kaanbardak suggested won't give you a list of native modules.
For example see this page on MSDN
If you need to statically analyze your dll you have to dig into PE format and learn about import tables. See this excellent tutorial for details.
NOTE: Based on the comments from the post below, I suppose this might miss unmanaged dependencies as well because it relies on reflection.
Here is a small c# program written by Jon Skeet from bytes.com on a .NET Dependency Walker
using System;
using System.Reflection;
using System.Collections;
public class DependencyReporter
{
static void Main(string[] args)
{
//change this line if you only need to run the code one:
string dllToCheck = #"";
try
{
if (args.Length == 0)
{
if (!String.IsNullOrEmpty(dllToCheck))
{
args = new string[] { dllToCheck };
}
else
{
Console.WriteLine
("Usage: DependencyReporter <assembly1> [assembly2 ...]");
}
}
Hashtable alreadyLoaded = new Hashtable();
foreach (string name in args)
{
Assembly assm = Assembly.LoadFrom(name);
DumpAssembly(assm, alreadyLoaded, 0);
}
}
catch (Exception e)
{
DumpError(e);
}
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
static void DumpAssembly(Assembly assm, Hashtable alreadyLoaded, int indent)
{
Console.Write(new String(' ', indent));
AssemblyName fqn = assm.GetName();
if (alreadyLoaded.Contains(fqn.FullName))
{
Console.WriteLine("[{0}:{1}]", fqn.Name, fqn.Version);
return;
}
alreadyLoaded[fqn.FullName] = fqn.FullName;
Console.WriteLine(fqn.Name + ":" + fqn.Version);
foreach (AssemblyName name in assm.GetReferencedAssemblies())
{
try
{
Assembly referenced = Assembly.Load(name);
DumpAssembly(referenced, alreadyLoaded, indent + 2);
}
catch (Exception e)
{
DumpError(e);
}
}
}
static void DumpError(Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Error: {0}", e.Message);
Console.WriteLine();
Console.ResetColor();
}
}
To get native module dependencies, I believe it should be ok to get it from the PE file's import table, here are 2 links which explain that in-depth:
http://msdn.microsoft.com/en-us/magazine/bb985992.aspx
http://msdn.microsoft.com/en-us/magazine/cc301808.aspx
To get .NET dependencies, we can use .NET's API, like Assembly.Load.
To get a .NET module's all dependencies, How about combine the 2 ways - .NET assemblies are just PE file with meta data.
While this question already has an accepted answer, the documentation referenced in the other answers, where not broken, is old. Rather than reading through all of it only to find it doesn't cover differences between Win32 and x64, or other differences, my approach was this:
C:\UnxUtils\usr\local\wbin>strings.exe E:\the-directory-I-wanted-the-info-from\*.dll > E:\TEMP\dll_strings.txt
This allowed me to use Notepad++ or gvim or whatever to search for dlls that were still depending on MS dlls with 120.dll at the end of the dll name so I could find the ones that needed updating.
This could easily be scripted in your favorite language.
Given that my search for this info was with VS 2015 in mind, and this question was the top result for a Google search, I supply this answer that it may perhaps be of use to someone else who comes along looking for the same thing.
To read the DLL's (modules) loaded by a running exe, use the ToolHelp32 functions
Tool help Documentation on MSDN.
Not sure what it will show for a .Net running exe (I've never tried it). But, it does show the full path from where the DLL's were loaded. Often, this was the information I needed when trying to sort out DLL problems. .Net is supposed to have removed the need to use these functions (look up DLL Hell for more information).
If you don't want to load the assembly in your program, you can use DnSpy (https://www.nuget.org/packages/dnSpyLibs):
var assemblyDef = dnlib.DotNet.AssemblyDef.Load("yourDllName.dll");
var dependencies = assemblyDef.ManifestModule.GetAssemblyRefs();
Notice that you have all the infos you can want in the "ManifestModule" property.