summaryrefslogtreecommitdiff
path: root/include/tools/codec.h
blob: 768fa155b5dea888e8615f3ea287d774ee81e070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * codec.h
 *
 *  Created on: 12.10.2012
 *      Author: savop
 */

#ifndef CODEC_H_
#define CODEC_H_

#ifdef __cplusplus
 #define __STDC_CONSTANT_MACROS
 #ifdef _STDINT_H
  #undef _STDINT_H
 #endif
 #include <stdint.h>
#endif

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}

#include <string>

using namespace std;

namespace upnp {

namespace codec {

class cFormatContext {
public:
  cFormatContext();
  virtual ~cFormatContext();

  bool Open(const string& file);

  const AVCodec* GetCodec(AVMediaType Type) const;
  const AVCodecContext* GetCodecContext(AVMediaType Type) const;
  const AVStream* GetStream(AVMediaType Type) const;

  AVFormatContext* operator*() const;
private:
  AVFormatContext* formatCtx;
};

}

}


#endif /* CODEC_H_ */