Skip to content

Commit

Permalink
added some more codecs (vp8 & mpeg4video)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-tornblom committed Aug 3, 2012
1 parent 9cfeb6a commit 6accfb6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 17 deletions.
10 changes: 10 additions & 0 deletions src/dvr/mkmux.c
Expand Up @@ -196,6 +196,16 @@ mk_build_tracks(mk_mux_t *mkm, const struct streaming_start *ss)
mkm->tracks[i].merge = 1;
break;

case SCT_MPEG4VIDEO:
tracktype = 1;
codec_id = "V_MPEG4/ISO/ASP";
break;

case SCT_VP8:
tracktype = 1;
codec_id = "V_VP8";
break;

case SCT_H264:
tracktype = 1;
codec_id = "V_MPEG4/ISO/AVC";
Expand Down
48 changes: 33 additions & 15 deletions src/plumbing/transcode.c
Expand Up @@ -144,6 +144,12 @@ transcoder_get_codec_id(streaming_component_type_t type)
case SCT_MPEG2AUDIO:
codec_id = CODEC_ID_MP2;
break;
case SCT_MPEG4VIDEO:
codec_id = CODEC_ID_MPEG4;
break;
case SCT_VP8:
codec_id = CODEC_ID_VP8;
break;
default:
codec_id = CODEC_ID_NONE;
break;
Expand Down Expand Up @@ -466,21 +472,33 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt)
ts->tctx->global_quality = 10;
ts->tctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
break;
/*
case SCT_VP8:
ts->tctx->codec_id = CODEC_ID_VP8;
ts->tctx->pix_fmt = PIX_FMT_YUV420P;
//ts->tctx->flags |= CODEC_FLAG_QSCALE;
ts->tctx->rc_lookahead = 1;
ts->tctx->max_b_frames = 1;
ts->tctx->qmin = 1;
ts->tctx->qmax = 63;
ts->tctx->bit_rate = 250 * 1000;
ts->tctx->rc_min_rate = ts->tctx->bit_rate;
ts->tctx->rc_max_rate = ts->tctx->bit_rate;
ts->enc_frame->quality = 20;
break;
*/
case SCT_MPEG4VIDEO:
ts->tctx->codec_id = CODEC_ID_MPEG4;
ts->tctx->pix_fmt = PIX_FMT_YUV420P;
//ts->tctx->flags |= CODEC_FLAG_QSCALE;
ts->tctx->rc_lookahead = 0;
ts->tctx->max_b_frames = 0;
ts->tctx->qmin = 1;
ts->tctx->qmax = FF_LAMBDA_MAX;
ts->tctx->global_quality = 10;
ts->tctx->bit_rate = 2 * ts->tctx->width * ts->tctx->height;
ts->tctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
break;

case SCT_VP8:
ts->tctx->codec_id = CODEC_ID_VP8;
ts->tctx->pix_fmt = PIX_FMT_YUV420P;
//ts->tctx->flags |= CODEC_FLAG_QSCALE;
ts->tctx->rc_lookahead = 1;
ts->tctx->max_b_frames = 1;
ts->tctx->qmin = 1;
ts->tctx->qmax = 63;
ts->tctx->bit_rate = 8 * ts->tctx->width * ts->tctx->height;
ts->tctx->rc_min_rate = ts->tctx->bit_rate;
ts->tctx->rc_max_rate = ts->tctx->bit_rate;
ts->enc_frame->quality = 20;
break;

case SCT_H264:
ts->tctx->codec_id = CODEC_ID_H264;
ts->tctx->pix_fmt = PIX_FMT_YUV420P;
Expand Down
4 changes: 3 additions & 1 deletion src/psi.c
Expand Up @@ -900,8 +900,10 @@ psi_caid2name(uint16_t caid)
*/
static struct strtab streamtypetab[] = {
{ "MPEG2VIDEO", SCT_MPEG2VIDEO },
{ "MPEG4VIDEO", SCT_MPEG4VIDEO },
{ "MPEG2AUDIO", SCT_MPEG2AUDIO },
{ "H264", SCT_H264 },
{ "VP8", SCT_VP8 },
{ "AC3", SCT_AC3 },
{ "TELETEXT", SCT_TELETEXT },
{ "DVBSUB", SCT_DVBSUB },
Expand All @@ -912,7 +914,7 @@ static struct strtab streamtypetab[] = {
{ "MPEGTS", SCT_MPEGTS },
{ "TEXTSUB", SCT_TEXTSUB },
{ "EAC3", SCT_EAC3 },
{ "AAC", SCT_MP4A },
{ "AAC", SCT_MP4A },
};


Expand Down
5 changes: 4 additions & 1 deletion src/tvheadend.h
Expand Up @@ -164,9 +164,12 @@ typedef enum {
SCT_TEXTSUB,
SCT_EAC3,
SCT_MP4A,
SCT_MPEG4VIDEO,
SCT_VP8,
} streaming_component_type_t;

#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264)
#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264 || \
(t) == SCT_MPEG4VIDEO || (t) == SCT_VP8)
#define SCT_ISAUDIO(t) ((t) == SCT_MPEG2AUDIO || (t) == SCT_AC3 || \
(t) == SCT_AAC || (t) == SCT_MP4A)
#define SCT_ISSUBTITLE(t) ((t) == SCT_TEXTSUB || (t) == SCT_DVBSUB)
Expand Down
6 changes: 6 additions & 0 deletions src/webui/lav_muxer.c
Expand Up @@ -46,6 +46,12 @@ lav_muxer_get_codec_id(streaming_component_type_t type)
case SCT_MPEG2VIDEO:
codec_id = CODEC_ID_MPEG2VIDEO;
break;
case SCT_MPEG4VIDEO:
codec_id = CODEC_ID_MPEG4;
break;
case SCT_VP8:
codec_id = CODEC_ID_VP8;
break;
case SCT_AC3:
codec_id = CODEC_ID_AC3;
break;
Expand Down

0 comments on commit 6accfb6

Please sign in to comment.