JDownloader Community - Appwork GmbH
 

Go Back   JDownloader Community - Appwork GmbH > English Support > General Discussion
Reply
 
Thread Tools Display Modes
  #1  
Old 11.09.2016, 15:38
mostafaz4 mostafaz4 is offline
Junior Loader
 
Join Date: Aug 2012
Posts: 13
Talking Tweaking HLSDownloader.java

I'm doing some changes in the jd2 source code for local personal use and need some help...
So, just IGNORE this thread if i'm not supposed to

I'm trying to download hls of ffmpeg unsupported media so i need to download the segment then re-encode it to support ffmpeg then write it back to the outputStream but HLSDownloader download segments in chunks of [32*1024] bytes and stream every chunk to the outputStream.

My Progress so far:
Code:
Added byte[] segment = br.getPage(url).getBytes();
Before byte[] readWriteBuffer = HLSDownloader.this.instanceBuffer.getAndSet(null);
Code:
Added if (reencodehls) {readWriteBuffer = new byte[br.getPage(url).getBytes().length];}
After readWriteBuffer = new byte[32 * 1024];
Code:
Added if (reencodehls) {readWriteBuffer = reencodeHLS(segment);}
Before outputStream.write(readWriteBuffer, 0, len);

The result is plugin-defect, any suggestions ??
* reencodeHLS(byte[] binary) is a re-encoding function which is working without errors according to the log.
* Unfortunately cannot provide links because it's a VPN :(

Thanks
Reply With Quote
  #2  
Old 11.09.2016, 15:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,571
Default

What exactly does reencodeHLS do? Does it modify the complete segment or only some headers at beginning?

byte[] segment = br.getPage(url).getBytes(); -> that will not work, please open the connection and either stream the data or read all into a buffer with IO methods and write to outputstream

getPage is not meant for binary content and getBytes is only available if you set flag
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 11.09.2016, 15:55
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,571
Default

For example
byte[] bytes=IO.readBytes(connection.getInputStream());
bytes now contains the complete segment and then you can modify it and write
outputStream.write(bytes)

If you need more help, have questions, either contact us via support@jdownloader.org or in live chat (irc, freenode, #jdteam)
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 18:49.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.