~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to avidemux/oplug_ogm/op_ogaudio.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:
56
56
#include "ADM_toolkit/ADM_debug.h"
57
57
 
58
58
extern const char *getStrFromAudioCodec( uint32_t codec);       
59
 
extern int audioDelay,audioShift;
 
59
 
60
60
//__________________________________________________
61
61
uint8_t         ADM_ogmWrite::initAudio(void)
62
62
{
63
63
uint32_t        tstart;
64
64
WAVHeader       *info=NULL;
65
 
 
 
65
                audioStream=NULL;
66
66
                if(!currentaudiostream)
67
67
                {
68
 
                        audioFilter=NULL;
69
 
                        audioStream=NULL;
 
68
                        audioFilter=NULL;       
70
69
                        _audioBuffer=NULL;
71
70
                        encoding_gui->setAudioCodec("None");
72
71
                        return 1;
73
72
                }
74
 
                if(currentaudiostream->isCompressed() && currentaudiostream->isDecompressable())
 
73
                if(audioProcessMode() && currentaudiostream->isCompressed() 
 
74
                        && !currentaudiostream->isDecompressable())
75
75
                {
76
 
                        audioStream=new ogm_page(_fd,2);
77
 
                }
78
 
/*
79
 
                else 
80
 
                {                       
81
 
                        return 0;
82
 
                }
83
 
*/
84
 
                //
 
76
                    return 0;
 
77
                }
 
78
                audioStream=new ogm_page(_fd,2);                //
 
79
                audioFilter=buildAudioFilter(currentaudiostream, video_body->getTime (frameStart));
 
80
                if(!audioFilter) return 0;
85
81
                if(audioProcessMode())
86
82
                {
87
83
                        uint16_t fcc;
88
84
                        
89
 
                        audioFilter=  buildAudioFilter (currentaudiostream,
90
 
                                        video_body->getTime (frameStart),
91
 
                                        video_body->getTime (frameEnd-frameStart));
92
 
                        if(!audioFilter) return 0;
93
85
                        fcc=audioFilter->getInfo()->encoding;
94
86
                        encoding_gui->setAudioCodec(getStrFromAudioCodec(fcc));
95
87
                }
96
88
                else    // Copymode
97
89
                {
98
 
                         int32_t shift=0;
99
 
                        if(audioDelay && audioShift) shift=audioDelay;
100
 
                        
101
 
                        // In case of ogm we cannot use the
102
 
                        // shift filter as it would override the getpacket specific
103
 
                        // to ogm container and destroy needed infos
104
 
                        if(currentaudiostream->getInfo()->encoding==WAV_OGG)
105
 
                        {
106
 
                                audioFilter=currentaudiostream;
107
 
                                currentaudiostream->goToTime(video_body->getTime (frameStart));
108
 
                        }
109
 
                        else
110
 
                        {
111
 
                                audioFilter=buildRawAudioFilter( video_body->getTime (frameStart), 
112
 
                                        0xffffffff, shift);
113
 
                        }
114
90
                        encoding_gui->setAudioCodec("Copy");
115
91
                        
116
92
                }
275
251
                packets++;
276
252
                len+=packetLen;
277
253
        }
278
 
        encoding_gui->feedAudioFrame(len);
 
254
//      encoding_gui->feedAudioFrame(len);
279
255
        if(totalsample)
280
256
        {
281
257
                audioStream->flush();
301
277
        if(audioStream) audioStream->flush();
302
278
        if(audioFilter) 
303
279
        {
304
 
                deleteAudioFilter();
 
280
                deleteAudioFilter(audioFilter);
305
281
                audioFilter=NULL;
306
282
        }
307
283
        return 1;