|
Christian Graus wrote:
Given that DX9 is an utter joke,
Considering that DirectX was written as a fast interface between games and video cards, and not a full featured media player, it's no suprise that it's not doing the job you want it to do.
The Windows Media Player control will do the job, but it's doesn't have a very friendly developer interface.
The best method would be to write your own component using Windows MultiMedia API's. This will give you the best control with the greatest flexibility, but also will force you to write a large amount of code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
not a full featured media player, it's no suprise that it's not doing the job you want it to do.
Well, actually, if the two classes in the AudioVideoPlayback namespace worked at all, then they would be perfect. I don't need much, just for videos to play, and a callback when they end. I've written an article on the site if you're interested to know all the ways in which this utterly fails to work.
Dave Kreskowiak wrote:
The Windows Media Player control will do the job, but it's doesn't have a very friendly developer interface.
So I have discovered
Dave Kreskowiak wrote:
The best method would be to write your own component using Windows MultiMedia API's. This will give you the best control with the greatest flexibility, but also will force you to write a large amount of code.
I just may spend the weekend doing that. I didn't realise it was an option, that is to say, I did not know they existed. I'll check it out.
thanks.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I'm taking over an application from a developer that just left the company. The application is mostly "completed" with just a few bugs and a couple pieces of functionality I'll have to add (no big deal). It's really just a datagrid tied to a sequel server through a proper dataset. The user has several types of searches possible and for each one there is a different TableStyle used in the DataGrid but in any case the same dataset is used.
My problem is that they want to sort by clicking on the column headers. I know I can turn that on easy enough (and I have). However, it doesn't "appear" that the DataTable being bound to the dataset of the datagrid is being reordered with the dataview of the datagrid (too many freagin data's). Anyway, I know I could do a Select() against the DataSet() using the "MappingName" of the Column Header. This SHOULD give me the same ordering that the grid control is giving me, right?
Is there a way to automate this? The reason I need the grid's "view" and the datatable to stay in Sync (order wise) is if a user-double clicks a row it opens an editor dialog with alot of custom options that wouldn't really work by in-line editing. Also, if the user sorts by the column header I want to be able to retain the proper selected record (if one was selected) once the list is redrawn.
Any help? I can probably hack something but I'd really like to do it properly. I'm a bit new to using this control and, in fact, Datasets, etc.
|
|
|
|
|
Is there a way in C# to specify the hostname in a sql connection string. I know it can be done in C++, but I have searched the documentation for c# and it doesn't appear to be an option.
I am trying to replace the hostname (which by default is the machine name) with an app name so when I do an SP_WHO I can see exactly what app is responsible for what connection.
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
It has nothing to do with C# - merely the ADO.NET provider (or OLE DB provider, if using the System.Data.OleDb namespace members).
SQL Server supports a hostname. This is the "Data Source" property, where "Initial Catalog" is the database on that RDBMS.
Example:
string connstr = string.Format("Data Source={0}; Initial Catalog=MyDB; " +
"Integrated Security=SSPI", hostname);
using (SqlConnection = new SqlConnection(connstr))
{
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
Atlast I have implemented my program to convert an array of Pixel data.
step1)- first of all My original image is a 1650x2544 (widthxheight) and i have stored all the pixel data into an array of (2544x1650).
step2)- I have created an empty Bitmap of respective height and width.
step3)- Now i copied respective pixel data fromt the array data into all the 3 planes (R,G,B). as i am creating a monochrome image i am copying the same value for each three R,G,B values.
step4)- returning the image...
can anyone tell me whether wht i am doin is correct...
here is the code...
private void File_Open(object sender, System.EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = "c:\\" ;
openFileDialog.RestoreDirectory = true ;
int[,] PixelData;
int Height=0, Width=0, j;
if(DialogResult.OK == openFileDialog.ShowDialog())
{
ChosenFile=openFileDialog.FileName;
PixelData = ConvertFile(ref Height, ref Width);
m_Bitmap =new Bitmap(Width,Height,PixelFormat.Format24bppRgb);
if (Display (m_Bitmap, PixelData))
{
this.AutoScroll = true;
this.AutoScrollMinSize = new Size ((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
this.Invalidate();
}
}
}
int[,] ConvertFile(ref int H, ref int W)
{
int Height=0, Width=0, RGBWidth=0, Value=0, i;
int[] LUT = new int[4096];
FileStream InStream = new FileStream(ChosenFile, FileMode.Open, FileAccess.Read);
long nBytesToRead = InStream.Length;
byte[] ByteArray = new byte[2];
for ( i=0; i<256; ++i)
{
LUT[j]=LUT[j+1]=LUT[j+2]=LUT[j+3]=LUT[j+4]=LUT[j+5]=LUT[j+6]=LUT[j+7]=LUT[j+8]=
LUT[j+9]=LUT[j+10]=LUT[j+11]=LUT[j+12]=LUT[j+13]=LUT[j+14]=LUT[j+15]=i;
j=j+16;
}
for (i=0; i<nbytestoread; i+="2)
{"
int="" nextbyte="(int)" instream.read(bytearray,="" 0,="" 2);
="" if="" (="" i="">=4 && i<=7)
{
if ( i==4)
Height = (int)BinaryToDecimal(ByteArray);
else
Width = (int)(BinaryToDecimal(ByteArray))/2;
}
else if ( i>=128 )
{
break;
}
}
H = Height;
W = Width;
RGBWidth = Width*3;
int[,] PixelData = new int[Height,Width];
for (int x=0; x<height; ++x)
{
for="" (int="" y="0;" y<width;="" ++y)
{
int="" nextbyte="(int)" instream.read(bytearray,="" 0,="" 2);
value="LUT[BinaryToDecimal(ByteArray)];
" pixeldata[x,y]="Value;
i" +="2;
if" (i="">=nBytesToRead)
break;
}
if (i>=nBytesToRead)
break;
}
return PixelData;
}
public static bool Display(Bitmap b, int[,] PixelData)
{
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
int j;
unsafe
{
byte * p = (byte *)(void *)Scan0;
int nOffset = stride - b.Width*3;
for ( int y=0; y< b.Height; ++y)
{
for ( int x=0; x< b.Width; ++x)
{
p[0] = (byte)(255-PixelData[y,x]);
p[1] = (byte)(255-PixelData[y,x]);
p[2] = (byte)(255-PixelData[y,x]); p += 3;
}
p += nOffset;
}
}
b.UnlockBits(bmData);
GrayScale (b);
return true;
}
But I am not getting the image tht i am supposed to get...
thanks in advance,
Suman
|
|
|
|
|
Read my image processing articles in the C# Multimedia section to see how you can access bytes within the image without the copy stage you're taking.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi Graus,...
hmm... atlast I succeded in doin it... and i am able to view the image...and save it as a bitmap..
thanks alot for ur support and advices and sorry for disturbing u so many times on this issue...
ok then catch u later over my project doubts...
Suman
|
|
|
|
|
Hi Graus,
I am trying to plot the histogram of an image.... i am able to calculate all the values required to plot the histogram... but i dont know how to plot it in C#... can u advise me wht i have to do to pop-up a window and show the plot in it ( i mean to plot the graph in it)....
Thanks in advance,
Suman
|
|
|
|
|
My boss has given me an order to display our word documents in PDF format.. Anyway of doing this in C##?
Any advice would be appreciated..
|
|
|
|
|
I believe there's a couple of .NET pdf tools that advertise on the site. There's nothing built in.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
i am developing an image processing application as an assignment. i need help. how to rotate an image to any degree from 0 to 360. i have used the buildin method
new Bitmap(fileDialog.FileName).RotateFlip(RotateFlipType.Rotate180FlipNone);
but these r limited options. further more it would be great if unsafe code would be used.
Ahmad Zafar
|
|
|
|
|
ahmadzafar wrote:
further more it would be great if unsafe code would be used.
ROTFL. Brilliant. You're right, you'll need to use unsafe code, I just like that you WANT to
If you read my article on displacement filters (C#/Multimedia section), you'll see a swirl filter. That filter rotates an image by an amount that increases as you go out from the centre. If you took out the code that changes the rate of rotation, it will rotate images for you, I'm pretty sure. If not, let me know, and I'll walk you through it. I find it works best to use polar co-ordinates, then it's simply a case of applying a rotation. As occurs in my article, you should offer at least bilinear filtering, because you're going to get mostly non-perfect pixels when you rotate an image.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
did you try using the Graphics.RotateTrasform(float angle) method? if you're actually drawing the image onscreen, i think it's very usefull
there are no facts, only interpretations
|
|
|
|
|
sir thank u very much for ur help and guidance but there is one problem ... i dont want to use Graphics.DrawImage or any such coz my idea is to chnage the image in the PictureBox and rotate it actually
can u plz help as i read all ur 6 articles on image processing and they really helped especially tht all of them have unsafe code in them. kindly sir guide me in rotating an image to any degree in a picBox using unsafe code
Ahmad Zafar
|
|
|
|
|
u'r welcome.
the "quick and dirty" way is to use DrawImage and rotate the graphics, and then copy those graphics to a new bitmap. i think you will have to use unmanaged gdi for this (creating Device Context etc.) Otherwise u need to do the dirty work yourself
ahmadzafar wrote:
i read all ur 6 articles
I think u'r confusing me with the guy who replied above me. He has great articles, I have none.
by the way, unsafe code is used here, i think, for performance (speed), when u'r accessing each pixel's content.
there are no facts, only interpretations
|
|
|
|
|
sir how r u ... one more thing i wanted to know ... u have any idea how to compress an image size?
Ahmad Zafar
|
|
|
|
|
Does anyone know how this can be done? I'm currently using System.IO.Path.GetTempFileName( ) which returns a filename in the short format but I would prefer it to be in the long format. So any ideas?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Unfortunately there is no built-in managed way to get this result.
You'll have to use P/invoke to call GetLongFileName() .
mav
|
|
|
|
|
I have a main worker thread that spawns a child thread to do some listening. What I'd like to happen is to have the child thread raise an event in the parent, but it seems it can only raise events in it's own thread.
Is there any way to have one thread raise events in another thread? Is this even possible?
Thanks
|
|
|
|
|
Yes
http://www.codeproject.com/csharp/H5CsThreading.asp
and many other articles. "C# thread" in the search above will find them.
Gary
|
|
|
|
|
I want to write an APP for window media player to play a video.
What should i do?
|
|
|
|
|
Customize your toolbox by right-clicking your toolbox in Visual Studio .NET and selecting "Customize..." (or equivalent). Find the Windows Media Player under the COM tab and add it to the list. Click OK.
Now just drag and drop it on your Windows Forms designer and fill-in the properties. If you need help with properties and methods exposed by the Windows Media Player control, read the SDK[^].
Note that this will create two additional assemblies that must be deployed with your application and Windows Media Player (whichever version you host in your Windows Forms application) must still be present on the user's system (most often, a newer version will work as well though you should always test against newer versions). The interop assemblies that are created automatically are only to expose COM components to .NET - they do not implement the functionality they encapsulate.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
^---- That's an option but I think you'll find that WMP is hugely bloated. It really isn't great for development. I recommend strongly (having done this myself) that you take a close look at wrapping MCI calls directly. It's not difficult and gives you the best control you'll find without the massive bloat.
|
|
|
|
|
I want to send a partition of video file and some data files(text and images) from one terminal to another terminal. After sending, the video should be playable.
Therefore, I have to write a program that perform streaming.
1.-RTSP / RTP, which is better?
2.-Shall i choose to use WMV, ASF or AVI file?
3.-Any other methods are welcome.
Please help me.
|
|
|
|