| DVD-Read documentation | Contained in the DVD-Read distribution. |
DVD::Read::Dvd::Ifo::Vts - Access to DVD IFO file using libdvdread
use DVD::Read::Dvd;
use DVD::Read::Dvd::Ifo::Vmg;
use DVD::Read::Dvd::Ifo::Vts;
my $dvd = DVD::Read::Dvd->new('/dev/cdrom');
my $vmg = DVD::Read::Dvd::Ifo::Vts::Vmg->new($dvd);
my $vts = DVD::Read::Dvd::Ifo::Vts::Vts->new(
$dvd,
$vmg->title_nr(0),
);
...
This module provide a low level access DVD IFO files using libdvdread.
This module allow you to get video titles informations step by step like it is done by libdvdread.
Notice functions provided by module are really basics, then you really need to understand the dvd information to use it.
Return a new DVD::Read::Dvd::Ifo::Vts:
A DVD::Read::Dvd object.
The title number you want to get information.
A string to identify the VTS
Return the count of track inside this title.
Return the count of chapter for title number $ttn.
Return the video format
Return the video format in textual form
Return the width and height of the video
Return the MPEG version used
Return the MPEG version in textual form
Return the aspect ratio
Return the aspect ratio in textual form
Return the 'permitted_df' value, but no sure about its meaning
Return the 'permitted_df' in textual form (from transcode code).
Return true if the video is a movie
Unknown meaning...
Unknown meaning...
Unknown meaning...
Unknown meaning...
Return the list of existing audios tracks id
Return the VID of the audio track number $id.
Return the format of audio track number $id.
Return the format of audio track number $id in textual form.
Return the frequency for audio track number $id.
Return the frequency for audio track number $id in textual form.
Return the language code for audio track number $id.
Return the language extension for audio track number $id. In fact this is comment about track content.
Return the language extension for audio track number $id in textual form.
Not sure about the meaning, should the bit count used to code sound.
Return audio quantization in textual form.
Return the channel mode for audio track number $id.
Return the channel mode for audio track number $id in textual form.
The application mode for audio track number $id. Eg, is the track for karaoke ?
The application mode for audio track number $id in textual form.
Does the audio track number $id has multichannel extension ?
Return the list of existing subtitles tracks id
Return the VID of subtitle number $id.
Return the language for subtitle $id.
Return the language extension for susbtitle number $id. This is in fact a comment about the subtitle content.
Return the language extension for susbtitle number $id in textual form.
Return the length in millisecond of title handle by $vts DVD::Read::Dvd::Ifo object get from a title > 0.
Return in millisecond the chapter offset from movie start of chapter number $chapter of title number $title.
$vts is the DVD::Read::Dvd::Ifo object for title number $title.
It is unfriendly to have to give again the title number if the VTS IFO is given. I haven't find another way, but remember this module is low level access to dvdread API.
Return first sector of chapter $chapter for title $title.
$vts is the DVD::Read::Dvd::Ifo object for title number $title.
Return last sector of chapter $chapter for title $title.
$vts is the DVD::Read::Dvd::Ifo object for title number $title.
Return the count of pgc in this title.
Return the pgc number for title track number $ttn and chapter number $chapter.
Return the DVD::Read::Dvd::Ifo::Pgc object number $pgc_id.
The $pgc_id is given by vts_pgc_id function.
Return inside the pgc, the pgc number containing the cell data.
Most of C code come from mplayer and transcode (tcprobe).
Thanks authors of these modules to provide it as free software.
As this software are under another license, and this module reuse code from it, the Perl license is maybe not appropriate.
Just mail me if this is a problem.
Olivier Thauvin <nanardon@nanardon.zarb.org>
Copyright (C) 2008 by Olivier Thauvin
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
The libdvdread is under the GPL Licence.
| DVD-Read documentation | Contained in the DVD-Read distribution. |
package DVD::Read::Dvd::Ifo::Vts; use 5.010000; use strict; use warnings; our $VERSION = '0.04'; require XSLoader; XSLoader::load('DVD::Read', $VERSION); use DVD::Read::Dvd::Ifo; use DVD::Read::Dvd::Ifo::Pgc; use DVD::Read::Dvd::Ifo::Cell;
sub new { my ($class, $dvd, $number) = @_; $number or return; my $vts = DVD::Read::Dvd::Ifo->new($dvd, $number); bless($vts, $class); }
sub vts_video_format_txt { my ($self) = @_; defined(my $fmt = $self->vts_video_format) or return; return [ 'ntsc', 'pal' ]->[$fmt]; }
sub vts_video_mpeg_version_txt { my ($self) = @_; defined(my $mpeg = $self->vts_video_mpeg_version) or return; 'mpeg' . ($mpeg + 1) }
sub vts_video_aspect_ratio_txt { my ($self) = @_; defined(my $fmt = $self->vts_video_aspect_ratio) or return; return { 0 => '4:3', 3 => '16:9' }->{$fmt}; }
sub vts_video_permitted_df_txt { my ($self) = @_; defined(my $fmt = $self->vts_video_permitted_df) or return; return [ 'pan&scan+letterboxed', 'only pan&scan', 'only letterboxed', '', ]->[$fmt]; }
sub vts_video_ntsc_cc { my ($self) = @_; if($self->line21_cc_1 && $self->line21_cc_2) { return "NTSC CC 1 2"; } elsif($self->line21_cc_1) { return "NTSC CC 1"; } elsif($self->line21_cc_2) { return "NTSC CC 2"; } else { return ""; } }
sub vts_audio_format_txt { my ($self, $audiono) = @_; defined(my $val = $self->vts_audio_format($audiono)) or return; return { 0 => 'ac3', 2 => 'mpeg layer 1/2/3', 3 => 'mpeg2 ext', 4 => 'lpcm', 5 => 'sdds', 6 => 'dts', }->{$val} }
sub vts_audio_frequency_txt { my ($self, $audiono) = @_; defined(my $val = $self->vts_audio_frequency($audiono)) or return; return [ '48kHz', '96kHz', '44.1kHz', '32kHz' ]->[$val]; }
sub vts_audio_lang_extension_txt { my ($self, $audiono) = @_; $self->_lang_extension_txt($self->vts_audio_lang_extension($audiono)); }
sub vts_audio_quantization_txt { my ($self, $audiono) = @_; defined(my $val = $self->vts_audio_quantization($audiono)) or return; return [ '16bit', '20bit', '24bit', 'drc' ]->[$val]; }
sub vts_audio_channel_txt { my ($self, $audiono) = @_; defined(my $val = $self->vts_audio_channel($audiono)) or return; return [ "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" ]->[$val]; }
sub vts_audio_appmode_txt { my ($self, $audiono) = @_; defined(my $val = $self->vts_audio_appmode($audiono)) or return; return [ '', 'karaoke mode', 'surround sound mode', ]->[$val]; }
sub vts_subtitle_id { my ($self, $id) = @_; if (grep { $_ == $id } $self->vts_subtitles) { return $id + 0x20; } else { return; } }
sub vts_subtitle_lang_extension_txt { my ($self, $subtitleno) = @_; $self->_lang_extension_txt($self->vts_audio_lang_extension($subtitleno)); } sub _lang_extension_txt { my ($self, $code) = @_; defined($code) or return; return [ '', 'Normal Caption', 'Audio for visually impaired', 'Director\'s comments #1', 'Director\'s comments #2', ]->[$code]; }
sub _chapter_lenght { my ($self, $ttn, $chapter) = @_; my $pgc = $self->vts_pgc( $self->vts_pgc_id($ttn, $chapter) ) or return; my $last_cell_num = $self->_chapter_last_cell_num($ttn, $chapter); my $time = 0; foreach ($pgc->cell_number($self->vts_pgc_num($ttn, $chapter)) .. $last_cell_num) { $time += $pgc->cell($_)->time; } $time } sub _chapter_last_cell_num { my ($self, $ttn, $chapter) = @_; return if ($ttn > $self->vts_ttn_count); my $pgc = $self->vts_pgc( $self->vts_pgc_id($ttn, $chapter) || 0 ) or return; $chapter >= $self->vts_chapters_count($ttn) ? $pgc->cells_count : $pgc->cell_number($self->vts_pgc_num($ttn, $chapter + 1)) - 1; }
sub chapter_offset { my ($self, $ttn, $chapter) = @_; $chapter ||= 1; my $offset = 0; foreach(1 .. $chapter -1) { $offset += $self->_chapter_lenght($ttn, $_); } $offset }
sub chapter_first_sector { my ($self, $ttn, $chapter) = @_; return if ($ttn > $self->vts_ttn_count); return if ($chapter > $self->vts_chapters_count($ttn)); my $pgc = $self->vts_pgc( $self->vts_pgc_id($ttn, $chapter) ) or return; $pgc->cell( $pgc->cell_number( $self->vts_pgc_num($ttn, $chapter) ) )->first_sector }
sub chapter_last_sector { my ($self, $ttn, $chapter) = @_; return if ($ttn > $self->vts_ttn_count); my $pgc = $self->vts_pgc( $self->vts_pgc_id($ttn, $chapter) || 0 ) or return; $pgc->cell( $self->_chapter_last_cell_num($ttn, $chapter) )->last_sector }
1; __END__