[AV] Removed unused code, merged av and transcode

This commit is contained in:
epoupon
2015-09-11 13:56:41 +02:00
parent 65a8e4ba09
commit c94c859f68
49 changed files with 1050 additions and 1895 deletions
+97
View File
@@ -0,0 +1,97 @@
/*
* Copyright (C) 2015 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
/* This file contains some classes in order to get info from file using the libavconv */
#ifndef AV_INFO_HPP
#define AV_INFO_HPP
extern "C"
{
#define __STDC_CONSTANT_MACROS
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/error.h>
}
#include <vector>
#include <string>
#include <cstdint>
#include <map>
#include <boost/filesystem/path.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
namespace Av
{
void AvInit();
struct Picture
{
std::string mimeType;
std::vector<uint8_t> data;
};
struct Stream
{
enum class Type
{
Audio,
Video,
Subtitle,
};
int id;
Type type;
std::size_t bitrate;
std::string desc; // Description of the stream
};
class MediaFile
{
public:
MediaFile(const boost::filesystem::path& p);
~MediaFile();
boost::filesystem::path getPath() const {return _p;};
bool open(void);
bool scan(void);
boost::posix_time::time_duration getDuration() const;
std::map<std::string, std::string> getMetaData(void);
std::vector<Stream> getStreams(Stream::Type type) const;
int getBestStreamId(Stream::Type type) const; // -1 if failure/unknown
bool hasAttachedPictures(void) const;
std::vector<Picture> getAttachedPictures(std::size_t nbMaxPictures) const;
private:
boost::filesystem::path _p;
AVFormatContext* _context;
};
} // namespace Av
#endif