mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 10:14:13 -04:00
Making dash files appear in the good folder and understanding dashenc of ffmpeg.
This commit is contained in:
parent
6270aac959
commit
2bbd1bf81c
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
extern "C" API int Init();
|
extern "C" API int Init();
|
||||||
|
|
||||||
extern "C" API int transmux(const char *path, const char *outPath);
|
extern "C" API int transmux(const char *path, const char *outPath, const char *stream_uri);
|
||||||
|
|
||||||
//Take the path of the file and the path of the output directory. It will return the list of subtitle streams in the streams variable. The int returned is the number of subtitles extracted.
|
//Take the path of the file and the path of the output directory. It will return the list of subtitle streams in the streams variable. The int returned is the number of subtitles extracted.
|
||||||
extern "C" API Stream* extract_subtitles(const char *path, const char *outPath, int *streamCount, int *subtitleCount);
|
extern "C" API Stream* extract_subtitles(const char *path, const char *outPath, int *streamCount, int *subtitleCount);
|
||||||
|
@ -8,7 +8,7 @@ int Init()
|
|||||||
return sizeof(Stream);
|
return sizeof(Stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
int transmux(const char *path, const char *out_path, const char *get_uri)
|
int transmux(const char *path, const char *out_path, const char *stream_uri)
|
||||||
{
|
{
|
||||||
AVFormatContext *in_ctx = NULL;
|
AVFormatContext *in_ctx = NULL;
|
||||||
AVFormatContext *out_ctx = NULL;
|
AVFormatContext *out_ctx = NULL;
|
||||||
@ -54,8 +54,11 @@ int transmux(const char *path, const char *out_path, const char *get_uri)
|
|||||||
|
|
||||||
av_dump_format(out_ctx, 0, out_path, true);
|
av_dump_format(out_ctx, 0, out_path, true);
|
||||||
|
|
||||||
av_dict_set(&options, "init_seg_name", ((std::string)get_uri + (std::string)"/init-stream$RepresentationID$.m4s").c_str(), AV_DICT_DONT_STRDUP_VAL);
|
//std::string val = (std::string)stream_uri + (std::string)"init-stream$RepresentationID$.m4s";
|
||||||
av_dict_set(&options, "media_seg_name", ((std::string)get_uri + (std::string)"/chunk-stream$RepresentationID$-$Number%05d$.m4s").c_str(), AV_DICT_DONT_STRDUP_VAL);
|
//av_dict_set(&options, "dirname", val.c_str(), 0);
|
||||||
|
//av_dict_set(&options, "init_seg_name", val.c_str(), 0);
|
||||||
|
//val = (std::string)stream_uri + (std::string)"chunk-stream$RepresentationID$-$Number%05d$.m4s";
|
||||||
|
//av_dict_set(&options, "media_seg_name", val.c_str(), 0);
|
||||||
if (open_output_file_for_write(out_ctx, out_path, &options) != 0)
|
if (open_output_file_for_write(out_ctx, out_path, &options) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -33,12 +33,15 @@ namespace Kyoo.InternalAPI
|
|||||||
|
|
||||||
public string Transmux(WatchItem episode)
|
public string Transmux(WatchItem episode)
|
||||||
{
|
{
|
||||||
string temp = Path.Combine(tempPath, episode.Link);
|
string folder = Path.Combine(tempPath, episode.Link);
|
||||||
Directory.CreateDirectory(temp);
|
string manifest = Path.Combine(folder, episode.Link + ".mpd");
|
||||||
temp = Path.Combine(temp, episode.Link + ".mpd");
|
|
||||||
Debug.WriteLine("&Transmuxing " + episode.Link + " at " + episode.Path + ", outputPath: " + temp);
|
Directory.CreateDirectory(folder);
|
||||||
if (File.Exists(temp) || TranscoderAPI.transmux(episode.Path, temp) == 0)
|
Debug.WriteLine("&Transmuxing " + episode.Link + " at " + episode.Path + ", outputPath: " + folder);
|
||||||
return temp;
|
|
||||||
|
//FFMPEG require us to put DirectorySeparaorChar as '/' for his internal regex.
|
||||||
|
if (File.Exists(manifest) || TranscoderAPI.transmux(episode.Path, manifest.Replace('\\', '/'), (folder + Path.DirectorySeparatorChar).Replace('\\', '/')) == 0)
|
||||||
|
return manifest;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace Kyoo.InternalAPI.TranscoderLink
|
|||||||
public extern static int Init();
|
public extern static int Init();
|
||||||
|
|
||||||
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public extern static int transmux(string path, string out_path);
|
public extern static int transmux(string path, string out_path, string stream_uri);
|
||||||
|
|
||||||
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
|
||||||
private extern static IntPtr extract_subtitles(string path, string out_path, out int array_length, out int track_count);
|
private extern static IntPtr extract_subtitles(string path, string out_path, out int array_length, out int track_count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user