Opened 14 years ago

Closed 13 years ago

#1043 closed enhancement (fixed)

Internal DVD Menu Support and Position Bar Support.

Reported by: skamithi@… Owned by: skamithi
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Brief list of features added, and some of the problems I tried to fix. Some problems I encountered I can't figure out. Hope the feature works for most folks. Please help fix some of the problems I've encountered.

To Jump the annoying still frames at the start of a dvd, use the JUMPFFWD action.

Pause , forwarding and rewinding is disabled in a dvd menu. If enabled, things don't work right.

Bookmarking, currently breaks DVD menus. So I disabled that. Would like to work on this in the future.

For still frame support, most of the changes deal with:

For dvd button support and dvd button navigation check out the following functions

Position bar support

  • NuppelVideoPlayer::calcSliderPos()

I couldn't figure out a way to use the FFmpeg dvdsub.c subtitle decoding functions. So I just ported what I needed to DVDRingBufferPriv.cpp. If there is a better way to do this, please share.

Problems I tried to solve_

Had problems with Audio Stuttering/sync each time an audio track is reselected. To try and resolve it I did the following:

  • Run NVP::ResetPlaying? , each time a Audio Track is Selected
  • Resync the position map in AvFormatDecoder::Reset() so as not to affect ffw/rew

When starting a feature from the chapter list or scene selection, can't forward or rewind after that. To resolve it, in AVFormatDecoder::GetFrame?() , check if the title number changed. If so, resync the position map.

Problems I cannot solve

  • DVD Button colors are wrong. I suck at this CLUT thing. So if someone can figure it out, please do.
  • DVD Button Positioning isn't quite right. If the button covers a word, it doesn't cover the word properly.
  • DVD Nav issues. Some DVDs do something weird. DVD has 8 parts in a title. You play part 1, then you decide to jump to next part. The next part doesn't work and you get a DVD_STOP. Screen goes black. If it runs ClearAfterSeek?() , I get a segv fault. Xine just does the right thing and jumps to the next program or skips the part. Can't figure out how xine does that.
  • If I get a VideoOutputXv?: InputChanged?() event occurs and I was moving from a regular stream to a still frame, DiscardVideoFrames?, clears the still frame from the queue , so I get a blank screen. I figure, one way to solve this is to get the DVD player to just replay the Cell with the still frame. Can't figure out how to do that.
  • For the position bar, some DVD split the main title into 2 PGCs. Like King's Ransom. Haven't figured out how to get the complete title length. Right now, all I do is read the PGC length and assume that it is the total length of the whole feature. Xine gets it right.

Attachments (18)

mythdvd.patch (48.4 KB) - added by skamithi@… 14 years ago.
mythdvd.2.patch (51.1 KB) - added by skamithi@… 13 years ago.
Updated patch
mythdvd3.patch (53.7 KB) - added by skamithi@… 13 years ago.
Fixed segv issue, address high cpu issue on some menus, add language codes
dvdring1.patch (24.0 KB) - added by skamithi@… 13 years ago.
fix another display button segv issue.
mythdvd4.patch (62.9 KB) - added by skamithi@… 13 years ago.
v4 of the patch. hopefully more stable and useful.
seq_end_mythdvd.patch (386 bytes) - added by skamithi@… 13 years ago.
libavcodec/parser.c patch replacement. please see if this causes dvb playback issues.
mythdvd_only_use_ffmpeg.patch (495 bytes) - added by skamithi@… 13 years ago.
only use ffmpeg as decoder.
dvdmenu_code_cleanup1.patch (3.5 KB) - added by skamithi@… 13 years ago.
move dvd subtitle osd clearing from avformatdecoder to dvdringbuffer.cpp
dvdmenu_nav_improvements.patch (2.7 KB) - added by skamithi@… 13 years ago.
dvd button navigation improvements + minor cleanup.
dvdmenu_cleanup2.patch (4.5 KB) - added by skamithi@… 13 years ago.
additional dvd nav improvements.
mythdvd_v5.patch (24.9 KB) - added by skamithi@… 13 years ago.
v5 patch. includes mpeg12.c patch and posted patches that are not committed. some patch cleanup as well.
mythdvd_v6.patch (35.4 KB) - added by skamithi@… 13 years ago.
subtitle fixes.
mythdvd_v7.patch (5.1 KB) - added by skamithi@… 13 years ago.
still frame libmpeg2 support.
mythdvd_cleanup3.patch (957 bytes) - added by skamithi@… 13 years ago.
use dvdnav_convert_time for calculating dvd time since it's available. didn't notice it before.
mythdvd_v8.patch (12.2 KB) - added by skamithi@… 13 years ago.
v8 patch. includes v7 patch, cleanup3 patch and bug fixes.
dvd_totalframechange_not_detected.patch (814 bytes) - added by skamithi 13 years ago.
bug fix. some dvds start the main feature without changing the title.
dvd_totalframechange_not_detected_v2.patch (597 bytes) - added by skamithi 13 years ago.
bug fix. problem due to typo. title change not detected.
exit_menu_hang_problem.patch (592 bytes) - added by skamithi 13 years ago.
prevents mythtv hang when exiting dvd and playbackexitprompt == 1. basically just exit the dvd if in a dvd still frame. don't show the video exit menu.

Download all attachments as: .zip

Change History (57)

comment:1 Changed 14 years ago by anonymous

Type: defectenhancement

Changed 14 years ago by skamithi@…

Attachment: mythdvd.patch added

comment:2 Changed 14 years ago by danielk

Milestone: 0.20
Version: head

comment:3 Changed 13 years ago by anonymous

serious avsync issues in DVD menu if there are lots of dvd cells with audio. E.g Love Actually. Working on the issue.

Changed 13 years ago by skamithi@…

Attachment: mythdvd.2.patch added

Updated patch

comment:4 Changed 13 years ago by skamithi@…

  • Fixed dvd button color problem.
  • worked around a/v sync issues. NVP::WarpTimecode? messes up timecodes when a dvd cell change occurs. avoiding it prevents 90% of the a/v sync issues i had before.
  • fixed still frame not shown issue.
  • drop audio in a dvd still frame cell. Causes the "NVP::AddAudioData?():p1: Audio buffer overflow, audio data lost!" error message.

seems pretty usable now. let me know if folks find any segv issues.

comment:5 Changed 13 years ago by skamithi@…

sorry. I meant NuppelVideoPlayer::WrapTimecode?, not warptimecode.

Changed 13 years ago by skamithi@…

Attachment: mythdvd3.patch added

Fixed segv issue, address high cpu issue on some menus, add language codes

comment:6 Changed 13 years ago by skamithi@…

major problem, that i'm attempting to resolve is displaying the menu where dvd cell has 1 video frame and audio for a number of seconds. this cell is replayed over and over. current symptom if you are in the cell, is memory consumption of mythfrontend increases dramatically and high cpu.

someone on the alias reported segv when system attempts to display button. I noticed i'm not checking if there is a bitmap before drawing the button. posting fix for this shortly.

minor issue: remove the osd menu options that are not useful, when viewing a dvd, e.g edit recording, transcode..etc...

next patch v4, that i hope to post in a few weeks, will attempt to resolve all these issues.

Changed 13 years ago by skamithi@…

Attachment: dvdring1.patch added

fix another display button segv issue.

comment:7 Changed 13 years ago by skamithi@…

on my todo list:

  • fix strange button action on starwars I 2nd disc. I see in the dvdnav api, you can pass vm_commands when you select a button. i think this is what the dvd is using in some places.

reported issues:

  • my patch breaks DVB playback..causes prebuffering pauses. Went through patch, can't figure out how I'm doing this. Please confirm and help me fix this. I don't use dvb.
  • First cell of frames or first frame may not be shown. Some DVDs start out with cells with 10 frames total in the cell, but the cell length is 30seconds ?? commercial dvd players play it fine. xine and mythtv don't.
  • segv crash when you hit the previous chapter button. Working on reproducing this and fixing it...sometime.

any more crashes , feedback.. all welcome.

Changed 13 years ago by skamithi@…

Attachment: mythdvd4.patch added

v4 of the patch. hopefully more stable and useful.

comment:8 Changed 13 years ago by skamithi@…

was thinking about what , in the patch, may affect dvb playback. only thing I can think of, is the libavcodec/parser.c addition to the patch. I posted a question on the alias asking for help/advice on this.

comment:9 Changed 13 years ago by Isaac Richards

(In [8965]) Most of the patch for #1043, adds much better internal DVD playback, incl. menus. Didn't include the change to libavcodec/parser.c, as it may cause problems.

Include libdvdnav directly because:

  • My distro (Dapper) only includes 0.1.9, and 0.1.10 is needed for 64-bit operation.
  • The version from xine (which is what's included here) has additional bugfixes beyond what's present in 0.1.10 (last released version on dvd.sf.net).
  • It's pretty small, means one less (optional) dependency, and it makes the code in libmythtv cleaner. =)

Also, I cleaned up the RingBuffer? class by removing all those DVDRingBuffer wrapper functions.

Refs #1043. Still a few issues to deal with.

Changed 13 years ago by skamithi@…

Attachment: seq_end_mythdvd.patch added

libavcodec/parser.c patch replacement. please see if this causes dvb playback issues.

Changed 13 years ago by skamithi@…

only use ffmpeg as decoder.

comment:10 Changed 13 years ago by skamithi@…

could not figure out still frame support using libmpeg2. restrict mpeg decoder to ffmpeg for dvd playback only, as a workaround.

comment:11 Changed 13 years ago by Isaac Richards

(In [9015]) Parse aspect ratio out of the DVDNAV_VTS_CHANGE events. Fixes AR in the menus of the DVDs I was testing.

Disallow libmpeg2 when doing dvd decode, from patch attached to #1043.

Refs #1043.

comment:12 Changed 13 years ago by skamithi@…

some code cleanup. move code to clear up subtitle osd when dvd cell change occurs to dvdringbuffer.cpp from avformatdecoder.cpp

Changed 13 years ago by skamithi@…

Attachment: dvdmenu_code_cleanup1.patch added

move dvd subtitle osd clearing from avformatdecoder to dvdringbuffer.cpp

comment:13 Changed 13 years ago by Isaac Richards

(In [9027]) DVD cleanup, patch from #1043.

Refs #1043.

comment:14 Changed 13 years ago by skamithi@…

strange dvd button action I reported earlier on star wars I disc2 is due to something called dvd button auto-action. dvdnav code seems to address it but button navigation get's stuck at a certain point and don't work in a reasonable manner. working to see if i can improve the behaviour in mythtv. seems to work fine in Xine but i can't see where xine addresses this issue.

Changed 13 years ago by skamithi@…

dvd button navigation improvements + minor cleanup.

comment:15 Changed 13 years ago by skamithi@…

improved button navigation. fixed button nav issue I reported. minor cleanup: prevent user from skipping back when in the dvd menu or still frame.

comment:16 Changed 13 years ago by Isaac Richards

(In [9051]) Another DVD cleanup patch from #1043.

Also, fixed menu button position.

Refs #1043.

comment:17 Changed 13 years ago by skamithi@…

last dvd nav improvements not complete, fixed auto-action but broke dvd nav on Lord on the rings DVD.

Also isaac pointed out that currently highlighted button refreshes if the dvd menu cell repeats. Sometimes it doesn't show after that. attempted to address that.

Changed 13 years ago by skamithi@…

Attachment: dvdmenu_cleanup2.patch added

additional dvd nav improvements.

comment:18 Changed 13 years ago by skamithi@…

2 issues i'm working on: intermittent button display issues. trying a different approach to getting the button to display at the right time and never fail. 2nd issue is my home movie dvd doesn't play on mythtv. dvd produces a dvd stop event then quits. Plays fine in xine. investigating the issue.

comment:19 Changed 13 years ago by skamithi@…

todo list. stuff i hope to fix in v5 patch. will post in a week or 2.

  • intermittent button display issue
  • improve still frame stuff
  • enable prebuffering where it doesn't need to disabled. disabling prebuffering may cause video to flicker.
  • segv issue. button drawing problem. reported on the alias.
  • mythtv selects wrong dvd audio track. Happened when I watched Mr Bean DVD.
  • improve playback of dvd still frames with audio. use audioOutput->setblocking where needed

for the v6 patch i hope to make my home dvd work.

Changed 13 years ago by skamithi@…

Attachment: mythdvd_v5.patch added

v5 patch. includes mpeg12.c patch and posted patches that are not committed. some patch cleanup as well.

comment:20 Changed 13 years ago by skamithi@…

  • mythtv will now play the dvd audio track selected in dvd menu
  • different approach tried to resolve button display issues. use pts of first released video frame after Menu SPU pkt is decoded as the basis for displaying the button.
  • prevent discarding frames or avstream purging when in the menu. for me it caused still frames to be cleared from the queue before it was shown. experimented with turning on avstream purging when in the menu and a cell Change occurs. it cause still frames to be improperly parsed by ffmpeg. don't know why yet.
  • tried using audioOutput->Setblocking() instead of Audiooutput->drain..didn't work well. so just configured to run the Drain() function in the menu or still frame.

v6 todo list

  • fix reported v5 bugs
  • fix subtitles colors
  • not going to work on making home dvd work right now. want to fix subtitles colors first.

comment:21 Changed 13 years ago by skamithi@…

  • fixed subtitles color
  • auto subtitles / audio will follow what is configured in dvd menu
  • fixed some minor problems
    • set MAX_STREAMS in avformat.h to 40.read on a website that total max num of dvd streams is 1video + 9 audio + 32 subtitle. 40 seems to be a decent number. helps prevent the "nb_streams >= MAX_STREAMS " error reported by some testers.
    • added some code to dvdnav to read number of audio channels directly from dvd.

v7 todo list

  • make my home dvd work. its 352x480. if i play a vob in mythvideo it works fine. mythdvd returns ffmpeg decoding errors. works fine if i switch to libmpeg2. so either fix when using ffmpeg or implement still frame support when using libmpeg2, and tell mythtv to switch to libmpeg2 if viewing a dvd with resolution < 720x480. may take a while to figure out.
  • workaround that i have not added to patch is change to kDecoderProbeBufferSize . I set it 2048 to be able to get initial still frame to show on some dvds. If I don't do this, DVD terminates due to DVD_STOP. Not sure how to code "set kdecoderprobebuffersize to 2048 only if u playing a dvd". please help on this issue.

Changed 13 years ago by skamithi@…

Attachment: mythdvd_v6.patch added

subtitle fixes.

comment:22 Changed 13 years ago by Isaac Richards

(In [9256]) Stanley's latest DVD patch.

Also:

  • Fixed the probe size like he asked for in the ticket.
  • Fixed DVD subtitle position, cpu usage (was needlessly scaling), and work-around for ones that disappeared too quickly.

Refs #1043.

Changed 13 years ago by skamithi@…

Attachment: mythdvd_v7.patch added

still frame libmpeg2 support.

comment:23 Changed 13 years ago by skamithi@…

  • minor changes in how still frames are decoded.
  • still frames now work if you use libmpeg2.. ff/rew works only @ 3x ffw only due to libmpeg2 issue, I believe.
  • if using ffmpeg, and resolution change occurs, e.g 720x480 to 324x480, ffmpeg doesn't seem to update some of its mpeg decoding contexts. linesize is wrong and thus you get "stride changed" errors and screen turns green/blank. after much experimentation, found that closing the avcodeccontexts (called in av_find_stream_info) when this happens, makes everything work. It works for me..not sure if this is the best way to resolve it. libmpeg2 has no issues with resolution changes..it just works. wish libmpeg2 ff/rew worked well :(

Changed 13 years ago by skamithi@…

Attachment: mythdvd_cleanup3.patch added

use dvdnav_convert_time for calculating dvd time since it's available. didn't notice it before.

comment:24 Changed 13 years ago by skamithi@…

minor cleanup. use dvdnav convert_dvd_time function instead of the one i borrowed from vlc. didn't notice it was there before.

comment:25 Changed 13 years ago by skamithi@…

bug: using latest svn and v7 patch, dvd menu on still dvd frame may display more then 2 buttons. it seems to a timing issue between clearing the osd and displaying the button. happens when transitioning between dvd cells. working on patch that will add a short delay before displaying the button to prevent this issue.

comment:26 Changed 13 years ago by skamithi@…

no more major enhancements from me regarding this ticket. just in bug fixing mode. with the help of some testers, found 3 bugs. next patch will include fix for:

  • disable realtime priority threading when playing a dvd. causes PC to hang.
  • when video inputchange occurs , and next cell is a menu (with buttons) cell , menu spu pkt may not be parsed from stream correctly thus no buttons appear.
  • on a still menu frame with buttons, initial button still appears as you navigate the menu. thus it looks like 2 buttons are selected.

Changed 13 years ago by skamithi@…

Attachment: mythdvd_v8.patch added

v8 patch. includes v7 patch, cleanup3 patch and bug fixes.

comment:27 Changed 13 years ago by skamithi@…

v8 patch. fixes other bugs i found.

  • should not be able to ff/rew in a still frame that is not in the menu. causes my mythfrontend to crash
  • when ff/rew, seeking may seek to the start of the dvd. fps sometimes becomes "0". fixed in decoderbase.cpp patch.
  • minor enhancement. since dvd doesn't use a seektable, to improve where it starts ff/rew, update framesplayed when a cell change occurs.

find any more bugs?..please let me know.

comment:28 Changed 13 years ago by Isaac Richards

(In [9376]) Latest DVD menu patch from Stanley. Update local libmpeg2 (so mmx works on amd64). Better cpu detecting in libsoundtouch (so mmx works on amd64).

Refs #1043. Closes #1352.

comment:29 Changed 13 years ago by skamithi@…

v9 patch todo list.

  • minor bug fixes and cleanup. going to make audio/subtitle track setting/detection code for dvds consistent with the recent subtitle/audio code changes in NVP.
  • add some new functions. get serial number, jump to title ( need later on by dvd bookmark stuff)

comment:30 Changed 13 years ago by Isaac Richards

Owner: changed from Isaac Richards to skamithi

comment:31 Changed 13 years ago by skamithi

(In [9487]) refs #1043 cleaned up dvd audio/subtitle detection code. fixed still frame problem caused by [9443]. added some new functions to be used later for dvd bookmarks. fixed intermittent total dvd title frame calc problem

comment:32 Changed 13 years ago by skamithi@…

minor problem reported where OSD message remains on screen indefinitely when in a dvd still frame. quite annoying. looking into how to stop it from doing this only when in a dvd still frame.

comment:33 Changed 13 years ago by skamithi

(In [9520]) refs #1043 fix for osd not cleared when entering dvd still frame. hack to skip initial dvd still frame, if frame is not displayed. parser issue. working on a proper fix.

comment:34 Changed 13 years ago by skamithi

(In [9739]) References #1043 Fixes dvdnav seeking issue which causes mythtv not to detect a resolution change. patch from simon levitt

Changed 13 years ago by skamithi

bug fix. some dvds start the main feature without changing the title.

comment:35 Changed 13 years ago by skamithi

Status: newassigned

bug fix. testing it out to see if it works properly. watching a cartoon dvd, the main feature started without a title change. so far dvd code only recalculates the total number of frames when a title change occurs. also considering recalculating the total number of frames every time the cell changes instead. also checking to see if i should prevent it from doing this while ffw or rew.

Changed 13 years ago by skamithi

bug fix. problem due to typo. title change not detected.

comment:36 Changed 13 years ago by skamithi

(In [9792]) refs #1043. Typo in title detection code. detects title changes incorrectly. causes position bar miscalculations.

comment:37 Changed 13 years ago by skamithi

minor bug: if "PlaybackExitPrompt?" == 1, and you try and exit a dvd menu that is a still frame, mythtv hangs. mythtv attempts to pause and display the video exit menu. this executes nvp->Pause which executes PauseDecoder?(), and this hangs.

attempting to fix.

Changed 13 years ago by skamithi

prevents mythtv hang when exiting dvd and playbackexitprompt == 1. basically just exit the dvd if in a dvd still frame. don't show the video exit menu.

comment:38 Changed 13 years ago by skamithi

going to change ffw/rew behaviour a little. found some dvds with a main feature with just 1 chapter. main feature is 40 minutes. can't skip through it using jump ahead/jump behind functions. figuring out a way to detect this, and apply the jump ahead and jump behind functions..instead of the jump to the next title action.

comment:39 Changed 13 years ago by skamithi

Resolution: fixed
Status: assignedclosed

(In [9837]) Closes #1043. Minor bug fix. prevent exit menu dialog box from been displayed when in a dvd menu. Just exit dvd instead. dvd menus seems stable now. closing the ticket.

Note: See TracTickets for help on using tickets.