Submitted By:            Armin K. <krejzi at email dot com>
Date:                    2013-01-05
Initial Package Version: 1.1.7
Upstream Status:         Unknown
Origin:                  Archlinux and Debian
Description:             Fixes building against FFMpeg 1.0

--- transcode.orig/encode/encode_lavc.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/encode/encode_lavc.c	2013-01-05 21:28:41.336682489 +0100
@@ -1387,7 +1387,7 @@
                     pd->confdata.thread_count,
                     (pd->confdata.thread_count > 1) ?"s" :"");
     }
-    avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count);
+    &pd->ff_vcontext->thread_count = pd->confdata.thread_count;
 
     pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd));
     if (pd->ff_vcodec == NULL) {
--- transcode.orig/export/export_ffmpeg.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/export/export_ffmpeg.c	2013-01-05 21:28:41.338682520 +0100
@@ -180,7 +180,7 @@
 
 
 /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */
-#include <libavcodec/opt.h>
+#include <libavutil/opt.h>
 #include <libavutil/avstring.h>
 #include <libswscale/swscale.h>
 
@@ -470,7 +470,6 @@
     }
 
     TC_LOCK_LIBAVCODEC;
-    avcodec_init();
     avcodec_register_all();
     TC_UNLOCK_LIBAVCODEC;
 
@@ -634,7 +633,6 @@
         lavc_param_rc_max_rate = 2516;
         lavc_param_rc_buffer_size = 224 * 8;
         lavc_param_rc_buffer_aggressivity = 99;
-        lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
 
         break;
 
@@ -674,7 +672,6 @@
 
         lavc_param_rc_buffer_size = 224 * 8;
         lavc_param_rc_buffer_aggressivity = 99;
-        lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
 
         break;
 
@@ -887,7 +884,7 @@
 		    lavc_venc_context->thread_count);
     }
 
-    avcodec_thread_init(lavc_venc_context, lavc_param_threads);
+    lavc_venc_context->thread_count = lavc_param_threads;
 
     if (lavc_param_intra_matrix) {
         char *tmp;
@@ -1252,7 +1249,7 @@
       return TC_EXPORT_ERROR;
     }
 
-    if (lavc_venc_context->codec->encode == NULL) {
+    if (lavc_venc_context->codec->encode2 == NULL) {
       tc_log_warn(MOD_NAME, "could not open FFMPEG codec "
               "(lavc_venc_context->codec->encode == NULL)");
       return TC_EXPORT_ERROR;
--- transcode.orig/export/ffmpeg_cfg.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/export/ffmpeg_cfg.c	2013-01-05 21:28:53.639872618 +0100
@@ -126,7 +126,7 @@
 //int lavc_param_atag = 0;
 //int lavc_param_abitrate = 224;
 
-char *lavc_param_video_preset = "medium";
+char *lavc_param_video_preset = NULL;
 char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg";
 
 TCConfigEntry lavcopts_conf[]={
@@ -160,9 +160,7 @@
     {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
     {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
     {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
-    {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
 //    {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0},
-    {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
     {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1},
     {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
     {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0},
@@ -211,7 +209,6 @@
 #else
     {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED},
 #endif    
-    {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV},
     {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
     {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
     {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
@@ -223,9 +220,6 @@
     {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
     {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD},
     {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16},
-    {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT},
-    {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET},
-    {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN},
     {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME},
     {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
     {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
@@ -237,7 +231,6 @@
     {"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
     {"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
     {"fps_code", &lavc_param_fps_code, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9},
-    {"vpre", &lavc_param_video_preset, TCCONF_TYPE_STRING, 0, 0, 0},
     {"ffmpeg_datadir", &lavc_param_ffmpeg_datadir, TCCONF_TYPE_STRING, 0, 0, 0},
     {NULL, NULL, 0, 0, 0, 0}
 };
--- transcode.orig/filter/filter_pp.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/filter/filter_pp.c	2013-01-05 21:28:41.339682535 +0100
@@ -38,8 +38,8 @@
 
 /* FIXME: these use the filter ID as an index--the ID can grow
  * arbitrarily large, so this needs to be fixed */
-static pp_mode_t *mode[100];
-static pp_context_t *context[100];
+static pp_mode *mode[100];
+static pp_context *context[100];
 static int width[100], height[100];
 static int pre[100];
 
--- transcode.orig/import/decode_lavc.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/import/decode_lavc.c	2013-01-05 21:28:41.340682551 +0100
@@ -181,7 +181,7 @@
 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
   lavc_dec_context->error_resilience  = 2;
 #else
-  lavc_dec_context->error_recognition = 2;
+  lavc_dec_context->err_recognition = 2;
 #endif
   lavc_dec_context->error_concealment = 3;
   lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
--- transcode.orig/import/import_ffmpeg.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/import/import_ffmpeg.c	2013-01-05 21:28:41.340682551 +0100
@@ -314,7 +314,7 @@
 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
     lavc_dec_context->error_resilience  = 2;
 #else
-    lavc_dec_context->error_recognition = 2;
+    lavc_dec_context->err_recognition = 2;
 #endif
     lavc_dec_context->error_concealment = 3;
     lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
--- transcode.orig/import/probe_ffmpeg.c	2011-11-19 17:50:27.000000000 +0100
+++ transcode/import/probe_ffmpeg.c	2013-01-05 21:28:41.341682566 +0100
@@ -99,8 +99,8 @@
 
     TC_INIT_LIBAVCODEC;
 
-    ret = av_open_input_file(&lavf_dmx_context, ipipe->name,
-                             NULL, 0, NULL);
+    ret = avformat_open_input(&lavf_dmx_context, ipipe->name,
+                             NULL, NULL);
     if (ret != 0) {
         tc_log_error(__FILE__, "unable to open '%s'"
                                " (libavformat failure)",
--- transcode.orig/libtc/tcavcodec.h	2011-11-19 17:50:27.000000000 +0100
+++ transcode/libtc/tcavcodec.h	2013-01-05 21:28:41.341682566 +0100
@@ -53,7 +53,6 @@
 
 #define TC_INIT_LIBAVCODEC do { \
     TC_LOCK_LIBAVCODEC; \
-    avcodec_init(); \
     avcodec_register_all(); \
     TC_UNLOCK_LIBAVCODEC; \
 } while (0)
