Ticket #14115 (closed Bugs: Fixed)

Opened 22 months ago

Last modified 21 months ago

DVD player don't work with libdvdnav 4.2.0

Reported by: ray1112 Owned by: Voyager
Priority: 4 - Normal Milestone: 13.0 "Gotham"
Component: DVD-Video menu navigation and playback Version: GIT
Severity: Normal Keywords: DVD libdvdnav
Cc: Voyager, ralob, elupus Blocked By:
Blocking: Platform: Linux
Revision:

Description

Forum:  http://forum.xbmc.org/showthread.php?tid=156419
Log:  http://pastebin.com/r4YGp6mB
INFO: msg: libdvdnav: Using dvdnav version 4.2.0
INFO: msg: libdvdread: Using libdvdcss version 1.2.12 for DVD access
INFO: msg: libdvdread: Could not open /media/DATA/Movies/BLUEBEARD
DEBUG: libdvdnav: vm: failed to open/read the DVD
ERROR: Error on dvdnav_open
ERROR: CDVDPlayer::OpenInputStream - error opening media/DATA/Movies/BLUEBEARD/VIDEO_TS/VIDEO_TS.IFO
This DVD is working OK by XBMC 11.0 (on the same computer).

Change History

comment:1 Changed 22 months ago by Voyager

  • Cc Voyager, ralob, added

a bit more information please:

  • does this only happen with DVD in folder structures, or also with ISOs, or actual optical drive?
  • does this happen with just this disc or every disc?

The new library was tested on Windows, IOS, and Linux (by some) without any other report so far over a week, so I find it a bit strange. Perhaps force a clean build?

comment:2 Changed 22 months ago by ray1112

  1. Sorry. I haven't ISOs and optical drive on this computer.
  2. I tried 5 different DVDs with the same result.
  3. OK. I will build clean build and say results today.

comment:3 Changed 22 months ago by Voyager

Thanks. Creating an ISO is quite easy - there's plenty of free software available (like ImgBurn on Windows or mkisofs on Linux)

comment:4 Changed 22 months ago by ray1112

Yes. I know. I use ImgBurn and I can create Video DVD by it. I will check ISO and say results today.

comment:5 Changed 22 months ago by George

Same problem here. I can't watch any of my DVD's anymore, they just don't start. The log gives me this error:

20:27:51 T:140268964738816 INFO: msg: libdvdnav: Using dvdnav version 4.2.0 20:27:51 T:140268964738816 INFO: msg: libdvdread: Using libdvdcss version 1.2.12 for DVD access 20:27:51 T:140268964738816 INFO: msg: libdvdread: Could not open /mnt/NAS/Films/The Gruffalo (2009) 20:27:51 T:140268964738816 DEBUG: libdvdnav: vm: failed to open/read the DVD 20:27:51 T:140268964738816 ERROR: Error on dvdnav_open

A clean build I just compiled didn't help either.

Here is my log:  http://pastebin.com/qardP33Q

comment:6 Changed 22 months ago by Voyager

  • Cc elupus added; removed

@elupus - copying you since you have most experience with libdvd on Linux. any thoughts?

comment:7 Changed 22 months ago by ray1112

I make clean build. The result is the same.
See log:  http://pastebin.com/M6Y8trx8[[BR]] 01:50:21 T:3047749440 NOTICE: DVDPlayer: Opening: /media/DATA/Movies/BLUEBEARD/VIDEO_TS/VIDEO_TS.IFO
01:50:21 T:2701916992 DEBUG: libdvdnav: vm: failed to open/read the DVD
I make ISO by ImgBurn and XBMC can play ISO.
01:49:36 T:3047749440 NOTICE: DVDPlayer: Opening: /media/DATA/Downloads/BLUEBEARD.ISO
01:49:36 T:2824026944 INFO: msg: libdvdnav: vm: DVD Title: BLUEBEARD

comment:8 Changed 22 months ago by Voyager

I am looking into this, despite the handicap that I don't have a Linux development environment, so I could use a bit of help.

From what I can tell by looking at the error, it happens in dvd_reader.c, function DVDOpen(), and only in case of reading a DVD from a folder (not ISO). Analyzing the code, there have been some changes in libdvdread with regard to resolving symlinks and getting absolute folder paths (dvd_reader.c, lines 432-453). Not so much what is done, but more how errors are checked:

first it tries to chdir to the given path. If it fails it returns an error
then it tries to getcwd (get absolute path)of the path. If it fails it returns an error
finally it tries to set the working directory to "." folder opened at the start. If it fails it returns an error

One of these three errors seems to happen, I suspect the last one. To make sure, it would be good if you could add some debug statements as follows, rebuild and retest:

  if( ( cdir = open( ".", O_RDONLY ) ) >= 0 ) {
    if( chdir( path_copy ) == -1 ) {
      fprintf( stderr, "libdvdread: Failed CHDIR.\n" );
      goto DVDOpen_error;
    }
    new_path = malloc(PATH_MAX+1);
    if(!new_path) {
      fprintf( stderr, "libdvdread: Failed MALLOC.\n" );
      goto DVDOpen_error;
    }
    if( getcwd( new_path, PATH_MAX ) == NULL ) {
      fprintf( stderr, "libdvdread: Failed GETCWD.\n" );
      goto DVDOpen_error;
    }
    retval = fchdir( cdir );
    close( cdir );
    cdir = -1;
    if( retval == -1 ) {
      fprintf( stderr, "libdvdread: Failed FCHDIR.\n" );
      goto DVDOpen_error;
    }
    path_copy = new_path;
    new_path = NULL;
  }

comment:9 Changed 21 months ago by ray1112

You are right:
INFO: msg: libdvdnav: Using dvdnav version 4.2.0
INFO: msg: libdvdread: Using libdvdcss version 1.2.12 for DVD access
DEBUG: libdvdread: Failed FCHDIR.
INFO: msg: libdvdread: Could not open /media/DATA/Movies/BLUEBEARD
DEBUG: libdvdnav: vm: failed to open/read the DVD

comment:10 Changed 21 months ago by Voyager

Great! didn't think I was going to be right on ... The question is only wly fchdir is failing. You can query the value of errno for this : you'll have to #include <errno.h> and add a line to fprintf( stderr, "-- errno = %d (%s)\n", errno, strerror(errno));

On the other hand, it would also be good to test that this is actually irrelevant by just taking out (or commenting out) these lines:

    if( retval == -1 ) {
      fprintf( stderr, "libdvdread: Failed FCHDIR.\n" );
      goto DVDOpen_error;
    }

And then test to see if you can watch your dvds.

comment:11 Changed 21 months ago by uNiversal

could you issue this command

udisks --mount /dev/sr[0-9]

and see if after this the media can be played. If it does this could be another bug in xbmc related to mounting various optical media.

uNi

comment:12 Changed 21 months ago by elupus

Those functions are probably not wrapped and emulated in our file system wrappers. So they use system functions that can't handle our full file system.

comment:13 Changed 21 months ago by Voyager

@uNi - this is not related to mounted optical media. We're talking about DVD files copied into a folder.

@elupus - this function call was there in 4.1.3 too, with the difference that now there is a check for errors. Furthermore, I don't think that our filesystem has anything to do with it, since this is happening with actual paths on disk that should be the same. Lastly I'm not sure why they even have this call to set the working dir, as it doesn't do anything useful. I will look into the patches that may exist in the branch you mentioned the other day...

@ray112 - let me know the results when you get a chance to take out these lines I mentioned above and retest.

comment:14 Changed 21 months ago by George

I removed the above few lines from dvd_reader.c and I can confirm tag all my DVD's are working again.

comment:15 follow-up: ↓ 16 Changed 21 months ago by Voyager

  • Owner set to Voyager
  • Status changed from new to assigned

Thanks George.

It's my opinion that this code in libdvdread is messy. Not sure why they try to open "." (current directory) to then set it as the current working directory again. This is nonsense...

I checked in the Videolan fork but there's no patch for this yet.

Anyway, it has worked before without the error check (for XBMC use), so I will remove the goto DVDOpen_error; on the fchdir result check. I don't have access to a development station right away, but will commit a correction tonight.

comment:16 in reply to: ↑ 15 Changed 21 months ago by George

It's my opinion that this code in libdvdread is messy. Not sure why they try to open "." (current directory) to then set it as the current working directory again. This is nonsense...

I checked in the Videolan fork but there's no patch for this yet.

Anyway, it has worked before without the error check (for XBMC use), so I will remove the goto DVDOpen_error; on the fchdir result check. I don't have access to a development station right away, but will commit a correction tonight.

Well, thanks for your help. Nice to be able to play DVD's again.

comment:17 Changed 21 months ago by Voyager

oh I get it. getcwd changes the current working directory to the DVD's path, which of course at the end needs to be changed back to what it was... If this fails, it means that the working directory stays at the DVD's path, which is not a terribly bad thing since we're not outputting anything there anyway.

comment:18 Changed 21 months ago by ray1112

@Voyager:

retval = fchdir( cdir ); [[BR]]
fprintf( stderr, "-- errno = %d (%s)\n", errno, strerror(errno)); [[BR]]
INFO:   msg: -- errno = 9 (Bad file descriptor) [[BR]]
DEBUG: libdvdread: Failed FCHDIR. [[BR]]
INFO: dll_fopen - something opened the mount file, let's hope it knows what it's doing [[BR]]
DEBUG: libdvdread: Couldn't find device name. [[BR]]

I commented goto DVDOpen_error and I can start DVD play.
But when I press STOP XBMC exit to login window.
Log:  http://pastebin.com/7tMtN45s

comment:19 Changed 21 months ago by Voyager

so dvd playback works now. But I don't see anything in your log regarding the exit to login window. Can you provide more of the log? Or a more detailed description?

meanwhile a commit was pushed to master, so if you could rebuild with that and retest that would be great.

comment:20 Changed 21 months ago by ray1112

I make new build.
Log:  http://pastebin.com/nJZcsGrc
This is full log from start XBMC till exit XBMC to login window.
I found that:
if I start play DVD, select title, play movie and then stop, XBMC exit to XBMC movie list (it's OK)
but if I start play DVD and press stop on DVD title menu, XBMC exit to login window.
If you like I can insert some debug print to source files.

comment:21 Changed 21 months ago by Voyager

This exit to login window is really weird. I'm wondering if this is actually related to this library change or something else. Can you check if this happened with Frodo 12.0 release as well?

comment:22 follow-up: ↓ 24 Changed 21 months ago by Voyager

and please provide a complete log file, since your last log line is "waiting for video thread to exit", it doesn't give any information about that jump to login window.

comment:23 Changed 21 months ago by George

I just compiled the latest git version and everything is working fine. I can play DVDs like they always worked.

comment:24 in reply to: ↑ 22 ; follow-up: ↓ 25 Changed 21 months ago by ray1112

Replying to Voyager:

and please provide a complete log file, since your last log line is "waiting for video thread to exit", it doesn't give any information about that jump to login window.

It's full log after exit XBMC to login window.

$tail -5 xbmc.log
11:30:30 T:2713713472   DEBUG: CSoftAEStream::~CSoftAEStream - Destructed
11:30:30 T:2713713472  NOTICE: Deleting audio codec
11:30:30 T:2713713472  NOTICE: DVDPlayer: closing video stream
11:30:30 T:2713713472  NOTICE: Closing video stream
11:30:30 T:2713713472  NOTICE: waiting for video thread to exit

comment:25 in reply to: ↑ 24 ; follow-up: ↓ 26 Changed 21 months ago by Voyager

Replying to ray1112:

Replying to Voyager:

and please provide a complete log file, since your last log line is "waiting for video thread to exit", it doesn't give any information about that jump to login window.

It's full log after exit XBMC to login window.

$tail -5 xbmc.log
11:30:30 T:2713713472   DEBUG: CSoftAEStream::~CSoftAEStream - Destructed
11:30:30 T:2713713472  NOTICE: Deleting audio codec
11:30:30 T:2713713472  NOTICE: DVDPlayer: closing video stream
11:30:30 T:2713713472  NOTICE: Closing video stream
11:30:30 T:2713713472  NOTICE: waiting for video thread to exit

that makes it difficult to work with, there's nothing in the log. Can you be more precise, e.g. provide screenshots? Also try with Frodo and see if it makes a difference.

comment:26 in reply to: ↑ 25 Changed 21 months ago by ray1112

Replying to Voyager: I haven't 12.0 release due to the fact that 12.0 don't play same video/audio streams which 11.0 can play (some rtmp streams from video/audio plagins).
And I have current night build for HD audio (Blu Ray disks and vynil rips) and PVR.
I have "xbmc" account with 11.0 release and it can play DVD (press STOP on DVD title menu exit to movies list) and "xbmc2" account with night build from git-hub which has this problem.
But if you say commit name I can rollback (git checkout ...) to this commit.

comment:27 Changed 21 months ago by ray1112

I think screenshots are not interesting. First is DVD title menu, second is linux login screen (after press stop button on remote).

comment:28 Changed 21 months ago by ray1112

I have this behavior on some plagins also (e.g. Jazz Radio audio plagin: select this plagin and XBMC goto login window without usefull information in log file).

comment:29 Changed 21 months ago by Voyager

  • Status changed from assigned to closed
  • Resolution set to Fixed
  • Milestone changed from Future / Pending to 12.1

OK. Thanks this clarifies it. I will close the issue as "resolved", for the following reasons:

  • DVDs now play correctly (both file-based, ISO and optical)
  • It's impossible to debug your remaining issue, given the level of custom build you have (11.0 + HD audio + PVR...)
  • Linux login is not xbmc (I thought you meant xbmc profiles login)
  • problem with other plugins as well, so at least not related to libdvd.

If anything, I can suggest to revert the libdvd commit that you cherry picked into your custom build so that you go back to 4.1.3. This is non-essential anyway for the vast majority of DVDs.

comment:30 Changed 21 months ago by Voyager

  • Milestone changed from 12.1 to 13.0

comment:31 Changed 21 months ago by ray1112

@ Voyager: I agree you can close this ticket. I can see DVD.
FYI only: I haven't custom build. I have 2 separated builds: apt-get install xbmc (11.0) installed in system and night build make in my home directory (~/xbmc). I have 2 linux accounts: "xbmc" is starting xbmc 11.0 and "xbmc2" is starting night build ~/xbmc/xbmc.bin.

comment:32 Changed 21 months ago by Voyager

@ray1112 - sorry I misunderstood you. So as you have a nightly build of git, what you can do is revert three commits (in this order) and try again. As I said, my suspicion is that it's not related to libdvd.

 https://github.com/xbmc/xbmc/commit/3708d886958258fcf18fe827eb8ab32ecda45943  https://github.com/xbmc/xbmc/commit/8244e4be6d7e55a688f51457317f3c9b755af153  https://github.com/xbmc/xbmc/commit/421d9fdb0658abb01306a62e5d57da044263b216

comment:33 Changed 21 months ago by ray1112

@Voyager: Last build (Git:20130222-9599872) is working without my problem (press STOP on DVD title menu force XBMC exit to linux login window). May be you right that it's not libdvd problem. Thank you Voyager for help. Nice weekend.

Note: See TracTickets for help on using tickets.