Project

General

Profile

Bug #1815 » libavcodec9.patch

Steffen Vogel, 2013-10-19 19:16

View differences:

src/plumbing/transcoding.c
21 21
#include <libavcodec/avcodec.h>
22 22
#include <libswscale/swscale.h>
23 23
#include <libavutil/dict.h>
24
#include <libavutil/channel_layout.h>
24 25

  
25 26
#include "tvheadend.h"
26 27
#include "settings.h"
......
202 203
  AVCodecContext *ictx;
203 204
  AVPacket packet;
204 205
  AVSubtitle sub;
206
  AVDictionary *opts = NULL;
205 207
  int length,  got_subtitle;
206 208

  
207 209
  subtitle_stream_t *ss = (subtitle_stream_t*)ts;
......
215 217
  if (ictx->codec_id == CODEC_ID_NONE) {
216 218
    ictx->codec_id = icodec->id;
217 219

  
218
    if (avcodec_open(ictx, icodec) < 0) {
220
    if (avcodec_open2(ictx, icodec, &opts) < 0) {
219 221
      tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name);
220 222
      ts->ts_index = 0;
221 223
      goto cleanup;
......
262 264
  streaming_message_t *sm;
263 265
  th_pkt_t *n;
264 266
  audio_stream_t *as = (audio_stream_t*)ts;
267
  AVDictionary *opts = NULL;
265 268

  
266 269
  ictx = as->aud_ictx;
267 270
  octx = as->aud_octx;
......
272 275
  if (ictx->codec_id == CODEC_ID_NONE) {
273 276
    ictx->codec_id = icodec->id;
274 277

  
275
    if (avcodec_open(ictx, icodec) < 0) {
278
    if (avcodec_open2(ictx, icodec, &opts) < 0) {
276 279
      tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name);
277 280
      ts->ts_index = 0;
278 281
      goto cleanup;
......
391 394
  if (octx->codec_id == CODEC_ID_NONE) {
392 395
    octx->codec_id = ocodec->id;
393 396

  
394
    if (avcodec_open(octx, ocodec) < 0) {
397
    if (avcodec_open2(octx, ocodec, &opts) < 0) {
395 398
      tvhlog(LOG_ERR, "transcode", "Unable to open %s encoder", ocodec->name);
396 399
      ts->ts_index = 0;
397 400
      goto cleanup;
......
477 480
  if (ictx->codec_id == CODEC_ID_NONE) {
478 481
    ictx->codec_id = icodec->id;
479 482

  
480
    if (avcodec_open(ictx, icodec) < 0) {
483
    if (avcodec_open2(ictx, icodec, &opts) < 0) {
481 484
      tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name);
482 485
      ts->ts_index = 0;
483 486
      goto cleanup;
......
852 855
  ss->sub_icodec = icodec;
853 856
  ss->sub_ocodec = ocodec;
854 857

  
855
  ss->sub_ictx = avcodec_alloc_context();
856
  ss->sub_octx = avcodec_alloc_context();
858
  ss->sub_ictx = avcodec_alloc_context3(icodec);
859
  ss->sub_octx = avcodec_alloc_context3(ocodec);
857 860

  
858 861
  ss->sub_ictx->codec_type = AVMEDIA_TYPE_SUBTITLE;
859 862
  ss->sub_octx->codec_type = AVMEDIA_TYPE_SUBTITLE;
......
944 947
  as->aud_icodec = icodec;
945 948
  as->aud_ocodec = ocodec;
946 949

  
947
  as->aud_ictx = avcodec_alloc_context();
948
  as->aud_octx = avcodec_alloc_context();
950
  as->aud_ictx = avcodec_alloc_context3(icodec);
951
  as->aud_octx = avcodec_alloc_context3(ocodec);
949 952

  
950 953
  as->aud_ictx->codec_type = AVMEDIA_TYPE_AUDIO;
951 954
  as->aud_octx->codec_type = AVMEDIA_TYPE_AUDIO;
......
1054 1057
  vs->vid_icodec = icodec;
1055 1058
  vs->vid_ocodec = ocodec;
1056 1059

  
1057
  vs->vid_ictx = avcodec_alloc_context();
1058
  vs->vid_octx = avcodec_alloc_context();
1060
  vs->vid_ictx = avcodec_alloc_context3(icodec);
1061
  vs->vid_octx = avcodec_alloc_context3(ocodec);
1059 1062

  
1060 1063
  avcodec_get_context_defaults3(vs->vid_ictx, icodec);
1061 1064
  avcodec_get_context_defaults3(vs->vid_octx, ocodec);
(1-1/2)