~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_openDML/ADM_openDML.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "ADM_openDML/ADM_openDML.h"
33
33
#include "ADM_toolkit/toolkit.hxx"
34
34
 
 
35
#include "ADM_odml_audio.h"
 
36
 
35
37
#include "ADM_toolkit/ADM_debugID.h"
36
38
#define MODULE_NAME MODULE_ODML
37
39
#include "ADM_toolkit/ADM_debug.h"
139
141
                delete [] _audioTracks;
140
142
                _audioTracks=NULL;
141
143
        }
142
 
 
 
144
        if(myName)
 
145
        {
 
146
          ADM_dealloc(myName);
 
147
          myName=NULL; 
 
148
        }
143
149
        return 1;
144
150
}
145
151
//
161
167
        _audioTracks=NULL;
162
168
        _nbAudioTracks=0;
163
169
        _currentAudioTrack=0;
164
 
 
 
170
        myName=NULL;
165
171
}
166
172
uint8_t OpenDMLHeader::getAudioStream(AVDMGenericAudioStream **audio)
167
173
{       
199
205
uint32_t rd;
200
206
 
201
207
        printf("** opening OpenDML files **");  
 
208
        
202
209
        _fd=fopen(name,"rb");
203
210
        if(!_fd)
204
211
        {
205
212
                printf("\n cannot open %s \n",name);
206
213
                return 0;
207
214
        }
 
215
        myName=ADM_strdup(name);
208
216
#define CLR(x)              memset(& x,0,sizeof(  x));
209
217
 
210
218
              CLR( _videostream);
279
287
                                printf("expected %d\n",sizeof(_videostream));
280
288
                                if(_Tracks[i].strh.size<sizeof(_videostream)-8) // RECT is not mandatory
281
289
                                {
282
 
                                        GUI_Error_HIG("Malformed header", NULL);
 
290
                                  GUI_Error_HIG(_("Malformed header"), NULL);
283
291
                                        return 0;
284
292
                                }               
285
293
                                printf("Trying to continue anyway\n");                  
311
319
 
312
320
                // then bih stuff
313
321
                int32_t extra;
314
 
                _fd=fopen(name,"rb");
 
322
//              _fd=fopen(name,"rb");
315
323
                
316
324
                fseeko(_fd,_Tracks[vidTrack].strf.offset,SEEK_SET);             
317
325
                extra=_Tracks[vidTrack].strf.size-sizeof(_video_bih);
364
372
                                                printf("expected %d\n",sizeof(_audiostream));
365
373
                                                if(_Tracks[run].strh.size<sizeof(_audiostream)-8)
366
374
                                                {
367
 
                                                        GUI_Error_HIG("Malformed header", NULL);
 
375
                                                  GUI_Error_HIG(_("Malformed header"), NULL);
368
376
                                                        return 0;
369
377
                                                }
370
378
                                                printf("Trying to continue anyway\n");                  
466
474
                                track=&(_audioTracks[i]);
467
475
                                _audioTracks[i].track= new AVDMAviAudioStream(track->index,
468
476
                                                track->nbChunks,
469
 
                                                _fd,
 
477
                                                myName,
470
478
                                                track->wavHeader,
471
479
                                                0,
472
480
                                                track->extraDataLen,track->extraData);
473
481
                        }
474
482
                }
 
483
                if(!_video_bih.biCompression && fourCC::check(_videostream.fccHandler,(uint8_t*)"DIB "))
 
484
                  {
 
485
                        _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t*)"DIB ");
 
486
                  }
 
487
                else
475
488
                _videostream.fccHandler=_video_bih.biCompression;
476
489
                printf("\nOpenDML file successfully read..\n");
477
490
                return ret;
494
507
                                printf("expected %d\n",sizeof(tmp));
495
508
                                if(_Tracks[i].strh.size<sizeof(tmp)-8)
496
509
                                {
497
 
                                        GUI_Error_HIG("Malformed header", NULL);
 
510
                                  GUI_Error_HIG(_("Malformed header"), NULL);
498
511
                                        return 0;
499
512
                                }               
500
513
                                printf("Trying to continue anyway\n");                  
537
550
 
538
551
void OpenDMLHeader::Dump( void )
539
552
{
 
553
        printf(  "Main header\n" );
 
554
        printf(  "______________________\n" );  
 
555
 
540
556
#define X_DUMP(x) printf(#x":\t\t:%ld\n",_mainaviheader.x);
541
557
        X_DUMP(dwStreams);
542
558
        X_DUMP(dwMicroSecPerFrame) ;
576
592
        X_DUMP(dwSampleSize);
577
593
        printf("\n");
578
594
                  
579
 
#undef X_DUMP
580
 
#define X_DUMP(x) printf(#x":\t\t:%ld\n",(long int)_video_bih.x);
581
 
        X_DUMP( biSize);
582
 
        X_DUMP( biWidth);
583
 
        X_DUMP( biHeight);
584
 
        X_DUMP( biBitCount);
585
 
        X_DUMP( biCompression);fourCC::print(_video_bih.biCompression);printf("\n");
586
 
        X_DUMP( biSizeImage);
587
 
        X_DUMP( biXPelsPerMeter);
588
 
        X_DUMP( biYPelsPerMeter);
589
 
        X_DUMP( biClrUsed);
 
595
        printBih(&_video_bih);
590
596
 
591
597
        /*****************************************************************
592
598
                Dump infos about all audio tracks found
623
629
                
624
630
          
625
631
#undef X_DUMP
626
 
#define X_DUMP(x) printf("\n "#x":\t\t:%lu",_audioTracks[i].wavHeader->x);
627
632
 
628
 
          X_DUMP(encoding);
629
 
          X_DUMP(channels);     /* 1 = mono, 2 = stereo */
630
 
          X_DUMP(frequency);    /* One of 11025, 22050, or 44100 Hz */
631
 
          X_DUMP(byterate);     /* Average bytes per second */
632
 
          X_DUMP(blockalign);   /* Bytes per sample block */
633
 
          X_DUMP(bitspersample);        /* One of 8, 12, 16, or 4 for ADPCM */
634
 
          
635
 
          printf(" Extra Data  : %ld\n",_audioTracks[i].extraDataLen);
 
633
        printWavHeader(_audioTracks[i].wavHeader);
 
634
        printf(" Extra Data  : %ld\n",_audioTracks[i].extraDataLen);
636
635
        if(_audioTracks[i].extraDataLen)
637
636
        {
638
637
                mixDump( _audioTracks[i].extraData, _audioTracks[i].extraDataLen);
779
778
        if(avistream) delete avistream;
780
779
}
781
780
 
782
 
uint8_t         OpenDMLHeader::getAudioStreamsInfo(uint32_t *nbStreams, uint32_t **infos)
 
781
uint8_t         OpenDMLHeader::getAudioStreamsInfo(uint32_t *nbStreams, audioInfo **infos)
783
782
{
784
783
        *nbStreams=_nbAudioTracks;
785
784
        if(!_nbAudioTracks)
787
786
                        *infos=NULL;
788
787
                        return 1;
789
788
                }
790
 
        *infos=new uint32_t[_nbAudioTracks];
 
789
        *infos=new audioInfo[_nbAudioTracks];
791
790
        for(int i=0;i<_nbAudioTracks;i++)
792
791
        {
793
 
                (*infos)[i]=_audioTracks[i].wavHeader->encoding;
 
792
            WAV2AudioInfo(_audioTracks[i].wavHeader,&((*infos)[i]));
794
793
        }
795
794
        return 1;
796
795