Commit 376edfcf authored by Julian Rother's avatar Julian Rother
Browse files

remux: Replaced chapter_time_base

parent b6ebc494
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "util.h" #include "util.h"
#include "config.h" #include "config.h"
static AVRational chapter_time_base = {1, 1}; #define CHAPTER_TIME_BASE (AVRational){1, 1}
void parse_dict(AVDictionary **d, char *s) void parse_dict(AVDictionary **d, char *s)
{ {
...@@ -30,7 +30,7 @@ void parse_chapters(AVFormatContext *ctx, char *s, int duration) ...@@ -30,7 +30,7 @@ void parse_chapters(AVFormatContext *ctx, char *s, int duration)
ctx->chapters[i] = malloc(sizeof(AVChapter)); ctx->chapters[i] = malloc(sizeof(AVChapter));
memset(ctx->chapters[i], 0, sizeof(AVChapter)); memset(ctx->chapters[i], 0, sizeof(AVChapter));
ctx->chapters[i]->id = i; ctx->chapters[i]->id = i;
ctx->chapters[i]->time_base = chapter_time_base; ctx->chapters[i]->time_base = CHAPTER_TIME_BASE;
ctx->chapters[i]->start = jint(jlookup(p, "time"), 0); ctx->chapters[i]->start = jint(jlookup(p, "time"), 0);
av_dict_set(&ctx->chapters[i]->metadata, "title", jstr(jlookup(p, "text"), "EMPTY"), 0); av_dict_set(&ctx->chapters[i]->metadata, "title", jstr(jlookup(p, "text"), "EMPTY"), 0);
if (i) if (i)
...@@ -67,7 +67,8 @@ int main(int argc, char *argv[]) ...@@ -67,7 +67,8 @@ int main(int argc, char *argv[])
avformat_alloc_output_context2(&mux, 0, jstr(jlookup(argv[4], "format"), 0), path); avformat_alloc_output_context2(&mux, 0, jstr(jlookup(argv[4], "format"), 0), path);
av_dict_copy(&mux->metadata, demux->metadata, 0); av_dict_copy(&mux->metadata, demux->metadata, 0);
parse_dict(&mux->metadata, jlookup(argv[4], "metadata")); parse_dict(&mux->metadata, jlookup(argv[4], "metadata"));
parse_chapters(mux, jlookup(argv[4], "chapters"), av_rescale_q(demux->duration, AV_TIME_BASE_Q, chapter_time_base)); parse_chapters(mux, jlookup(argv[4], "chapters"),
av_rescale_q(demux->duration, AV_TIME_BASE_Q, CHAPTER_TIME_BASE));
idxmap = malloc(sizeof(int)*demux->nb_streams); idxmap = malloc(sizeof(int)*demux->nb_streams);
for (i = 0; i < demux->nb_streams; i ++) for (i = 0; i < demux->nb_streams; i ++)
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment