Log in

View Full Version : LAV Filters - DirectShow Media Splitter and Decoders


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 [342] 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508

STaRGaZeR
14th February 2014, 19:10
The point is to get lossless decoding, without pairing LAV with dtsdecoder.dll you wouldn't... I have Logitech z-5300e speakers (analog 5.1) paired with a SB X-Fi Titanium Fatal1ty Pro and DTS-HDMA sounds far superior to the DTS core.

QB

This is not what I'm asking:

There's still no way to decode DTS-HD MA in 64-bit players due to the Arcsoft dll being 32-bit only, right?

clsid
14th February 2014, 19:19
Yes, there is no 64-bit decoder available yet. But there is a little hope. Someone on the libav-devel mailinglist might be doing an attempt to implement a decoder for DTS-HD Master Audio. If that is a success, then anything based on Libav/FFmpeg, including LAV Filters, will be able to decode it.

e-t172
14th February 2014, 19:36
What do you mean? They are totally different things and you need both. A soundcard either sends audio to active speakers (i.e. with their own power supply and amplifier), or to an AVR which will amplify the audio signal and send it to passive speakers (among many other things). In the former case, you'd generally use 3.5 mm cables, in the latter case you'd use HDMI (or TOSLINK if you were feeling nostalgic).

Well technically, giosa is correct in that if you use an AVR with HDMI, you don't need a sound card in the DAC sense. Calling an HDMI output a "sound card" is kinda weird since it doesn't actually do anything except "repackage" the PCM stream for transport over HDMI.

IMO active speakers are a total rip-off when it comes to quality and value.

I strongly disagree with that statement and think it's actually the opposite. One good example is the JBL Professional 3 Series (http://www.jblpro.com/www/products/recording-broadcast/3-series) which have an amazing performance/price ratio. Besides, there are very good reasons to prefer active speakers over passive speakers in general. (https://docs.google.com/document/d/1a9dTnNVoVNG88iSHGWwTKKsN-zDe0Qv7VM_1yWP_pFQ/edit#heading=h.g1hkb1ktbfqt)

DarkSpace
14th February 2014, 19:45
Yes, there is no 64-bit decoder available yet. But there is a little hope. Someone on the libav-devel mailinglist might be doing an attempt to implement a decoder for DTS-HD Master Audio. If that is a success, then anything based on Libav/FFmpeg, including LAV Filters, will be able to decode it.
What about other forms of DTS-HD? I'm just curious, and I'm aware that HDMA is the most common variant.

DragonQ
14th February 2014, 20:02
I strongly disagree with that statement and think it's actually the opposite. One good example is the JBL Professional 3 Series (http://www.jblpro.com/www/products/recording-broadcast/3-series) which have an amazing performance/price ratio. Besides, there are very good reasons to prefer active speakers over passive speakers in general. (https://docs.google.com/document/d/1a9dTnNVoVNG88iSHGWwTKKsN-zDe0Qv7VM_1yWP_pFQ/edit#heading=h.g1hkb1ktbfqt)

Just spent 10 minutes writing a reply and the forum lost it because a "token expired". It's off topic anyway so never mind, we can agree to disagree.

nevcairiel
14th February 2014, 20:15
What about other forms of DTS-HD? I'm just curious, and I'm aware that HDMA is the most common variant.

DTS-HD HRA is already partially supported today.
That is, the extra bitrate extensions and the extra channel extensions can be decoded. Missing is the X96 extension for higher sample rates.

And of course the XLL extension for Lossless is missing, which makes up DTS-HD MA

DarkSpace
14th February 2014, 21:29
DTS-HD HRA is already partially supported today.
That is, the extra bitrate extensions and the extra channel extensions can be decoded. Missing is the X96 extension for higher sample rates.

And of course the XLL extension for Lossless, which makes up DTS-HD MA
I wasn't even aware of that, thanks for the information! This is good news...

iSunrise
15th February 2014, 01:42
wrong thread, can be deleted.

NikosD
16th February 2014, 08:25
@nev

Can you share which is the project you are working right now, regarding LAV filters of course ?

jkauff
17th February 2014, 01:08
@nev

Can you share which is the project you are working right now, regarding LAV filters of course ?
In case you missed it, nev took a job with JRiver. He hasn't told us what he'll be working on for them, so we don't know whether LAV work will be affected.

marsovac
17th February 2014, 03:11
Hi nevcairiel,

I have an issue which may be occurring because I'm not really aware of the requirements for LAV about it, but here it goes:

When I setup the filtergraph and tell LAV to use video acceleration it simply does not do it.

I can see that the settings have been accepted if I open the tray icon, but the acceleration is not there (avcodec):

http://i.imgur.com/aLXUDFP.jpg

The weird things I'm doing that are not really standard are:

- LAV is not installed and regged on the PC but it is loaded from the ax with:

IntPtr proc = GetProcAddress(lavVideoDll, "DllGetClassObject");

I'm setting up the graph (part relevant to LAV) like this:


var filterGraph = m_graph as IFilterGraph2;

if (filterGraph == null)
throw new Exception("Could not QueryInterface for the IFilterGraph2");

var audioRenderer = InsertAudioRenderer(AudioRenderer);
if (audioRenderer != null)
{
if (_audioRenderer != null) Marshal.ReleaseComObject(_audioRenderer);
_audioRenderer = audioRenderer;
}

if ((System.Environment.OSVersion.Platform == PlatformID.Win32NT &&
(System.Environment.OSVersion.Version.Major == 5)))
VideoRenderer = VideoRendererType.VideoMixingRenderer9;

IBaseFilter renderer = InsertVideoRenderer(VideoRenderer, m_graph, 1);
if (renderer != null)
{
if (_renderer != null) Marshal.ReleaseComObject(_renderer);
_renderer = renderer;
}

ILAVAudioSettings lavAudioSettings;
ILAVAudioStatus lavStatus;
IBaseFilter audioDecoder = FilterProvider.GetAudioFilter(out lavAudioSettings, out lavStatus);
if (audioDecoder != null)
{
if (_audio != null) Marshal.ReleaseComObject(_audio);
_audio = audioDecoder;

if (_audioStatus != null) Marshal.ReleaseComObject(_audioStatus);
_audioStatus = lavStatus;

lavAudioSettings.SetRuntimeConfig(true);
hr = m_graph.AddFilter((IBaseFilter)audioDecoder, "LavAudio");
DsError.ThrowExceptionForHR(hr);
}

ILAVSplitterSettings splitterSettings;
IFileSourceFilter splitter = FilterProvider.GetSplitterSource(out splitterSettings);

if (splitter != null)
{
if (_splitter != null) Marshal.ReleaseComObject(_splitter);
_splitter = splitter;
splitterSettings.SetRuntimeConfig(true);
splitter.Load(fileSource, null);
hr = m_graph.AddFilter((IBaseFilter)splitter, "LavSplitter");
DsError.ThrowExceptionForHR(hr);
}

if (_splitterSettings != null) Marshal.ReleaseComObject(_splitterSettings);
_splitterSettings = (ILAVSplitterSettings)splitterSettings;

ILAVVideoSettings lavVideoSettings;
IBaseFilter lavVideo = FilterProvider.GetVideoFilter(out lavVideoSettings);

if (_video != null) Marshal.ReleaseComObject(_video);
_video = lavVideo;
if (_video != null)
{
if (lavVideoSettings != null)
{
lavVideoSettings.SetRuntimeConfig(true);

hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_None);

// check for best acceleration available
if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_CUDA) != 0)
{
hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_CUDA);
}
else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_QuickSync) != 0)
{
hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_QuickSync);
}
else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2Native) != 0)
{
hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2Native);
}
else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2) != 0)
{
hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2);
}
else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2CopyBack) != 0)
{
hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2CopyBack);
}

#if DEBUG
hr = lavVideoSettings.SetTrayIcon(true);
#endif
}

hr = m_graph.AddFilter(_video, "LavVideo");
DsError.ThrowExceptionForHR(hr);
}

IBaseFilter vobSub = FilterProvider.GetVobSubFilter();

if (vobSub != null)
{
hr = m_graph.AddFilter(vobSub, "VobSub");
DsError.ThrowExceptionForHR(hr);
IDirectVobSub vss = vobSub as IDirectVobSub;
if (_vobsub != null) Marshal.ReleaseComObject(_vobsub);
_vobsub = vss;
InitSubSettings();
}

hr = m_graph.Connect(DsFindPin.ByName((IBaseFilter)splitter, "Audio"), DsFindPin.ByDirection(_audio, PinDirection.Input, 0));
if (hr == 0)
HasAudio = true;
else
HasAudio = false;


IBaseFilter dcDsp = FilterProvider.GetDCDSPFilter();
if (dcDsp != null)
{
if (_dspFilter != null) Marshal.ReleaseComObject(_dspFilter);
_dspFilter = (IDCDSPFilterInterface)dcDsp;

if (HasAudio)
{
hr = m_graph.AddFilter((IBaseFilter)_dspFilter, "AudioProcessor");
hr = _dspFilter.set_EnableBitrateConversionBeforeDSP(true);
hr = ((IDCDSPFilterVisualInterface)_dspFilter).set_VISafterDSP(true);
hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_audio, PinDirection.Output, 0), DsFindPin.ByDirection(_dspFilter, PinDirection.Input, 0));
DsError.ThrowExceptionForHR(hr);
hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_dspFilter, PinDirection.Output, 0), DsFindPin.ByDirection(_audioRenderer, PinDirection.Input, 0));

var cb = new AudioCallback(this);
hr = _dspFilter.set_CallBackPCM(cb);

object intf = null;
hr = _dspFilter.set_AddFilter(0, TDCFilterType.ftEqualizer);
hr = _dspFilter.get_FilterInterface(0, out intf);
_equalizer = (IDCEqualizer)intf;
_equalizer.set_Seperate(false);
}
}
else
{
if (HasAudio)
{
hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_audio, PinDirection.Output, 0), DsFindPin.ByDirection(_audioRenderer, PinDirection.Input, 0));
}
}

bool subconnected = false;

hr = m_graph.Connect(DsFindPin.ByName((IBaseFilter)_splitter, "Video"), DsFindPin.ByDirection(_video, PinDirection.Input, 0));
if (hr == 0)
HasVideo = true;
else
HasVideo = false;

if (HasVideo)
{
hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_video, PinDirection.Output, 0), DsFindPin.ByDirection(vobSub, PinDirection.Input, 0));
DsError.ThrowExceptionForHR(hr);
if (hr == 0)
{
int lc;
((IDirectVobSub)vobSub).get_LanguageCount(out lc);
subconnected = (lc != 0);
IPin pn = DsFindPin.ByName((IBaseFilter)splitter, "Subtitle");
if (pn != null)
{
hr = m_graph.Connect(pn, DsFindPin.ByDirection(vobSub, PinDirection.Input, 1));
((IDirectVobSub)vobSub).get_LanguageCount(out lc);
subconnected = (lc != 0);
}
hr = m_graph.Connect(DsFindPin.ByDirection(vobSub, PinDirection.Output, 0),
DsFindPin.ByDirection(_renderer, PinDirection.Input, 0));
}
else
{
hr = m_graph.Connect(DsFindPin.ByDirection(_video, PinDirection.Output, 0),
DsFindPin.ByDirection(_renderer, PinDirection.Input, 0));
}
}


I'm also using RuntimeConfig since the main purpose of doing this player is to make it a portable app with integrated codecs.

Can you plase help in enabling video accel?

If you need to run the app you can download a zip from this page (yellow button): http://msimic.github.io/MediaPoint/

Thanks!

Stereodude
17th February 2014, 05:15
In case you missed it, nev took a job with JRiver. He hasn't told us what he'll be working on for them, so we don't know whether LAV work will be affected.Well congrats to Nevcairiel on the new job!

NikosD
17th February 2014, 07:35
In case you missed it, nev took a job with JRiver. He hasn't told us what he'll be working on for them, so we don't know whether LAV work will be affected.

I didn't know.

I don't use Media Center software, I read that JRiver is one of the best, if not the best.

But 50$ is a lot.

Anyway, I think Nevcairiel is committed to open-source development but a job is a job.

I see almost everyday nightly builds, so someone is writing code for LAV filters.

If not Nevcairiel, then who ?

sheppaul
17th February 2014, 08:09
Hendrik :p

nevcairiel
17th February 2014, 08:15
When I setup the filtergraph and tell LAV to use video acceleration it simply does not do it.

From a brief look at your code, it seems like you add DirectVobSub to the filter graph, yes?
DXVA2 Native only works if the decoder is directly connected to a compatible renderer (EVR), if there is anything in between, DXVA2 Native no longer functions.

If you need anything in between, you can use DXVA2 Copy-Back or any of the other modes, only DXVA2 Native has this restriction (because it keeps the image on the GPU, while all others copy it back to system memory once, which costs a bit of CPU time)

annovif
17th February 2014, 17:47
Hello Nevcairiel , can i know why i can use dxva2 native with madvr with an Ati 7750 ? I'm the only one or it is a normal thing. Thank you

nevcairiel
17th February 2014, 17:52
Why wouldn't you be able to use it?

annovif
17th February 2014, 18:28
Because you said this:
DXVA2 Native only works if the decoder is directly connected to a compatible renderer (EVR)
Thank you

nevcairiel
17th February 2014, 18:29
That doesn't mean its the only compatible renderer.

annovif
17th February 2014, 18:38
ok, thank you:D

fluffy01
17th February 2014, 19:13
I know that ffmpeg does not support MVC and as such, you can not support it for software decoding, but have you considered supporting MVC via DXVA?
According to the specs, it should be pretty straightforward to implement. See here (http://www.microsoft.com/en-us/download/details.aspx?id=25200) for details.
I know that no free renderers or players currently support it, but that is most likely due to no free decoders have been able to decode it, so if you can get this to work in LAVFilters, I am sure, that we will soon see free players/renderers that will support it too :)

andybkma
18th February 2014, 11:26
Speex Audio : Is this something new? All of a sudden I have been seeing many cam vids coded with AVC for video and Speex for audio. Only PotPlayer can play it for me... could this speex be added to LAV Audio if possible please?

LigH
18th February 2014, 11:38
It is not exactly "new", another development by the Xiph team, a low frequency range codec for human speech (suitable for digital telephony).

Speex project website (http://www.speex.org/) — obsolete since it is included in the Opus codec (http://opus-codec.org/).
Other formats on RareWares (http://www.rarewares.org/others.php)

I wonder if your audio is really Speex, or rather a mis-identified Opus stream.

nevcairiel
18th February 2014, 11:41
LAV already supports both Speex and Opus.

marsovac
18th February 2014, 14:20
From a brief look at your code, it seems like you add DirectVobSub to the filter graph, yes?
DXVA2 Native only works if the decoder is directly connected to a compatible renderer (EVR), if there is anything in between, DXVA2 Native no longer functions.

If you need anything in between, you can use DXVA2 Copy-Back or any of the other modes, only DXVA2 Native has this restriction (because it keeps the image on the GPU, while all others copy it back to system memory once, which costs a bit of CPU time)

Yes I use xyVSFilter for subtitles.

I tried with copyback and it works only if I set that in the LAV configuration dialog.

The following line seems to do nothing:

hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2CopyBack);

Perhaps SetRuntimeConfig doesn't like setting the HW accel?
(EDIT: wrong - I'm doing it already before adding to the graph)Or do I need to set that before adding the filter to the filter graph?

And I'm also wondering how does MPC-HC use DXVA with subtitles then?

clsid
18th February 2014, 16:22
And I'm also wondering how does MPC-HC use DXVA with subtitles then?Because video and the rendered subtitle are merged by the video renderer.

@nevcairiel
The audio switcher in MPC-HC now supports mediatype re-negotiation, so there are no more obstacles for implementing a bitstreaming fallback ;)

marsovac
18th February 2014, 17:54
Because video and the rendered subtitle are merged by the video renderer.

You mean by the custom EVR presenter? I don't see EVR having two input pins...

NikosD
18th February 2014, 18:01
Yes.
You can't use subtitles with EVR.
If you want DXVA and subtitles you need EVR-CP, the default renderer of MPC-HC.

mindbomb
18th February 2014, 18:24
anandtech reporting maxwell supports partial h265 decode, which should be possible through cuvid.

marsovac
18th February 2014, 18:35
Yes.
You can't use subtitles with EVR.
If you want DXVA and subtitles you need EVR-CP, the default renderer of MPC-HC.

Thanks Nikos.

Is is even worth the hassle of development to attach my custom presenter to VSFilter? Especially since the presenter is not a filter at all...

Is there much difference between DXVA native and copyback?

NikosD
18th February 2014, 18:41
There is a tradeoff between those two DXVA modes between performance and flexibility.

Old cards and/or weak cards (slow memory copies) with slow PCI-e bus can't actually use DXVA-CB and DXVA native is a one-way solution.

But newer cards can handle DXVA-CB and use other renderers than EVR (CP).

marsovac
18th February 2014, 20:39
But newer cards can handle DXVA-CB and use other renderers than EVR (CP).

Well in that case I will stick to CB. My player doesn't even care to support WinXP, and I guess cards released after 2006 (Vista si 2007) should do the work.

But I still need to understand how to set DXVA-CB in runtime on LAV. Seems to work only if I set it in the LAV dialog which I guess changes the registry...

wanezhiling
19th February 2014, 04:14
http://www.sendspace.com/file/8xz535

18fps with LAV :o
https://code.google.com/p/lavfilters/source/detail?r=9d919d4f68459e4e6dad868eb8d04b78d2d7d541
Fixed. :)

marsovac
19th February 2014, 07:18
wanezhiling you're a dev on lav?

Can I kindly ask you to teach me to set the HW acceleration through code when using SetRuntimeConfig(true) ?

The setting seems accepted but not used on the next video played.

And of course since it is runtime config and the filter is recreated for each video played, that means I'm unable to use it at all...

Oddly it still uses the setting which is set in the LAV video config dialog (I presume the registry)...

wanezhiling
19th February 2014, 07:24
Nonono...I am LAV user :p

nevcairiel
19th February 2014, 08:43
The setting seems accepted but not used on the next video played.

And of course since it is runtime config and the filter is recreated for each video played, that means I'm unable to use it at all...

Oddly it still uses the setting which is set in the LAV video config dialog (I presume the registry)...

Sounds like your instance of LAV which you tried to configure is not actually used for playback, because runtime config resets all settings and takes nothing from the registry. Many other players use it with success.

andybkma
19th February 2014, 10:02
LAV already supports both Speex and Opus.

Okay, thanks. It seems I had to make a profile for Speex in Zoom Player and add the subtype to the profile. Now it works with LAV Audio while before it didn't. Cheers :-)

marsovac
19th February 2014, 12:30
Sounds like your instance of LAV which you tried to configure is not actually used for playback, because runtime config resets all settings and takes nothing from the registry. Many other players use it with success.

Holy cow, i was doing DllGetClassObject -> IClassFactory.CreateInstance() two times, once for the ILavVideo and once for ILAVVideoSettings instead of casting the first to the second.

Thanks a lot, stupid mistake in a utility method which I never bothered to check twice!

marsovac
19th February 2014, 21:07
I converted the ILavAudioStatus to C#:

public interface ILAVAudioStatus
{
///... cut

// Get details about the current decoding format
[PreserveSig]
uint GetDecodeDetails(/*Marshal.PtrToStringAnsi()*/ out IntPtr pCodec, /*Marshal.PtrToStringAnsi()*/ out IntPtr pDecodeFormat, out int pnChannels, out int pSampleRate, out uint pChannelMask);

// Get details about the current output format
[PreserveSig]
uint GetOutputDetails(/*Marshal.PtrToStringAnsi()*/ out IntPtr pOutputFormat, out int pnChannels, out int pSampleRate, out uint pChannelMask);

// ... cut
};

Something ugly I found in ILavAudioStatus:

When using this in other languages we need to tackle the char** conversion from a pointer.

Which means we get an IntPtr from the then we need to do Marshal.PtrToStringAnsi() on it.

In this case it is easier since I know that the returned string is static inside LAV, but it it weren't it would be an automatic memory leak since I have no way of deallocating its memory.

COM interfaces should use BSTR, which makes easier for anyone using the COM to read it as a string.

nevcairiel
19th February 2014, 21:20
It should probably allocate the string instead of giving static strings out, but I see no difference in using a normal LPCSTR to a BSTR, just a different free function you would need to call. Personally i really dislike BSTR.
In any case, cannot change it now anyway, as it would break all existing callers (or leak memory anyway).

I plan a cleanup of all interfaces in the distant feature in a major version change, since some already accumulated a bit of cruft, but that would then also change their GUIDs to make player developers notice to change.
Long time until then.

marsovac
19th February 2014, 22:07
It should probably allocate the string instead of giving static strings out, but I see no difference in using a normal LPCSTR to a BSTR, just a different free function you would need to call. Personally i really dislike BSTR.

I also dislike them because they are cumbersome, not type safe, and need oleauth. However...

You are assuming:

- that I have a free() function
-- which I don't in C# (well I may do some Marshalling magic but that's really cumbersome to use)
-- and even if I did, I would need to knwo which heap allocated the memory, managed? unmanaged? And by just having a COM interface pointer I'm unable to know that.
-- so returning a malloced char* would most likely be an inherent memory leak if you didn't provide a freePointer() method on your interface

- there is no difference
-- BSTR are length prefixed and pinned in memory by com allocation functions, which is why COM interop can safely free them and transfer to the appropriate datatypes in the destination language, which then may not need to be free()d

- in this specific case with char** I cannot define the interface with an out string because the interop would try to free the pointer automatically which would result in trying to free your (delving deep down into LAV, which is how I found that no freeing is necessary) static const char *sample_format_strings[] and we know where that leads to :)

With BSTR I know I don't have to free anything, so I don't have to make assumptions on how your code is written. I just get a string back :)

Unfortunately it would probably mean you need to implement a method specific to COM which wraps around your usual method (because seriously you will never use BSTR internally), so It kinda pollutes code, but that is inevitable in proper COM around c++ code.

nevcairiel
19th February 2014, 22:20
Half of Microsofts COM interfaces with string functions don't use BSTR as it is, they just document which free function you're supposed to use, which in most cases is CoTaskMemFree, the default COM allocator.
This is how other string functions are handled, like on LAV Splitter.

In any case the status interface was primarily build for LAV Audio itself, not necessarily for any external apps.

marsovac
19th February 2014, 22:41
For whatever it was built I managed to create interfaces for C# for it, and properly tested all methods to be working.

LavAudio:
https://raw2.github.com/msimic/MediaPoint/master/MediaPoint_Common/Interfaces/LavAudio/LavAudioInterfaces.cs

I pulled this out as a type, since it was just an uint in the original interface (and only these are used in the UI):


[Flags]
public enum LAVSpeakerLayouts
{
AV_CH_LAYOUT_MONO = 0x00000004,
AV_CH_LAYOUT_STEREO = 0x00000001 | 0x00000002,
AV_CH_LAYOUT_2_2 = AV_CH_LAYOUT_STEREO | 0x00000200 | 0x00000400,
AV_CH_LAYOUT_5POINT1_BACK = AV_CH_LAYOUT_MONO | AV_CH_LAYOUT_STEREO | 0x00000200 | 0x00000400 | 0x00000008,
AV_CH_LAYOUT_6POINT1 = AV_CH_LAYOUT_MONO | AV_CH_LAYOUT_STEREO | 0x00000200 | 0x00000400 | 0x00000008 | 0x00000100,
AV_CH_LAYOUT_7POINT1 = AV_CH_LAYOUT_MONO | AV_CH_LAYOUT_STEREO | 0x00000200 | 0x00000400 | 0x00000008 | 0x00000010 | 0x00000020
};


Lav video and splitter are in the work / testing.

I you wish to help other devs it would be helful to add them into the development folder when i am finished perhaps.

nevcairiel
19th February 2014, 22:43
The problem is that it would go out of date rather quickly as I add new things and cannot test or maintain it myself. I don't like having something outdated in there, tbh.

marsovac
19th February 2014, 22:48
True about that. Better to now have unmaintained code in the repository.

Well hopefully someone will find it on my repo, and it should be maintained rather well since I plan to upgrade to new lav releases.

marsovac
20th February 2014, 00:55
I just found out that my GPU Ati 4850 with 512MB Ram cannot handle DXVA-CB on

ken_ross_02-1920x1080_60fpsRef4.mts (ftp://helpedia.com/pub/multimedia/x264/testvideos/)

when CB is enabled the whole UI is sluggish, even moving the window around lags a lot.

using no acceleration LAV works well on the Phenom II X4 @ 3GHz / 8GB DDR3 1600

Isn't that strange? I tought such a GPU can transfer 1080p data 60 times per second without much hassle..

Another strange thing is: with CB CPU usage goes down quite a bit, GPU usage goes up a LITTLE bit, but still stays low, seems a bottleneck in the transfer...

Anyone cares to enlighten me on how much memory transfer a DXVA-CB uses for such a video?

I'm just guessing: 1920x1080x32x60 twice (474,6MB x 2).

Seems in my player the cpu-gpu buffer swap happens more times because the bandwith should be well enough for two swaps + 1 for presenting.

clsid
20th February 2014, 01:06
Nope, that is normal for older ATI cards. They are only optimized for transferring data to the GPU, not for copying it back.

wanezhiling
20th February 2014, 01:19
Even HD6990 can't handle H.264_1080p_60fps in even native dxva mode. :)

wanezhiling
20th February 2014, 06:13
http://www.sendspace.com/file/kyf07w
Hi nev, pmp seems not work well with latest git (playback stops at the start), is this FFmpeg problem?

NikosD
20th February 2014, 06:47
I just found out that my GPU Ati 4850 with 512MB Ram cannot handle DXVA-CB on

ken_ross_02-1920x1080_60fpsRef4.mts (ftp://helpedia.com/pub/multimedia/x264/testvideos/)

when CB is enabled the whole UI is sluggish, even moving the window around lags a lot.

using no acceleration LAV works well on the Phenom II X4 @ 3GHz / 8GB DDR3 1600

Isn't that strange? I tought such a GPU can transfer 1080p data 60 times per second without much hassle..

Another strange thing is: with CB CPU usage goes down quite a bit, GPU usage goes up a LITTLE bit, but still stays low, seems a bottleneck in the transfer...


Unfortunately, AMD doesn't care to build a HW decoder capable of H.264 1080p60fps decoding.

Even latest AMD cards can't keep up with that framerate - 60fps - in DXVA native mode.

Generally speaking, DXVA-CB increases both CPU load and GPU load due to memory copies.

Faster framerates lead to further CPU/GPU load.

In DXVA native they are both (CPU/GPU load) as low as possible.