summaryrefslogtreecommitdiff
path: root/testing/ffmpegthumbnailer/ffmpegapi_fix_r241.patch
blob: 37e65b059f6f2966b45baf6ee3a05805abb2f3d9 (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
54
55
56
--- libffmpegthumbnailer/moviedecoder.cpp.old	2012-05-20 11:57:04.503450287 +0200
+++ libffmpegthumbnailer/moviedecoder.cpp	2012-05-20 11:57:14.633450566 +0200
@@ -58,19 +58,26 @@
 void MovieDecoder::initialize(const string& filename)
 {
     av_register_all();
-    avcodec_init();
     avcodec_register_all();
 
     string inputFile = filename == "-" ? "pipe:" : filename;
     m_AllowSeek = (filename != "-") && (filename.find("rtsp://") != 0);
-
+    
+#if LIBAVCODEC_VERSION_MAJOR < 53
     if ((!m_FormatContextWasGiven) && av_open_input_file(&m_pFormatContext, inputFile.c_str(), NULL, 0, NULL) != 0)
+#else
+	if ((!m_FormatContextWasGiven) && avformat_open_input(&m_pFormatContext, inputFile.c_str(), NULL, NULL) != 0)
+#endif
     {
 		destroy();
         throw logic_error(string("Could not open input file: ") + filename);
     }
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
     if (av_find_stream_info(m_pFormatContext) < 0)
+#else
+	if (avformat_find_stream_info(m_pFormatContext, NULL) < 0)
+#endif
     {
 		destroy();
         throw logic_error(string("Could not find stream information"));
@@ -90,8 +97,12 @@
 
     if ((!m_FormatContextWasGiven) && m_pFormatContext)
     {
+#if LIBAVCODEC_VERSION_MAJOR < 53
         av_close_input_file(m_pFormatContext);
         m_pFormatContext = NULL;
+#else
+        avformat_close_input(&m_pFormatContext);
+#endif
     }
 
     if (m_pPacket)
@@ -159,7 +170,11 @@
 
     m_pVideoCodecContext->workaround_bugs = 1;
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
     if (avcodec_open(m_pVideoCodecContext, m_pVideoCodec) < 0)
+#else
+	if (avcodec_open2(m_pVideoCodecContext, m_pVideoCodec, NULL) < 0)
+#endif
     {
         throw logic_error("Could not open video codec");
     }