~ubuntu-branches/ubuntu/precise/vdr-plugin-xineliboutput/precise

« back to all changes in this revision

Viewing changes to xine/demux_xvdr_tsdata.c

  • Committer: Bazaar Package Importer
  • Author(s): Tobias Grimm
  • Date: 2010-05-02 15:19:11 UTC
  • mfrom: (1.2.1 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100502151911-76o36blrqp5jjsgb
Tags: 1.0.6~cvs20100502.0851-1
* New Upstream Snapshot
* source/format 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * demux_xvdr_tsdata.h: data for MPEG-TS demuxer
3
 
 *
4
 
 * See the main source file 'xineliboutput.c' for copyright information and
5
 
 * how to reach the author.
6
 
 *
7
 
 * $Id: demux_xvdr_tsdata.c,v 1.1 2009/02/24 19:50:42 phintuka Exp $
8
 
 *
9
 
 */
10
 
 
11
 
#include <stdlib.h>
12
 
 
13
 
#include <xine/buffer.h>
14
 
 
15
 
#define LOG_MODULENAME "[demux_vdr] "
16
 
#define SysLogLevel    iSysLogLevel
17
 
#include "../logdefs.h"
18
 
 
19
 
#include "../tools/ts.h"
20
 
#include "ts2es.h"
21
 
 
22
 
#include "demux_xvdr_tsdata.h"
23
 
 
24
 
static void ts_data_ts2es_reset(ts_data_t *ts_data)
25
 
{
26
 
  int i;
27
 
 
28
 
  ts2es_dispose(ts_data->video);
29
 
  ts_data->video = NULL;
30
 
 
31
 
  for (i = 0; ts_data->audio[i]; i++) {
32
 
    ts2es_dispose(ts_data->audio[i]);
33
 
    ts_data->audio[i] = NULL;
34
 
  }
35
 
 
36
 
  for (i = 0; ts_data->spu[i]; i++) {
37
 
    ts2es_dispose(ts_data->spu[i]);
38
 
    ts_data->spu[i] = NULL;
39
 
  }
40
 
}
41
 
 
42
 
void ts_data_ts2es_init(ts_data_t **ts_data, fifo_buffer_t *video_fifo, fifo_buffer_t *audio_fifo)
43
 
{
44
 
  if (*ts_data)
45
 
    ts_data_ts2es_reset(*ts_data);
46
 
  else
47
 
    *ts_data = calloc (1, sizeof(ts_data_t));
48
 
 
49
 
  ts_data_t *this = *ts_data;
50
 
  int i;
51
 
 
52
 
  if (video_fifo) {
53
 
    if (this->pmt.video_pid != INVALID_PID)
54
 
      this->video = ts2es_init(video_fifo, this->pmt.video_type, 0);
55
 
 
56
 
    for (i=0; i < this->pmt.spu_tracks_count; i++)
57
 
      this->spu[i] = ts2es_init(video_fifo, STREAM_DVBSUB, i);
58
 
  }
59
 
 
60
 
  if (audio_fifo) {
61
 
    for (i=0; i < this->pmt.audio_tracks_count; i++)
62
 
      this->audio[i] = ts2es_init(audio_fifo, this->pmt.audio_tracks[i].type, i);
63
 
  }
64
 
}
65
 
 
66
 
void ts_data_flush(ts_data_t *ts_data)
67
 
{
68
 
  if (ts_data) {
69
 
    int i;
70
 
 
71
 
    if (ts_data->video)
72
 
      ts2es_flush(ts_data->video);
73
 
 
74
 
    for (i = 0; ts_data->audio[i]; i++)
75
 
      ts2es_flush(ts_data->audio[i]);
76
 
 
77
 
    for (i = 0; ts_data->spu[i]; i++)
78
 
      ts2es_flush(ts_data->spu[i]);
79
 
  }
80
 
}
81
 
 
82
 
void ts_data_dispose(ts_data_t **ts_data)
83
 
{
84
 
  if (*ts_data) {
85
 
 
86
 
    ts_data_ts2es_reset(*ts_data);
87
 
 
88
 
    free(*ts_data);
89
 
    *ts_data = NULL;
90
 
  }
91
 
}