| 671 | } |
| 672 | |
| 673 | uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int id_parent, int type) |
| 674 | { |
| 675 | #ifndef FFMPEG_ENABLED |
| 676 | Q_UNUSED(path); |
| 677 | Q_UNUSED(name); |
| 678 | Q_UNUSED(id_parent); |
| 679 | Q_UNUSED(type); |
| 680 | |
| 681 | return 0; |
| 682 | #else |
| 683 | int ohfi; |
| 684 | AVDecoder decoder; |
| 685 | quint64 duration; |
| 686 | int file_format, parental_level, width, height, video_codec, video_bitrate, audio_codec, audio_bitrate; |
| 687 | const char *explanation, *copyright, *title; |
| 688 | |
| 689 | if(!decoder.open(path + "/" + name) || !decoder.loadCodec(AVDecoder::CODEC_VIDEO)) { |
| 690 | return 0; |
| 691 | } |
| 692 | |
| 693 | int cma_file_type = checkFileType(name, VITA_OHFI_VIDEO); |
| 694 | if(cma_file_type < 0) { |
| 695 | //qDebug() << "Excluding from database:" << path; |
| 696 | return 0; |
| 697 | } |
| 698 | |
| 699 | parental_level = 0; |
| 700 | explanation = decoder.getMetadataEntry("comments", ""); |
| 701 | copyright = decoder.getMetadataEntry("copyright", ""); |
| 702 | width = decoder.getWidth(); |
| 703 | height = decoder.getHeight(); |
| 704 | duration = decoder.getDuration(); |
| 705 | video_codec = CODEC_TYPE_AVC; |
| 706 | video_bitrate = decoder.getBitrate(); |
| 707 | file_format = video_list[cma_file_type].file_format; |
| 708 | |
| 709 | if(decoder.loadCodec(AVDecoder::CODEC_AUDIO)) { |
| 710 | audio_codec = CODEC_TYPE_AAC; |
| 711 | audio_bitrate = decoder.getBitrate(); |
| 712 | } else { |
| 713 | audio_codec = 0; |
| 714 | audio_bitrate = 0; |
| 715 | } |
| 716 | |
| 717 | QByteArray basename = QFileInfo(name).baseName().toUtf8(); |
| 718 | //title = decoder.getMetadataEntry("title", basename.constData()); |
| 719 | title = basename.constData(); |
| 720 | |
| 721 | |
| 722 | if((ohfi = insertDefaultEntry(path, name, title, id_parent, type)) == 0) { |
| 723 | return 0; |
| 724 | } |
| 725 | |
| 726 | QSqlQuery query; |
| 727 | query.prepare("REPLACE INTO videos" |
| 728 | "(object_id, file_format, parental_level, explanation, copyright, width, height, video_codec, video_bitrate, audio_codec, audio_bitrate, duration)" |
| 729 | "VALUES (:object_id, :file_format, :parental_level, :explanation, :copyright, :width, :height, :video_codec, :video_bitrate, :audio_codec, :audio_bitrate, :duration)"); |
| 730 |
nothing calls this directly
no test coverage detected