[MPlayer-users] [UGLY HACK] dvd title lengths

David Toso dtoso at optushome.com.au
Wed Jan 22 10:44:57 CET 2003


Jonas Jermann <jjermann at gmx.net> wrote:
>
> I thought about an ugly hack to be able to play my DVDs (almost all don't have 
> the main movie on title 1). 
>

Did someone say ugly hack!?! Wow, it's like I hear the wind calling me....
Compile and link the following against libmpdvdkit2.a in the mplayer source.
Play movie as:
	mplayer -dvd `get_movie_title` the-rest-of-your-options

This works perfectly for my 50+ DVDs.
David Toso.

get_movie_title.c
=========================================
#include <stdio.h>
#include "alt_stream.h"

int main(void)
{
  char *dvd_device  = "/dev/dvd";
  dvd_reader_t *dvd;
  ifo_handle_t *vmg_file;
  tt_srpt_t *tt_srpt;
  int x;

  dvd = DVDOpen(dvd_device);
  if(!dvd) 
  {
    fprintf(stderr, "can't open dvd device\n");
    printf("-1");
    exit(0);
  }
  vmg_file = ifoOpen(dvd, 0);
  if (!vmg_file)
  {
    fprintf(stderr, "can't open vmg info\n"); 
    printf("-1");
    DVDClose(dvd);
    exit(0);
  }
  tt_srpt = vmg_file->tt_srpt;
  for (x=0; x<tt_srpt->nr_of_srpts; x++) if (tt_srpt->title[x].nr_of_ptts > 10) break;
  printf("%d", x+1);
  DVDClose(dvd);
}
======================================



More information about the MPlayer-users mailing list