summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-09-13 21:21:48 +0000
committerrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-09-13 21:21:48 +0000
commit49bc2466076f14035e1d7a09241247f0f9964291 (patch)
treeea51fe8cab869d51ab7b2b14e09ff912062954b1 /libmpcodecs
parent26fc7d22bd9c9ef3ed3c2e3622e8785ebc705941 (diff)
downloadmpv-49bc2466076f14035e1d7a09241247f0f9964291.tar.bz2
mpv-49bc2466076f14035e1d7a09241247f0f9964291.tar.xz
AVC support moved to libavcodec, avcC atom is now passed in extradata
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13334 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c100
1 files changed, 2 insertions, 98 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 74a914ca97..3b12ef1d42 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -72,11 +72,6 @@ typedef struct {
double inv_qp_sum;
int ip_count;
int b_count;
- // AVC data
- int got_avcC;
- int nal_length_size;
- void *data_bak;
- int len_bak;
} vd_ffmpeg_ctx;
//#ifdef FF_POSTPROCESS
@@ -322,7 +317,8 @@ static int init(sh_video_t *sh){
sh->format == mmioFOURCC('Z','L','I','B') ||
sh->format == mmioFOURCC('M','P','4','V') ||
sh->format == mmioFOURCC('F','L','I','C') ||
- sh->format == mmioFOURCC('S','N','O','W')
+ sh->format == mmioFOURCC('S','N','O','W') ||
+ sh->format == mmioFOURCC('a','v','c','1')
))
{
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
@@ -351,10 +347,6 @@ static int init(sh_video_t *sh){
memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size);
}
- if(sh->format == mmioFOURCC('a', 'v', 'c', '1')) {
- ctx->got_avcC = 0;
- }
-
if(sh->bih)
avctx->bits_per_sample= sh->bih->biBitCount;
@@ -695,35 +687,6 @@ typedef struct dp_hdr_s {
} dp_hdr_t;
-/**
- * Add sync to a nal and queue it in buffer, increasing buffer size as needed
- * @param dest pointer to current buffer area
- * @param destsize pointer to size of current dest area
- * @param source pointer to source nal data (after length bytes)
- * @param nal_len length of nal data
- */
-unsigned char* avc1_addnal(unsigned char *dest, int *destsize, unsigned char* source, int nal_len)
-{
- unsigned char *temp;
- int tempsize;
-
- tempsize = *destsize + nal_len + 4;
- temp = malloc (tempsize);
- if (dest)
- memcpy (temp, dest, *destsize);
- temp[*destsize] = 0;
- temp[*destsize+1] = 0;
- temp[*destsize+2] = 0;
- temp[*destsize+3] = 1;
- memcpy (temp + *destsize + 4, source, nal_len);
- if (dest)
- free(dest);
- *destsize = tempsize;
-
- return temp;
-}
-
-
// decode a frame
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
int got_picture=0;
@@ -783,68 +746,9 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
data+= sizeof(dp_hdr_t);
}
- /*
- * Convert avc1 nals to annexb nals (remove lenght, add sync)
- * If first frame extract and process avcC (configuration data)
- */
- if(sh->format == mmioFOURCC('a', 'v', 'c', '1')) {
- int bufsize = 0;
- int nalsize;
- unsigned char *p = data;
- int i;
- int cnt, poffs;
-
- // Remember original values
- ctx->data_bak = data;
- ctx->len_bak = len;
-
- if (!ctx->got_avcC) {
- // Parse some parts of avcC, just for fun :)
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC version: %d\n", *(p));
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC profile: %d\n", *(p+1));
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC profile compatibility: %d\n", *(p+2));
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC level: %d\n", *(p+3));
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC nal length size: %d\n", ctx->nal_length_size = ((*(p+4))&0x03)+1);
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC number of sequence param sets: %d\n", cnt = (*(p+5) & 0x1f));
- poffs = 6;
- for (i = 0; i < cnt; i++) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC sps %d have length %d\n", i, nalsize = BE_16(p+poffs));
- buf = avc1_addnal(buf, &bufsize, p + poffs + 2, nalsize);
- poffs += nalsize + 2;
- }
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC number of picture param sets: %d\n", *(p+poffs));
- poffs++;
- for (i = 0; i < cnt; i++) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] avcC pps %d have length %d\n", i, nalsize = BE_16(p+poffs));
- buf = avc1_addnal(buf, &bufsize, p + poffs + 2, nalsize);
- poffs += nalsize + 2;
- }
- p += poffs;
- ctx->got_avcC = 1;
- }
-
- while (p < (data + len)) {
- nalsize = 0;
- for(i = 0; i < ctx->nal_length_size; i++)
- nalsize = (nalsize << 8) | (*p++);
- mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "[ffmpeg] avc1: nalsize = %d\n", nalsize);
- buf = avc1_addnal(buf, &bufsize, p, nalsize);
- p += nalsize;
- len -= nalsize;
- }
- data = buf;
- len = bufsize;
- }
-
ret = avcodec_decode_video(avctx, pic,
&got_picture, data, len);
- if(sh->format == mmioFOURCC('a', 'v', 'c', '1')) {
- free(buf);
- data = ctx->data_bak;
- len = ctx->len_bak;
- }
-
dr1= ctx->do_dr1;
if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
//printf("repeat: %d\n", pic->repeat_pict);