#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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 |
#3
|
||||
|
||||
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 |
Thread Tools | |
Display Modes | |
|
|