Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 114304
Collapse All | Expand All

(-)Source/video.cpp (-14 / +14 lines)
Lines 213-219 Link Here
213
213
214
  for(i = 0; i < video->ic->nb_streams; i++) 
214
  for(i = 0; i < video->ic->nb_streams; i++) 
215
  {
215
  {
216
    AVCodecContext *enc = &video->ic->streams[i]->codec;
216
    AVCodecContext *enc = video->ic->streams[i]->codec;
217
    if(enc->codec_type == CODEC_TYPE_VIDEO)
217
    if(enc->codec_type == CODEC_TYPE_VIDEO)
218
    {
218
    {
219
      video->video_index = i;
219
      video->video_index = i;
Lines 227-233 Link Here
227
    throw kryError(_("The video file does not seem to contain a video stream."));
227
    throw kryError(_("The video file does not seem to contain a video stream."));
228
  }
228
  }
229
229
230
  enc = &video->ic->streams[video->video_index]->codec;
230
  enc = video->ic->streams[video->video_index]->codec;
231
  enc->debug_mv = 0;
231
  enc->debug_mv = 0;
232
  enc->debug = 0;
232
  enc->debug = 0;
233
  enc->workaround_bugs = 1;
233
  enc->workaround_bugs = 1;
Lines 291-299 Link Here
291
  frame = avcodec_alloc_frame();
291
  frame = avcodec_alloc_frame();
292
  while(1)
292
  while(1)
293
  {
293
  {
294
    len = avcodec_decode_video(&video->ic->streams[video->video_index]->codec, 
294
    len = avcodec_decode_video(video->ic->streams[video->video_index]->codec, 
295
                                frame, &got_picture, 
295
                               frame, &got_picture, 
296
                                video->last_pkt->data, video->last_pkt->size);
296
                               video->last_pkt->data, video->last_pkt->size);
297
297
298
    if(got_picture)
298
    if(got_picture)
299
      break;
299
      break;
Lines 302-315 Link Here
302
      return FALSE;
302
      return FALSE;
303
  }
303
  }
304
304
305
  width = video->ic->streams[video->video_index]->codec.width;
305
  width = video->ic->streams[video->video_index]->codec->width;
306
  height = video->ic->streams[video->video_index]->codec.height;
306
  height = video->ic->streams[video->video_index]->codec->height;
307
307
308
  pict->data[0] = (uint8_t*) malloc(4 * width * height);
308
  pict->data[0] = (uint8_t*) malloc(4 * width * height);
309
  pict->linesize[0] = width * 4;
309
  pict->linesize[0] = width * 4;
310
310
311
  if(img_convert(pict, dst_pix_fmt, 
311
  if(img_convert(pict, dst_pix_fmt, 
312
    (AVPicture *) frame, video->ic->streams[video->video_index]->codec.pix_fmt, 
312
    (AVPicture *) frame, video->ic->streams[video->video_index]->codec->pix_fmt, 
313
    width, height) < 0)
313
    width, height) < 0)
314
  {
314
  {
315
    av_free(frame);
315
    av_free(frame);
Lines 323-339 Link Here
323
323
324
int video_get_width(struct video_ffmpeg *video)
324
int video_get_width(struct video_ffmpeg *video)
325
{
325
{
326
  return video->ic->streams[video->video_index]->codec.width;
326
  return video->ic->streams[video->video_index]->codec->width;
327
}
327
}
328
328
329
int video_get_height(struct video_ffmpeg *video)
329
int video_get_height(struct video_ffmpeg *video)
330
{
330
{
331
  return video->ic->streams[video->video_index]->codec.height;
331
  return video->ic->streams[video->video_index]->codec->height;
332
}
332
}
333
333
334
double video_get_fps(struct video_ffmpeg *video)
334
double video_get_fps(struct video_ffmpeg *video)
335
{
335
{
336
  return (video->ic->streams[video->video_index]->r_frame_rate / (double) video->ic->streams[video->video_index]->r_frame_rate_base);
336
  return (video->ic->streams[video->video_index]->r_frame_rate.num / (double) video->ic->streams[video->video_index]->r_frame_rate.den);
337
}
337
}
338
338
339
int64_t video_get_duration(struct video_ffmpeg *video)
339
int64_t video_get_duration(struct video_ffmpeg *video)
Lines 348-354 Link Here
348
    free(video->last_pkt);
348
    free(video->last_pkt);
349
    video->last_pkt = NULL;
349
    video->last_pkt = NULL;
350
  }
350
  }
351
  avcodec_close(&video->ic->streams[video->video_index]->codec);
351
  avcodec_close(video->ic->streams[video->video_index]->codec);
352
  av_close_input_file(video->ic);
352
  av_close_input_file(video->ic);
353
}
353
}
354
354
Lines 376-386 Link Here
376
    if(av_seek_frame(video->ic, -1, target_time) < 0)
376
    if(av_seek_frame(video->ic, -1, target_time) < 0)
377
    #endif
377
    #endif
378
    {
378
    {
379
      g_warning("seek failed... %lld", target_time);
379
      g_warning("seek failed... %lld", (long long) target_time);
380
      return FALSE;
380
      return FALSE;
381
    }
381
    }
382
382
383
    avcodec_flush_buffers(&video->ic->streams[video->video_index]->codec);
383
    avcodec_flush_buffers(video->ic->streams[video->video_index]->codec);
384
  }
384
  }
385
385
386
  if(video->last_pkt)
386
  if(video->last_pkt)

Return to bug 114304