LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-27-2003, 01:47 PM   #1
Radicalm16
Member
 
Registered: Jan 2003
Location: Venezuela
Distribution: Debian, Ubuntu
Posts: 75

Rep: Reputation: 15
DivX.com Codecs and Xine


I downloaded and installed the lastest version of Xine. I installed also the Divx4linux actual version.

Now, How can I use DivX.com codecs with Xine???

I know i have Divx compabilty on Xine through ffmpeg codecs, but I just want to give a try to DivX.com codecs.

Radicalm16
 
Old 06-27-2003, 06:57 PM   #2
cropcircle
Member
 
Registered: Jun 2003
Location: Netherlands
Distribution: Red Hat Linux 9, FreeBSD 4.8, Knoppix 3.2
Posts: 182

Rep: Reputation: 30
Hmmm.. difficult. Your favorite Linux media player must have support for (read: reverse enginered) those specific Win32 codecs.

(
Although, maybe you want to go with the 'Win32 codecs' :
http://www.mplayerhq.hu/homepage/design6/dload.html

Download the .bz2 files and uncompress in your preffered path.

Recompile xine with "--with-w32-path=path".
)
 
Old 06-27-2003, 07:11 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you don't use divx.com... both xine and mplayer (which is much much better) use ffmpeg to play divx files, and it's performance easily outstrips the "official" codecs.
 
Old 01-27-2009, 06:01 AM   #4
m1chae1
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
DivX 6.1.1 codec for Linux developers divx.com/DivXLinuxCodec

Code:
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#define LOG_MODULE "divx_decoder"
#define LOG_VERBOSE
/*
#define LOG
*/

#include "xine_internal.h"
#include "video_out.h"
#include "buffer.h"

#include "LibQDec.h"

typedef struct {
    long        biSize;
    long        biWidth;
    long        biHeight;
    short       biPlanes;
    short       biBitCount;
    long        biCompression;
    long        biSizeImage;
    long        biXPelsPerMeter;
    long        biYPelsPerMeter;
    long        biClrUsed;
    long        biClrImportant;
} BITMAPINFOHEADER;

typedef struct {
  video_decoder_class_t   decoder_class;
} divx_class_t;

typedef struct divxdec_decoder_s {
  video_decoder_t   video_decoder;
  xine_stream_t     *stream;
  divx_class_t      *class;
  BITMAPINFOHEADER  bih;
  int               video_step;
  int               decoder_ok;
  int               size;
  int               bufsize;
  long		    biWidth;
  long		    biHeight;
  unsigned char     *buf;
  void              *pHandle;
  LibQDecoreFunction *pDecore;
} divxdec_decoder_t;

#define VIDEOBUFSIZE 128*1024

static unsigned long str2ulong(void *data) {
  unsigned char *str = data;
  return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );
}

static int divxdec_init (divxdec_decoder_t *this, buf_element_t *buf) {
  DecInit decInit;

  memset(&decInit, 0, sizeof(DecInit));

  memcpy ( &this->bih, buf->content, sizeof (BITMAPINFOHEADER));
  this->biWidth = str2ulong(&this->bih.biWidth);
  this->biHeight = str2ulong(&this->bih.biHeight);
  this->video_step = buf->decoder_info[1];

  decInit.formatIn.width=this->biWidth;
  decInit.formatIn.height=this->biHeight;
  decInit.formatIn.fourCC=str2ulong("DX50");
  decInit.formatOut.width=this->biWidth;
  decInit.formatOut.height=this->biHeight;
  decInit.formatOut.fourCC=str2ulong("YV12");
  this->pDecore=getDecore(decInit.formatIn.fourCC);

  if(this->pDecore(NULL, DEC_OPT_INIT, (void*) &this->pHandle, &decInit)!=DEC_OK){
    return 0;
  }

  return 1; 
}

static void divxdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
  DecFrame decFrame;
  vo_frame_t *img;

  divxdec_decoder_t *this = (divxdec_decoder_t *) this_gen;

  if (buf->decoder_flags & BUF_FLAG_PREVIEW)
    return;

  if (buf->decoder_flags & BUF_FLAG_HEADER) { /* need to initialize */
    this->decoder_ok = divxdec_init (this, buf);
    if (this->decoder_ok) {
      if( this->buf )
        free( this->buf );
    
      this->buf = malloc( VIDEOBUFSIZE );
      this->bufsize = VIDEOBUFSIZE;
    }
    return;
  }

  if (!this->decoder_ok) {
    return;
  }

  memset(&decFrame, 0, sizeof(DecFrame));

  if( this->size + buf->size > this->bufsize ) {
    this->bufsize = this->size + 2 * buf->size;
    this->buf = realloc( this->buf, this->bufsize );
  }

  xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
  this->size += buf->size;

  if (buf->decoder_flags & BUF_FLAG_FRAMERATE)
    this->video_step = buf->decoder_info[0];

  if (buf->decoder_flags & BUF_FLAG_FRAME_END)  { /* need to decode a frame */
    img = this->stream->video_out->get_frame (this->stream->video_out, 
						this->biWidth,
						this->biHeight, 
						(double)this->biWidth/(double)this->biHeight,
						XINE_IMGFMT_YV12,
						VO_BOTH_FIELDS);

    img->pts = buf->pts;
    img->duration = this->video_step;
    decFrame.bitstream.iLength=this->size;
    decFrame.bitstream.pBuff=this->buf;
    decFrame.pBmp=img->base[0];

    if(this->pDecore(this->pHandle,DEC_OPT_FRAME,&decFrame,0)!=DEC_OK) {
      img->bad_frame = 1;
    }

    if(decFrame.frameWasDecoded) {
      img->bad_frame = img->draw(img,this->stream);
    }
    img->free(img);

    this->size = 0;
  }

}

static void divxdec_flush (video_decoder_t *this_gen) {
}

static void divxdec_reset (video_decoder_t *this_gen) {
}

static void divxdec_discontinuity (video_decoder_t *this_gen) {
}

static void divxdec_dispose (video_decoder_t *this_gen) {
  divxdec_decoder_t *this = (divxdec_decoder_t *) this_gen;

  if(this->pDecore(this->pHandle, DEC_OPT_RELEASE, 0, 0)!=DEC_OK) {
   this->decoder_ok = 0;
 }

  this->stream->video_out->close(this->stream->video_out, this->stream);

  free (this);
}

static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) {
  divxdec_decoder_t *this ;

  this = (divxdec_decoder_t *) calloc(1, sizeof(divxdec_decoder_t));

  this->video_decoder.decode_data         = divxdec_decode_data;
  this->video_decoder.flush               = divxdec_flush;
  this->video_decoder.reset               = divxdec_reset;
  this->video_decoder.discontinuity       = divxdec_discontinuity;
  this->video_decoder.dispose             = divxdec_dispose;
  this->stream                            = stream;
  this->class                             = (divx_class_t *) class_gen;

  this->decoder_ok = 0;
  this->size = 0;
  this->pHandle = NULL;

  (stream->video_out->open) (stream->video_out, stream);

  return &this->video_decoder;
}

/*
 * divx plugin class
 */

static char *get_identifier (video_decoder_class_t *this) {
  return "divxdec";
}

static char *get_description (video_decoder_class_t *this) {
  return "divx based video decoder plugin";
}

static void dispose_class (video_decoder_class_t *this) {
  free (this);
}

static void *init_plugin (xine_t *xine, void *data) {

  divx_class_t *this;

  this = (divx_class_t *) calloc(1, sizeof(divx_class_t));

  this->decoder_class.open_plugin     = open_plugin;
  this->decoder_class.get_identifier  = get_identifier;
  this->decoder_class.get_description = get_description;
  this->decoder_class.dispose         = dispose_class;

  return this;
}
/*
 * exported plugin catalog entry
 */

static uint32_t supported_types[] = {
  BUF_VIDEO_DIVX5,
  BUF_VIDEO_XVID,
  0 };

static const decoder_info_t dec_info_divx = {
  supported_types,     /* supported types */
  7                    /* priority        */
};

const plugin_info_t xine_plugin_info[] EXPORTED = {
  /* type, API, "name", version, special_info, init_function */  
  { PLUGIN_VIDEO_DECODER, 18, "divx", XINE_VERSION_CODE, &dec_info_divx, init_plugin },
  { PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xine mpeg codecs(including Divx)?? DJOtaku Linux - Software 21 11-19-2004 07:30 PM
kaffeine xvid,divx codecs c0d3-z3r0 Linux - Newbie 1 10-01-2004 03:09 PM
Divx 5 for Xine Player jaccon Linux - Software 6 06-08-2004 10:48 AM
how do i install divx codecs in suse 9.0 54az Linux - Newbie 1 02-28-2004 03:13 PM
xine divx subtitle??? perdesiz Linux - Software 0 09-18-2003 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration