X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fdv%2Fproducer_libdv.c;h=0a6189fb12b938cf32fd310da2d47a6270d62455;hb=bf3264b9e340ba5c11cbf59835a8af3db94e0cc2;hp=7d5fb25214245307bd013b5a3c755491030fb990;hpb=cdc142529076b33e4856a423547b9e93fb56330a;p=melted diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 7d5fb25..0a6189f 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -3,19 +3,19 @@ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited * Author: Charles Yates * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "producer_libdv.h" @@ -151,9 +151,9 @@ mlt_producer producer_libdv_init( char *filename ) producer->get_frame = producer_get_frame; // If we have mov or dv, then we'll use an alternative producer - if ( strncasecmp( strrchr( filename, '.' ), ".avi", 4 ) == 0 || - strncasecmp( strrchr( filename, '.' ), ".dv", 3 ) == 0 || - strncasecmp( strrchr( filename, '.' ), ".mov", 4 ) == 0 ) + if ( strchr( filename, '.' ) != NULL && ( + strncasecmp( strrchr( filename, '.' ), ".avi", 4 ) == 0 || + strncasecmp( strrchr( filename, '.' ), ".mov", 4 ) == 0 ) ) { // Load via an alternative mechanism this->alternative = mlt_factory_producer( "kino", filename ); @@ -300,12 +300,12 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma // Parse the header for meta info dv_parse_header( decoder, dv_data ); - // Assign width and height from properties - *width = mlt_properties_get_int( properties, "width" ); - *height = mlt_properties_get_int( properties, "height" ); + // Assign width and height according to the frame + *width = 720; + *height = dv_data[ 3 ] & 0x80 ? 576 : 480; // Extract an image of the format requested - if ( *format == mlt_image_yuv422 ) + if ( *format == mlt_image_yuv422 || *format == mlt_image_yuv420p ) { // Allocate an image uint8_t *image = mlt_pool_alloc( *width * ( *height + 1 ) * 2 ); @@ -320,8 +320,9 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma // Assign result *buffer = image; + *format = mlt_image_yuv422; } - else if ( *format == mlt_image_rgb24 ) + else { // Allocate an image uint8_t *image = mlt_pool_alloc( *width * ( *height + 1 ) * 3 ); @@ -336,6 +337,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma // Assign result *buffer = image; + *format = mlt_image_rgb24; } // Return the decoder @@ -476,6 +478,10 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i mlt_properties_set_double( properties, "aspect_ratio", dv_format_wide( dv_decoder ) ? ( this->is_pal ? 118.0/81.0 : 40.0/33.0 ) : ( this->is_pal ? 59.0/54.0 : 10.0/11.0 ) ); + + mlt_properties_set_int( properties, "frequency", dv_decoder->audio->frequency ); + mlt_properties_set_int( properties, "channels", dv_decoder->audio->num_channels ); + // Hmm - register audio callback mlt_frame_push_audio( *frame, producer_get_audio );