summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a09f965)
raw | patch | inline | side by side (parent: a09f965)
author | Chandramohan C <chandramohan.c@ti.com> | |
Fri, 6 Sep 2013 08:32:53 +0000 (08:32 +0000) | ||
committer | Chandramohan <a0131763@ti.com> | |
Fri, 6 Sep 2013 08:33:11 +0000 (14:03 +0530) |
Padded width and height are same as width and height for mpeg2 format
this is a hack to support it and only 720p video is tested.
demux.c cleaned up and moved generic include headers to demux.h
Signed-off-by: Chandramohan C <chandramohan.c@ti.com>
this is a hack to support it and only 720p video is tested.
demux.c cleaned up and moved generic include headers to demux.h
Signed-off-by: Chandramohan C <chandramohan.c@ti.com>
util/demux.c | patch | blob | history | |
util/demux.h | patch | blob | history | |
viddec3test.c | patch | blob | history |
diff --git a/util/demux.c b/util/demux.c
index 4e36f1a41d66c8309e38fbc819c86b8325c8af6e..c043848e8ed60e43324bb60e736aec915b14a27a 100644 (file)
--- a/util/demux.c
+++ b/util/demux.c
#include "config.h"
#endif
-#include <libavformat/avformat.h>
-#include <libavcodec/avcodec.h>
+#include "demux.h"
#include "util.h"
-struct demux {
- AVFormatContext *afc;
- AVStream *st;
- AVCodecContext *cc;
- AVBitStreamFilterContext *bsf;
-};
-
static AVFormatContext *
open_file(const char *filename)
{
AVBitStreamFilterContext *bsf = NULL;
struct demux *demux;
- if (cc->codec_id != CODEC_ID_H264) {
+ if ((cc->codec_id != CODEC_ID_H264) && (cc->codec_id != CODEC_ID_MPEG2VIDEO)){
ERROR("could not open '%s': unsupported codec %d", filename, cc->codec_id);
return NULL;
}
diff --git a/util/demux.h b/util/demux.h
index 56538494ec009816837435dccd515c8c5db257bc..cec9a611c029a14226527ac43726e07c068f9625 100644 (file)
--- a/util/demux.h
+++ b/util/demux.h
#ifndef __DEMUX_H__
#define __DEMUX_H__
-struct demux;
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+
+struct demux {
+ AVFormatContext *afc;
+ AVStream *st;
+ AVCodecContext *cc;
+ AVBitStreamFilterContext *bsf;
+};
struct demux * demux_init(const char * filename, int *width, int *height);
int demux_read(struct demux *demux, char *input, int size);
int demux_rewind(struct demux *demux);
diff --git a/viddec3test.c b/viddec3test.c
index 630674218fac8193ee50fd29ce78eb140b1b986b..53004f1d7d54c45bf07293dce2f055066b1b1ecd 100644 (file)
--- a/viddec3test.c
+++ b/viddec3test.c
/* calculate output buffer parameters: */
width = ALIGN2 (width, 4); /* round up to macroblocks */
height = ALIGN2 (height, 4); /* round up to macroblocks */
- padded_width = ALIGN2 (width + (2*PADX), 7);
- padded_height = height + 4*PADY;
+
+ if (decoder->demux->cc->codec_id == CODEC_ID_MPEG2VIDEO) {
+ padded_width = width;
+ padded_height= height;
+ }
+ else {
+ padded_width = ALIGN2 (width + (2*PADX), 7);
+ padded_height = height + 4*PADY;
+ }
+
decoder->num_outBuf = MIN(16, 32768 / ((width/16) * (height/16))) + 3;
decoder->padded_width = padded_width;
decoder->padded_height = padded_height;
decoder->params->numOutputDataUnits = 0;
decoder->params->errorInfoMode = IVIDEO_ERRORINFO_OFF;
- decoder->codec = VIDDEC3_create(decoder->engine,
+ if (decoder->demux->cc->codec_id == CODEC_ID_MPEG2VIDEO) {
+ decoder->codec = VIDDEC3_create(decoder->engine,
+ "ivahd_mpeg2vdec", decoder->params);
+ }
+ else if (decoder->demux->cc->codec_id == CODEC_ID_H264) {
+ decoder->codec = VIDDEC3_create(decoder->engine,
"ivahd_h264dec", decoder->params);
+ }
if (!decoder->codec) {
ERROR("%p: could not create codec", decoder);