| 1 | package Net::PMP::Profile::MediaEnclosure; | ||
| 2 | use Moose; | ||
| 3 | use Net::PMP::Profile::TypeConstraints; | ||
| 4 | |||
| 5 | our $VERSION = '0.102'; | ||
| 6 | |||
| 7 | has 'href' => ( is => 'rw', isa => 'Net::PMP::Type::Href', required => 1, ); | ||
| 8 | has 'type' => | ||
| 9 | ( is => 'rw', isa => 'Net::PMP::Type::MediaType', required => 1, ); | ||
| 10 | has 'media_meta' => ( is => 'rw', isa => 'HashRef', ); | ||
| 11 | has 'crop' => ( is => 'rw', isa => 'Str', ); | ||
| 12 | has 'width' => ( is => 'rw', isa => 'Int', ); | ||
| 13 | has 'height' => ( is => 'rw', isa => 'Int', ); | ||
| 14 | has 'resolution' => ( is => 'rw', isa => 'Float', ); | ||
| 15 | has 'codec' => ( is => 'rw', isa => 'Str', ); | ||
| 16 | has 'format' => ( is => 'rw', isa => 'Str', ); | ||
| 17 | has 'duration' => ( is => 'rw', isa => 'Int', ); | ||
| 18 | |||
| 19 | sub as_hash { | ||
| 20 | my $self = shift; | ||
| 21 | |||
| 22 | # alias media_meta back to meta | ||
| 23 | my %hash = %$self; | ||
| 24 | if ( exists $hash{media_meta} ) { | ||
| 25 | $hash{meta} = delete $hash{media_meta}; | ||
| 26 | } | ||
| 27 | return \%hash; | ||
| 28 | } | ||
| 29 | |||
| 30 | __PACKAGE__->meta->make_immutable(); | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | __END__ |