Is there a way in MVVMCross, without creating my own plugin, to open a file stream for writing and/or for reading? The MvxFileStore only supports byte array reading and writing and i could really use some stream handling here to manage big files or streaming encryption.
I am currently using MVVMCross 3.0.14.
The built in interface does provide you with two file stream methods - see WriteFile and TryReadBinaryFile in https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/File/Cirrious.MvvmCross.Plugins.File/IMvxFileStore.cs
If these aren't sufficient for you, then you could create and inject your own IStreamFileService implementations - you don't have to do this as a plugin, you can just define them in your platform specific code, and register them in setup.
plugins have reusability advantages, but implementing direct in the UI projects is perfectly acceptable too - whatever your app needs.
Related
In a course I am enrolled in, I was tasked to create a filesystem with some custom features. I simply created an image of zeroes using dd, and created my filesystem by creating superblock, inodes, stat files, etc. for it. It can read/write files, import and export files and directories, with proper directory hierarchy.
Now I want to make this work with an actual physical partition. I looked at many places, and saw that file descriptors can be read as plain files. But I want to know if it relies on existing filesystem in the partition. Can I bypass everything and simply get a block-wise read/write interface, and with ability to seek to bytes or blocks? What would be the overhead on that?
Also, I want to turn it into a linux module so that my filesystem can work with file managers. What is the standard API interface that I need to implement to make it happen?
Please guide me to the right direction.
You have a lot of options; integration into the kernel is relatively hard, whereas integrating with a user space file system framework (libfuse on github) is a good intermediate step. At the end, you will have a usable file system.
My question is basically that I am new to this framework and I am looking at pointers to how to work with non-file sources in media foundation since the documentation in this front seems lacking in my mind. Below is some info on what I am doing and what approach I am working with right now but I have no idea if it is the correct way to use the framework.
I am currently trying to use Microsoft Media Foundation to decode audio that I'm getting over Bluetooth and then send it along as PCM audio. When looking at the documentation for ms media foundation it seems that almost all examples assume the source is a file.
Looking at the tutorial for decoding audio for example they use MFCreateSourceReaderFromURL, which I cannot use since my source is not a file.
As I wanted to follow the tutorial and change as little as possible Im thinking that I need only change how I create the source reader and the rest of the process would be the same. I looked at the other SourceReaders available and MFCreateSourceReaderFromByteStream sounds about right for my purposes.
Is there a chance that I only need to create a bytestream and continuously fill it with data that I get over the air as we go and the media source created by MFCreateSourceReaderFromByteStream handle this well? Or do I need to create a custom media source and do more manual work at the lower parts of the API to get something like this to work?
Or maybe a source reader is the wrong approach altogether when the source is not a file? In the main page about Source Reader here they have the following picture:
And this picture shows the media source within the source reader pointing to a source file only, is this a real limitation or simply and example?
Im writing this in plain c, but pointing to c++ documentation or examples is fine as its usually pretty straightforward to translate c++ to c and there seems to be no documentation for c anyways.
Edit:
Im adding a image on what kind of data Im getting, the red area being the chunks of data I refer to in comments below Source.
Non-file source is not a accurate description. Does it have a file structure, just not a file? Structured differently? Raw stream?
If you look at samples with source reader, they assume presence and usage of stream handler capable to parse incoming stream into elementary streams with known type and properties. Then you or Media Foundation could apply decoder or otherwise transform the data.
As you specified that the data come "in chunks", most likely that you are interested in an alternate option to use AAC Decoder explicitly. You can create an instance of it, initialize input and output types, then feed it with compressed audio and pull decoded PCM on the output. The decoder has MFT interface.
I'm trying to make a server that receives RTP/H264 video streams from android clients and stores these to file.
Currently I'm using VLC in the server, which works well. However, I am worried that VLC is a heavyweight solution that may not scale well. As I'm not actually playing the video, only saving it to file, I thought there must a be a more efficient solution.
Currently I'm planning on using an Amazon ec2 instances, so the goal is to serve as many clients as possible per instance.
I'm flexible (willing to learn) on the language side, I'd like to choose the right language for the job.
So, does anyone know of a good, scalable way to store these streams to files?
Thanks in advance!
EDIT
FFmpeg or libav look promising. Looking into them now.
Basically you need an library that supports rtp stack server side, so you can extract the payload and just append to a file as it comes. ffmpeg is a great choice, and it does have rtp stack and it also it can generate containers(MP4,...) for you as well; if needed. Actually VLC uses ffmpeg's libav library under the hood.
I'm developing a WPF based app in C# and I want to play an h.264/aac encoded mp4 file from a stream source that derives from System.IO.Stream.
I can play videos directly from local files, and from a URL source, but I also need to playback video from a data source that derives from System.IO.Stream. Specifically, I'm using a product from Eldos called Solid File System (http://eldos.com/solfs/) which allows you to create virtual file systems inside a single file. To access data stored inside a SolidFS file they offer SolFSStream which derives from System.IO.Stream.
Does anyone know of a .Net Framework API, or third party API that will allow me to play the video by passing in the stream reference?
My preference would be to copy the files to a temp directory that the application can access, then use a simple to use and robust library to play the file e.g http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx
My reasoning would be that supporting stream may not be the best criterea to choose a third party library to play mp4 files. You need to ensure that the library is robust and easy to integrate with your existing application.
Please note, by referring to the MediaPlayer class I am not saying that this is the most robust library, but it has met my use cases in the past and was easy to integrate with the application.
DirectX had some methods to play custom streams, but I don't know details. Also, we offer OS edition of SolFS for usage scenarios like yours - you can have a virtual disk with OS edition and play from there (and disk access can be restricted to only your application and the player for security).
I'm working on a WinForms C# 3.0 / .NET 3.5 project involving building some canned reports. One of the requirements of the project is to export to PDF format, and currently doing so to disk is working just fine. The question was raised, however, if it's possible to export the file to a stream and open it directly in the native viewer on the client, skipping entirely writing it to disk. I know that this is somewhat possible with ASP.Net through the use of Response.Write() headers and the like, but I need to try to do this with standard WinForms/WPF, and I've exhausted my own ideas for it. Anybody have any insight on how it might be done, if it's possible at all? Or does the file have to be written to disk first, then opened separately?
I think it is important that you ask yourself what you accomplish if you bypass the file system. Writing to a the standard temporary folder is a perfectly acceptable solution. This is typically how browsers let you view media files and pdfs. I would concentrate on writing a nice cleanup function, that removes the temporary file after it has been create. Also what would be the purpose of exporting to PDF if you are not saving the file?
Under Unix / Linux you could have made a named pipe in the file system. This make sense if you have a huge media stream that you want to buffer between applications. In the PDF case you win very little.
Export to a temporary folder. It is Ok.
You will need to write the PDF to a temp directory.
The only way to display a PDF from an in-memory stream is to embed a third-party PDF viewer control