summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/codec.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/common/codec.cpp b/common/codec.cpp
deleted file mode 100644
index d38a8e5..0000000
--- a/common/codec.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * codec.cpp
- *
- * Created on: 13.10.2012
- * Author: savop
- */
-
-#include "../include/tools/codec.h"
-
-namespace upnp {
-
-namespace codec {
-
-cFormatContext::cFormatContext()
-: formatCtx(NULL)
-{
- av_register_all();
-}
-
-cFormatContext::~cFormatContext(){
- av_free(formatCtx);
-}
-
-bool cFormatContext::Open(const string& file){
- if(avformat_open_input(&formatCtx, file.c_str(), NULL, NULL) == 0){
- if(avformat_find_stream_info(formatCtx, NULL) == 0){
- return true;
- }
- }
-
- return false;
-}
-
-const AVCodec* cFormatContext::GetCodec(AVMediaType Type) const {
- return avcodec_find_decoder(GetCodecContext(Type)->codec_id);
-}
-
-const AVCodecContext* cFormatContext::GetCodecContext(AVMediaType Type) const {
- const AVStream* strm = GetStream(Type);
- return strm?strm->codec:NULL;
-}
-
-const AVStream* cFormatContext::GetStream(AVMediaType Type) const {
- if(!formatCtx) return NULL;
- int Stream = -1; unsigned int i;
- for(i = 0; i < formatCtx->nb_streams; i++){
- if(formatCtx->streams[i]->codec->codec_type == Type){
- Stream = i;
- break;
- }
- }
- if(Stream == -1){
- return NULL;
- }
-
- return formatCtx->streams[Stream];
-}
-
-AVFormatContext* cFormatContext::operator*() const {
- return formatCtx;
-}
-
-} // namespace codec
-
-} // namespace upnp