~ubuntu-branches/ubuntu/jaunty/avidemux/jaunty

« back to all changes in this revision

Viewing changes to avidemux/ADM_codecs/ADM_ffmpeg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-02-17 23:41:46 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217234146-eakx254awuch4wgw
Tags: 1:2.4.4-0.0ubuntu1
* Merge from debian multimedia, Ubuntu remaining changes:
  - debian/control:
    + Build-Depends on newer libx264-dev.
    + Don't Build-Depends on ccache and libamrnb-dev.
    + Build-Depends on libpulse-dev.
    + Fixed small typo in avidemux description.
  - Don't use ccache.
  - Drop patch to fix build with newer x264, it has been merged by upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
{\
48
48
AVCodec *codec=avcodec_find_encoder(x);\
49
49
if(!codec) {GUI_Alert(QT_TR_NOOP("Internal error opening codec"#x));ADM_assert(0);} \
 
50
  capabilities = codec->capabilities & CODEC_CAP_DELAY ? ADM_ENC_REQ_NULL_FLUSH : 0; \
50
51
  res=avcodec_open(_context, codec); \
51
52
  if(res<0) {GUI_Alert(QT_TR_NOOP("Internal error with context for  codec"#x".\n Did you use too low / too high target for 2 pass ?"));return 0;} \
52
53
}
115
116
{
116
117
    int32_t sz = 0;
117
118
    ADM_assert(out->bufferSize);
118
 
    encodePreamble (in->data);
 
119
        encodePreamble (in ? in->data : NULL);
119
120
    if ((sz = avcodec_encode_video (_context, out->data, out->bufferSize, &_frame)) < 0)
120
121
        return 0;
121
122
    postAmble(out,sz);
145
146
  _frame.key_frame = 0;
146
147
  _frame.pict_type = 0;
147
148
 
148
 
  switch(_targetColorSpace)
 
149
  if (in)
149
150
  {
150
 
    case PIX_FMT_YUV420P:
151
 
        _frame.linesize[0] = _w;
152
 
        _frame.linesize[1] = _w >> 1;
153
 
        _frame.linesize[2] = _w >> 1;
154
 
        _frame.data[0] = in;
155
 
        _frame.data[2] = in + _w * _h;
156
 
        _frame.data[1] = in + _w * _h + ((_w * _h) >> 2);
157
 
        break;
158
 
 case PIX_FMT_YUV422P:
159
 
        _frame.linesize[0] = _w;
160
 
        _frame.linesize[1] = _w >> 1;
161
 
        _frame.linesize[2] = _w >> 1;
162
 
        _frame.data[0] = in;
163
 
        _frame.data[2] = in + _w * _h;
164
 
        _frame.data[1] = in + _w * _h + ((_w * _h) >> 1);
165
 
      
166
 
        break;
167
 
    default:
168
 
      ADM_assert(0);
 
151
          switch(_targetColorSpace)
 
152
          {
 
153
                case PIX_FMT_YUV420P:
 
154
                        _frame.linesize[0] = _w;
 
155
                        _frame.linesize[1] = _w >> 1;
 
156
                        _frame.linesize[2] = _w >> 1;
 
157
                        _frame.data[0] = in;
 
158
                        _frame.data[2] = in + _w * _h;
 
159
                        _frame.data[1] = in + _w * _h + ((_w * _h) >> 2);
 
160
                        break;
 
161
         case PIX_FMT_YUV422P:
 
162
                        _frame.linesize[0] = _w;
 
163
                        _frame.linesize[1] = _w >> 1;
 
164
                        _frame.linesize[2] = _w >> 1;
 
165
                        _frame.data[0] = in;
 
166
                        _frame.data[2] = in + _w * _h;
 
167
                        _frame.data[1] = in + _w * _h + ((_w * _h) >> 1);
 
168
              
 
169
                        break;
 
170
                default:
 
171
                  ADM_assert(0);
 
172
          }
169
173
  }
 
174
 
170
175
  return 1;
171
176
}
172
177