BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea,
BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b,
BLURAY_STREAM_TYPE_VIDEO_H264_MVC = 0x20,
BLURAY_STREAM_TYPE_VIDEO_VC1 = 0xea,
BLURAY_STREAM_TYPE_VIDEO_H264 = 0x1b,
BLURAY_STREAM_TYPE_VIDEO_H264_MVC = 0x20,
BLURAY_STREAM_TYPE_SUB_PG = 0x90,
BLURAY_STREAM_TYPE_SUB_IG = 0x91,
BLURAY_STREAM_TYPE_SUB_TEXT = 0x92,
BLURAY_STREAM_TYPE_SUB_PG = 0x90,
BLURAY_STREAM_TYPE_SUB_IG = 0x91,
BLURAY_STREAM_TYPE_SUB_TEXT = 0x92,
BLURAY_VIDEO_FORMAT_720P = 5, // SMPTE 296M
BLURAY_VIDEO_FORMAT_1080P = 6, // SMPTE 274M
BLURAY_VIDEO_FORMAT_576P = 7, // ITU-R BT.1358
BLURAY_VIDEO_FORMAT_720P = 5, // SMPTE 296M
BLURAY_VIDEO_FORMAT_1080P = 6, // SMPTE 274M
BLURAY_VIDEO_FORMAT_576P = 7, // ITU-R BT.1358
BLURAY_VIDEO_RATE_24000_1001 = 1, // 23.976
BLURAY_VIDEO_RATE_24 = 2,
BLURAY_VIDEO_RATE_24000_1001 = 1, // 23.976
BLURAY_VIDEO_RATE_24 = 2,
case BLURAY_STREAM_TYPE_VIDEO_MPEG2:
case BLURAY_STREAM_TYPE_VIDEO_VC1:
case BLURAY_STREAM_TYPE_VIDEO_H264:
case BLURAY_STREAM_TYPE_VIDEO_MPEG2:
case BLURAY_STREAM_TYPE_VIDEO_VC1:
case BLURAY_STREAM_TYPE_VIDEO_H264:
case BLURAY_STREAM_TYPE_VIDEO_MPEG2:
case BLURAY_STREAM_TYPE_VIDEO_VC1:
case BLURAY_STREAM_TYPE_VIDEO_H264:
case BLURAY_STREAM_TYPE_VIDEO_MPEG2:
case BLURAY_STREAM_TYPE_VIDEO_VC1:
case BLURAY_STREAM_TYPE_VIDEO_H264:
if( w == 1280 && h == 720 /* && !ilace*/ ) return BLURAY_VIDEO_FORMAT_720P;
if( w == 1440 && h == 1080 /* && ilace*/ ) return BLURAY_VIDEO_FORMAT_1080I;
if( w == 1920 && h == 1080 /* && !ilace*/ ) return BLURAY_VIDEO_FORMAT_1080P;
if( w == 1280 && h == 720 /* && !ilace*/ ) return BLURAY_VIDEO_FORMAT_720P;
if( w == 1440 && h == 1080 /* && ilace*/ ) return BLURAY_VIDEO_FORMAT_1080I;
if( w == 1920 && h == 1080 /* && !ilace*/ ) return BLURAY_VIDEO_FORMAT_1080P;
fprintf(stderr, "unknown bluray video format %dx%d %silace\n",
w, h, !ilace ? "not " : "");
exit(1);
fprintf(stderr, "unknown bluray video format %dx%d %silace\n",
w, h, !ilace ? "not " : "");
exit(1);
int ilace = field_probe(fmt_ctx, st);
if( ilace < 0 ) {
fprintf(stderr, "interlace probe failed\n");
int ilace = field_probe(fmt_ctx, st);
if( ilace < 0 ) {
fprintf(stderr, "interlace probe failed\n");
s->format = bd_audio_format(st->codecpar->channels);
s->rate = bd_audio_rate(st->codecpar->sample_rate);
strcpy((char*)s->lang, "eng");
break; }
case AVMEDIA_TYPE_SUBTITLE: {
s->format = bd_audio_format(st->codecpar->channels);
s->rate = bd_audio_rate(st->codecpar->sample_rate);
strcpy((char*)s->lang, "eng");
break; }
case AVMEDIA_TYPE_SUBTITLE: {
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", 0, 0);
strncpy((char*)s->lang, lang ? lang->value : "und", sizeof(s->lang));
break; }
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", 0, 0);
strncpy((char*)s->lang, lang ? lang->value : "und", sizeof(s->lang));
break; }
-// chapter marks every ch_duration ticks
- int64_t ch_duration = 45000 * 60*5;
+// chapter marks every ch_duration seconds * 45Kticks, default 5 min
+ int PCR_FREQ = 45000;
+ if (ch_interval == 0)
+ ch_interval = 60*5;
+ int64_t ch_duration = PCR_FREQ * ch_interval;
int64_t mrktm = ch_duration;
int64_t plytm = 0;
int pmark = 0, pitem = 0;
int64_t mrktm = ch_duration;
int64_t plytm = 0;
int pmark = 0, pitem = 0;
+ int start = 0, chapter_every_n_sec = 0;
+
+ int opt = getopt(ac, av, "c:");
+ if (opt == 'c') {
+ chapter_every_n_sec = optarg[0]; start = 3; }
+ else
+ start = 2;