mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
added webvtt support
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <ffmpeg/mpeg4audio.h>
|
#include <ffmpeg/mpeg4audio.h>
|
||||||
|
|
||||||
@@ -463,6 +463,8 @@ static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extra
|
|||||||
return "S_TEXT/SRT";
|
return "S_TEXT/SRT";
|
||||||
case AV_CODEC_ID_SUBRIP:
|
case AV_CODEC_ID_SUBRIP:
|
||||||
return "S_TEXT/SUBRIP";
|
return "S_TEXT/SUBRIP";
|
||||||
|
case AV_CODEC_ID_WEBVTT:
|
||||||
|
return "D_WEBVTT/SUBTITLES";
|
||||||
default:
|
default:
|
||||||
ffmpeg_err("Codec ID %d (%.8lx) not found\n", codec_id, codec_id);
|
ffmpeg_err("Codec ID %d (%.8lx) not found\n", codec_id, codec_id);
|
||||||
// Default to injected-pcm for unhandled audio types.
|
// Default to injected-pcm for unhandled audio types.
|
||||||
@@ -2538,7 +2540,8 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
|||||||
#endif
|
#endif
|
||||||
get_codecpar(stream)->codec_id != AV_CODEC_ID_SUBRIP &&
|
get_codecpar(stream)->codec_id != AV_CODEC_ID_SUBRIP &&
|
||||||
get_codecpar(stream)->codec_id != AV_CODEC_ID_TEXT &&
|
get_codecpar(stream)->codec_id != AV_CODEC_ID_TEXT &&
|
||||||
get_codecpar(stream)->codec_id != AV_CODEC_ID_SRT)
|
get_codecpar(stream)->codec_id != AV_CODEC_ID_SRT &&
|
||||||
|
get_codecpar(stream)->codec_id != AV_CODEC_ID_WEBVTT)
|
||||||
{
|
{
|
||||||
ffmpeg_printf(10, "subtitle with not supported codec codec_id[%u]\n", (uint32_t)get_codecpar(stream)->codec_id);
|
ffmpeg_printf(10, "subtitle with not supported codec codec_id[%u]\n", (uint32_t)get_codecpar(stream)->codec_id);
|
||||||
}
|
}
|
||||||
|
@@ -232,6 +232,10 @@ static int Write(Context_t *context, void *data)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, ass_get_text((char *)out->data));
|
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, ass_get_text((char *)out->data));
|
||||||
}
|
}
|
||||||
|
else if (!strncmp("D_WEBVTT/SUBTITLES", Encoding, 18))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, json_string_escape((char *)out->data));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
subtitle_err("unknown encoding %s\n", Encoding);
|
subtitle_err("unknown encoding %s\n", Encoding);
|
||||||
|
Reference in New Issue
Block a user