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

(-)strigi-0.7.7/libstreamanalyzer/plugins/endplugins/ffmpegendanalyzer.cpp.bero (-23 / +30 lines)
Lines 305-317 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
305
  uint8_t pDataBuffer[32768];//65536];
305
  uint8_t pDataBuffer[32768];//65536];
306
  long lSize = 32768;
306
  long lSize = 32768;
307
307
308
  ByteIOContext ByteIOCtx;
309
  if(init_put_byte(&ByteIOCtx, pDataBuffer, lSize, 0, in, read_data, NULL, seek_data) < 0)
310
    return -1;
311
312
  //pAVInputFormat->flags |= AVFMT_NOFILE;
313
  ByteIOCtx.is_streamed = 0;
314
315
  AVProbeData pd;
308
  AVProbeData pd;
316
  const char *buf;
309
  const char *buf;
317
  pd.filename ="";
310
  pd.filename ="";
Lines 324-337 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
324
  if(fmt == NULL)
317
  if(fmt == NULL)
325
    return 1;
318
    return 1;
326
319
327
  AVFormatContext *fc = NULL;
320
  AVFormatContext *fc = avformat_alloc_context();
328
  if(av_open_input_stream(&fc, &ByteIOCtx, "", fmt, NULL) < 0)
321
  if(!fc)
322
    return -1;
323
324
  AVIOContext *pb = avio_alloc_context(pDataBuffer, lSize, 0, in, read_data, NULL, seek_data);
325
  if(!fc->pb) {
326
    av_free(fc);
329
    return -1;
327
    return -1;
328
  }
329
330
  fc->pb = pb;
331
332
  if(avformat_open_input(&fc, "", fmt, NULL) < 0) {
333
    av_free(fc);
334
    return -1;
335
  }
330
336
331
  av_find_stream_info(fc);
337
  avformat_find_stream_info(fc, NULL);
332
  
338
  
333
  // Dump information about file onto standard error
339
  // Dump information about file onto standard error
334
  dump_format(fc, 0, ar.path().c_str(), false);
340
  av_dump_format(fc, 0, ar.path().c_str(), false);
335
341
336
  if(fc->bit_rate)
342
  if(fc->bit_rate)
337
    ar.addValue(factory->bitrateProperty, fc->bit_rate);
343
    ar.addValue(factory->bitrateProperty, fc->bit_rate);
Lines 372-381 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
372
        ar.addTriplet(streamuri, durationPropertyName,outs.str());
378
        ar.addTriplet(streamuri, durationPropertyName,outs.str());
373
      }
379
      }
374
380
375
      //FIXME we must stop using the deprecated fuction av_metadata_get and use
381
      //FIXME we must stop using the deprecated fuction av_dict_get and use
376
      // av_dict_get once we are able to detect the version of FFMpeg being used
382
      // av_dict_get once we are able to detect the version of FFMpeg being used
377
      // using version macros. same goes for all occurences of this function.
383
      // using version macros. same goes for all occurences of this function.
378
      AVMetadataTag *entry = av_metadata_get(stream.metadata, "language", NULL, 0);
384
      AVDictionaryEntry *entry = av_dict_get(stream.metadata, "language", NULL, 0);
379
      if (entry != NULL) {
385
      if (entry != NULL) {
380
        const char *languageValue = entry->value;
386
        const char *languageValue = entry->value;
381
        if (size_t len = strlen(languageValue)) {
387
        if (size_t len = strlen(languageValue)) {
Lines 430-436 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
430
          outs << codec.sample_rate;
436
          outs << codec.sample_rate;
431
          ar.addTriplet(streamuri, sampleratePropertyName, outs.str());
437
          ar.addTriplet(streamuri, sampleratePropertyName, outs.str());
432
        }
438
        }
433
        if (codec.sample_fmt != SAMPLE_FMT_NONE) {}//FIXME sample format
439
        if (codec.sample_fmt != AV_SAMPLE_FMT_NONE) {}//FIXME sample format
434
          
440
          
435
      } else { // video stream
441
      } else { // video stream
436
        
442
        
Lines 469-475 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
469
475
470
  // Tags
476
  // Tags
471
477
472
  AVMetadataTag *entry = av_metadata_get(fc->metadata, "title", NULL, 0);
478
  AVDictionaryEntry *entry = av_dict_get(fc->metadata, "title", NULL, 0);
473
  if (entry != NULL)
479
  if (entry != NULL)
474
  {
480
  {
475
    const char *titleValue = entry->value;
481
    const char *titleValue = entry->value;
Lines 478-484 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
478
    }
484
    }
479
  }
485
  }
480
486
481
  entry = av_metadata_get(fc->metadata, "author", NULL, 0);
487
  entry = av_dict_get(fc->metadata, "author", NULL, 0);
482
  if (entry != NULL)
488
  if (entry != NULL)
483
  {
489
  {
484
    const char *authorValue = entry->value;
490
    const char *authorValue = entry->value;
Lines 490-496 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
490
    }
496
    }
491
  }
497
  }
492
498
493
  entry = av_metadata_get(fc->metadata, "copyright", NULL, 0);
499
  entry = av_dict_get(fc->metadata, "copyright", NULL, 0);
494
  if (entry != NULL)
500
  if (entry != NULL)
495
  {
501
  {
496
    const char *copyrightValue = entry->value;
502
    const char *copyrightValue = entry->value;
Lines 499-505 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
499
    }
505
    }
500
  }
506
  }
501
507
502
  entry = av_metadata_get(fc->metadata, "comment", NULL, 0);
508
  entry = av_dict_get(fc->metadata, "comment", NULL, 0);
503
  if (entry != NULL)
509
  if (entry != NULL)
504
  {
510
  {
505
    const char *commentValue = entry->value;
511
    const char *commentValue = entry->value;
Lines 508-514 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
508
    }
514
    }
509
  }
515
  }
510
516
511
  entry = av_metadata_get(fc->metadata, "album", NULL, 0);
517
  entry = av_dict_get(fc->metadata, "album", NULL, 0);
512
  if (entry != NULL)
518
  if (entry != NULL)
513
  {
519
  {
514
    const char *albumValue = entry->value;
520
    const char *albumValue = entry->value;
Lines 520-526 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
520
    }
526
    }
521
  }
527
  }
522
528
523
  entry = av_metadata_get(fc->metadata, "genre", NULL, 0);
529
  entry = av_dict_get(fc->metadata, "genre", NULL, 0);
524
  if (entry != NULL)
530
  if (entry != NULL)
525
  {
531
  {
526
    const char *genreValue = entry->value;
532
    const char *genreValue = entry->value;
Lines 529-535 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
529
    }
535
    }
530
  }
536
  }
531
537
532
  entry = av_metadata_get(fc->metadata, "track", NULL, 0);
538
  entry = av_dict_get(fc->metadata, "track", NULL, 0);
533
  if (entry != NULL)
539
  if (entry != NULL)
534
  {
540
  {
535
    const char *trackValue = entry->value;
541
    const char *trackValue = entry->value;
Lines 538-544 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
538
    }
544
    }
539
  }
545
  }
540
546
541
  entry = av_metadata_get(fc->metadata, "year", NULL, 0);
547
  entry = av_dict_get(fc->metadata, "year", NULL, 0);
542
  if (entry != NULL)
548
  if (entry != NULL)
543
  {
549
  {
544
    const char *yearValue = entry->value;
550
    const char *yearValue = entry->value;
Lines 547-553 FFMPEGEndAnalyzer::analyze(AnalysisResul Link Here
547
    }
553
    }
548
  }
554
  }
549
555
550
  av_close_input_stream(fc);
556
  avformat_close_input(&fc);
557
  av_free(pb);
551
  //url_fclose(&ByteIOCtx);
558
  //url_fclose(&ByteIOCtx);
552
  
559
  
553
  return 0;
560
  return 0;

Return to bug 417877