Author: rolf
Date: 2008-01-24 04:55:17 -0500 (Thu, 24 Jan 2008)
New Revision: 93774

Removed:
   trunk/moon/src/asf/asf-ffmpeg.cpp
   trunk/moon/src/asf/asf-ffmpeg.h
Modified:
   trunk/moon/src/asf/ChangeLog
   trunk/moon/src/asf/asf-debug.h
   trunk/moon/src/asf/asf-generated.h
   trunk/moon/src/asf/asf-structures.cpp
   trunk/moon/src/asf/asf-test.cpp
   trunk/moon/src/asf/asf.cpp
Log:
* asf-ffmpeg.cpp, asf-ffmpeg.h: Removed, no longer needed.
* asf-generated.h, asf.cpp: Updated.
* asf-structures.cpp, asf-test.cpp, asf-debug.h: Use int*_t
  consistently.

Modified: trunk/moon/src/asf/ChangeLog
===================================================================
--- trunk/moon/src/asf/ChangeLog        2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/ChangeLog        2008-01-24 09:55:17 UTC (rev 93774)
@@ -1,3 +1,9 @@
+2008-01-24  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
+       * asf-ffmpeg.cpp, asf-ffmpeg.h: Removed, no longer needed.
+       * asf-generated.h, asf.cpp: Updated.
+       * asf-structures.cpp, asf-test.cpp, asf-debug.h: Use int*_t 
consistently.
+
 2008-01-23  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        * asf-test.cpp (test_file): use a FileSource so that we can get

Modified: trunk/moon/src/asf/asf-debug.h
===================================================================
--- trunk/moon/src/asf/asf-debug.h      2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf-debug.h      2008-01-24 09:55:17 UTC (rev 93774)
@@ -13,7 +13,6 @@
 
 #if DEBUG
 
-#include <glib.h>
 #include <stdio.h>
 
 class ObjectTracker {
@@ -42,7 +41,7 @@
                }
                
                if (list != NULL) {
-                       guint count = g_hash_table_size (list);
+                       int32_t count = g_hash_table_size (list);
                        if (count == 0) {
                                printf ("ObjectTracking::PrintStatus (%s): No 
unfreed objects.\n", tn);
                        } else {

Deleted: trunk/moon/src/asf/asf-ffmpeg.cpp
===================================================================
--- trunk/moon/src/asf/asf-ffmpeg.cpp   2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf-ffmpeg.cpp   2008-01-24 09:55:17 UTC (rev 93774)
@@ -1,746 +0,0 @@
-/*
- * asf-ffmpeg.cpp: 
- *   An asf demuxer for ffmpeg.
- *
- * Author: Rolf Bjarne Kvinge  ([EMAIL PROTECTED])
- *
- * Copyright 2007 Novell, Inc. (http://www.novell.com)
- *
- * See the LICENSE file included with the distribution for details.
- */
- 
-#include <config.h>
-
-#ifdef INCLUDE_FFMPEG
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include "asf-ffmpeg.h"
-
-#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
-
-#define FFMPEG_DUMP(...) printf (__VA_ARGS__)
-//ASF_DUMP(__VA_ARGS__)
-
-int ffmpeg_asf_probe(AVProbeData *pd)
-{
-       FFMPEG_LOG ("ffmpeg_asf_probe (%p), filename: %s, buf: %p, buf_size: 
%i\n", pd, pd->filename, pd->buf, pd->buf_size);
-       
-       char* env = getenv ("MOON_DEMUXER");
-       bool use_ffmpeg = false;
-       if (env == NULL || *env == 0) {
-               use_ffmpeg = false;
-       } else if (strcasecmp (env, "false") != 0 || 
-                       strcasecmp (env, "0") != 0 || 
-                       strcasecmp (env, "no") != 0 ||
-                       strcasecmp (env, "disable") != 0 ||
-                       strcasecmp (env, "disabled") != 0 ||
-                       strcasecmp (env, "ffmpeg") != 0) {
-               use_ffmpeg = true;
-       } else {
-               use_ffmpeg = false;
-       }
-       
-       if (use_ffmpeg) {
-               printf ("Using ffmpegs demuxer.\n");
-               return 0;
-       }
-       printf ("Using the moon demuxer. Set 'MOON_DEMUXER=false' to 
disable.\n");
-       
-       if ((size_t) pd->buf_size < sizeof (asf_guid))
-               return 0;
-               
-       if (asf_guid_compare (&asf_guids_header, (asf_guid*) pd->buf)) {
-               FFMPEG_LOG ("ffmpeg_asf_probe (%p): Success.\n", pd);
-               return AVPROBE_SCORE_MAX;
-       }
-       
-       return 0;
-}
-
-ASFParser* ffmpeg_asf_last_parser = NULL;
-
-ASFParser* 
-ffmpeg_asf_get_last_parser ()
-{
-       ASFParser* result = ffmpeg_asf_last_parser;
-       ffmpeg_asf_last_parser = NULL;
-       return result;
-}
-
-int ffmpeg_asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-       FFMPEG_LOG ("ffmpeg_asf_read_header (%p, %p).\n", s, ap);
-       
-       FFMPEGParser *parser = new FFMPEGParser (s->filename);
-       MoonASFContext *context = (MoonASFContext*) s->priv_data;
-       context->parser = parser;
-       
-       ffmpeg_asf_last_parser = parser;
-       
-       parser->source = new FFMPEGSource (parser,
-                                          &s->pb);
-       
-       if (!parser->ReadHeader ()) {
-               return -1;
-       }
-       
-       parser->reader->FindScriptCommandStream ();
-       
-       // Parse stream properties
-       int index;
-//     asf_object* obj = NULL;
-       asf_file_properties* file_properties = (asf_file_properties*) 
parser->GetHeaderObject (&asf_guids_file_properties);
-       
-       index = -1;
-       while ((index = parser->GetHeaderObjectIndex 
(&asf_guids_stream_properties, index + 1)) >= 0) {
-               asf_stream_properties* asp = (asf_stream_properties*) 
parser->GetHeader (index);
-               
-               
-               CodecType codec_type;
-               if (asf_guid_compare (&asf_guids_media_audio, 
&asp->stream_type)) {
-                       codec_type = CODEC_TYPE_AUDIO;
-               } else if (asf_guid_compare (&asf_guids_media_video, 
&asp->stream_type)) {
-                       codec_type = CODEC_TYPE_VIDEO;
-               } else {
-                       // Unknown stream type, ignore it.
-                       FFMPEG_LOG ("ffmpeg_asf_read_header (%p, %p): Unknown 
stream type: %s with index: %i.\n", s, ap, asf_guid_tostring 
(&asp->stream_type), index);
-                       continue;
-               }
-               
-               AVStream *stream = NULL;
-               stream = av_new_stream (s, 0);
-               if (!stream)
-                       goto fail;
-                       
-               av_set_pts_info(stream, 32, 1, 1000);
-               stream->priv_data = parser;
-               stream->codec->codec_type = codec_type;
-               stream->id = asp->get_stream_id ();
-               parser->AddStreamIndex (s->nb_streams - 1, asp->get_stream_id 
());
-               stream->start_time = file_properties->preroll;
-               
-               if (!file_properties->is_broadcast ()) {
-                       stream->duration = file_properties->play_duration / 
10000 - stream->start_time; /// (10000 /*000 / 1000*/) - 
file_properties->preroll;
-               }
-
-               if (codec_type == CODEC_TYPE_AUDIO) {
-                       FFMPEG_LOG ("Audio codec.\n");
-                       const WAVEFORMATEX* wave = asp->get_audio_data ();
-                       const WAVEFORMATEXTENSIBLE* wave_ex = 
wave->get_wave_format_extensible ();
-                       if (wave != NULL) {
-                               asf_dword id = wave->codec_id;
-                               int data_size = asp->size - sizeof 
(asf_stream_properties) - sizeof (WAVEFORMATEX);
-                               stream->codec->codec_type = CODEC_TYPE_AUDIO;
-                               stream->codec->codec_tag = wave->codec_id;
-                               stream->codec->channels = wave->channels;
-                               stream->codec->sample_rate = 
wave->samples_per_second;
-                               stream->codec->bit_rate = 
wave->bytes_per_second * 8;
-                               stream->codec->block_align = 
wave->block_alignment;
-                               stream->codec->bits_per_sample = 
wave->bits_per_sample;
-                               stream->codec->extradata_size = data_size > 
wave->codec_specific_data_size ? wave->codec_specific_data_size : data_size;
-                               stream->codec->extradata = NULL;
-                               if (wave_ex != NULL) {
-                                       stream->codec->bits_per_sample = 
wave_ex->Samples.valid_bits_per_sample;
-                                       stream->codec->extradata_size -= 
(sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX));
-                                       id = *((asf_dword*) 
&wave_ex->sub_format);
-                               }
-                               if (stream->codec->extradata_size > 0) {
-                                       stream->codec->extradata = (uint8_t*) 
av_mallocz (stream->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                                       char* src = ((char*) wave) + (wave_ex ? 
sizeof (WAVEFORMATEX) : sizeof (WAVEFORMATEX));
-                                       memcpy (stream->codec->extradata, src, 
stream->codec->extradata_size);
-                               }
-                               WAVEFORMATEX_dump (wave);
-                               //stream->codec->codec_id = wav_codec_get_id 
(id, stream->codec->bits_per_sample);
-                               stream->need_parsing = AVSTREAM_PARSE_FULL;
-                               stream->codec->frame_size = 1;
-                               FFMPEG_LOG ("Audio codec id: %i = %i.\n", 
stream->codec->codec_id, id);
-                               switch (id) {
-                               case 0x160:
-                                       stream->codec->codec_id = 
CODEC_ID_WMAV1;
-                                       break;
-                               case 0x161:
-                                       stream->codec->codec_id = 
CODEC_ID_WMAV2;
-                                       break;
-                               default:
-                                       FFMPEG_LOG ("Unknown audio codec: 
%i.\n", id);
-                                       goto fail;
-                               }
-                       }
-               } else if (codec_type == CODEC_TYPE_VIDEO) {
-                       FFMPEG_LOG ("Video codec.\n");
-                       const asf_video_stream_data* video_data = 
asp->get_video_data ();
-                       const BITMAPINFOHEADER* bmp;
-//                     asf_word id = 0;
-                       if (video_data != NULL) {
-                               bmp = video_data->get_bitmap_info_header ();
-                               if (bmp != NULL) {
-                                       stream->codec->width = bmp->image_width;
-                                       stream->codec->height = 
bmp->image_height;
-                                       stream->codec->bits_per_sample = 
bmp->bits_per_pixel;
-                                       stream->codec->codec_tag = 
bmp->compression_id;
-                                       stream->codec->extradata_size = 
bmp->get_extra_data_size ();
-                                       if (stream->codec->extradata_size > 0) {
-                                               stream->codec->extradata = 
(uint8_t*) av_mallocz (stream->codec->extradata_size + 
FF_INPUT_BUFFER_PADDING_SIZE);
-                                               memcpy 
(stream->codec->extradata, bmp->get_extra_data (), 
stream->codec->extradata_size);
-                                       } else {
-                                               stream->codec->extradata = NULL;
-                                       }
-                                       
-                                       FFMPEG_LOG ("Video codec tag: %i (%c %c 
%c %c).\n", stream->codec->codec_tag, *(char*) &stream->codec->codec_tag, *(1 + 
(char*) &stream->codec->codec_tag), *(2 + (char*) &stream->codec->codec_tag), 
*(3 + (char*) &stream->codec->codec_tag));
-                                       asf_video_stream_data_dump (video_data);
-                                       BITMAPINFOHEADER_dump (bmp);
-                                       
-                                       switch (stream->codec->codec_tag) {
-                                       case MKTAG('W', 'M', 'V', '1'): 
-                                               stream->codec->codec_id = 
CODEC_ID_WMV1; break;
-                                       case MKTAG('W', 'M', 'V', '2'):
-                                               stream->codec->codec_id = 
CODEC_ID_WMV2; break;
-                                       case MKTAG('W', 'M', 'V', '3'):
-                                               stream->codec->codec_id = 
CODEC_ID_WMV3; break;
-                                       case MKTAG('W', 'V', 'C', '1'):
-                                       case MKTAG('W', 'M', 'V', 'A'):
-                                               stream->codec->codec_id = 
CODEC_ID_VC1; break;
-                                       default:
-                                               FFMPEG_LOG ("Unknown video 
codec: %i (%c%c%c%c).\n", stream->codec->codec_tag, *(char*) 
&stream->codec->codec_tag, *(1 + (char*) &stream->codec->codec_tag), *(2 + 
(char*) &stream->codec->codec_tag), *(3 + (char*) &stream->codec->codec_tag));
-                                               goto fail;
-                                       }
-                               }
-                       }
-               } else {
-                       FFMPEG_LOG ("Unimplemented codec type: %i.\n", 
codec_type);
-                       goto fail;
-               }
-       }
-       
-       //AVFormatContext_dump (s);
-       
-       return 0;
-       
-fail:
-       ASF_ERROR_VAL (-1, "Failure cleanup not implemented.\n");
-       return -1;
-}
-
-int ffmpeg_asf_read_packet(AVFormatContext *s, AVPacket *av_packet)
-{
-       FFMPEG_LOG ("ffmpeg_asf_read_packet (%p, %p), parser: %p\n", s, 
av_packet, s->priv_data);
-       
-       MoonASFContext *context = (MoonASFContext*) s->priv_data;
-       FFMPEGParser* parser = context->parser;
-       ASFFrameReader* reader = parser->reader;
-
-       do {    
-               if (!reader->Advance ())
-                       return -1;
-       } while (parser->ConvertStreamIndex (reader->StreamId ()) < 0);
-       
-       AVPacket* pkt = new AVPacket ();
-       
-       av_new_packet (pkt, reader->Size ());
-       
-       pkt->pts = reader->Pts ();
-       pkt->dts = pkt->pts;
-       pkt->stream_index = parser->ConvertStreamIndex (reader->StreamId ()); 
-       pkt->pos = parser->source->Position ();
-       pkt->size = reader->Size ();
-       reader->Write (pkt->data);
-       if (reader->IsKeyFrame () || s->streams 
[pkt->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) {
-               pkt->flags |= PKT_FLAG_KEY;
-       }
-       //AVPacket_dump (pkt, 1);
-       
-       *av_packet = *pkt; 
-       
-       return 0;
-}
-
-int ffmpeg_asf_read_close(AVFormatContext *s)
-{
-       MoonASFContext* context = (MoonASFContext*) s->priv_data;
-       FFMPEGParser* parser = context->parser;
-       FFMPEG_LOG ("ffmpeg_asf_read_close (%p).\n", s);
-       
-       delete parser;
-       
-       return 0;
-}
-
-int ffmpeg_asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, 
int flags)
-{
-       MoonASFContext* context = (MoonASFContext*) s->priv_data;
-       FFMPEGParser* parser = context->parser;
-       
-       FFMPEG_LOG ("ffmpeg_asf_read_seek (%p, %i, %lld, %i).\n", s, 
stream_index, pts, flags);
-       
-       if (parser->reader->Seek (parser->ConvertFFMpegStreamIndex 
(stream_index), pts))
-               return 0;
-       
-       return -1;
-}
-
-int64_t ffmpeg_asf_read_pts(AVFormatContext *s, int ffmpeg_stream_index, 
int64_t *start_pos, int64_t pos_limit)
-{
-       MoonASFContext* context = (MoonASFContext*) s->priv_data;
-       FFMPEGParser* parser = context->parser;
-       
-       FFMPEG_LOG ("ffmpeg_asf_read_pts (%p, %i, %p (%lld), %lld).\n", s, 
ffmpeg_stream_index, start_pos, *start_pos, pos_limit);
-       
-       int64_t packet_index = 0;
-       int64_t packet_offset = 0;
-       int64_t pos = *start_pos;
-       asf_file_properties* file_properties = parser->GetFileProperties ();
-       
-       pos_limit = parser->packet_offset_end;
-       
-       // Find the packet at the start position
-       if (pos < (int64_t) parser->data_offset) {
-               FFMPEG_LOG ("ffmpeg_asf_read_pts: start position (%lld) is 
before start of data (%lld).\n", pos, parser->data_offset);
-               return AV_NOPTS_VALUE;
-       }
-       
-       packet_index = parser->GetPacketIndex (pos);
-       packet_offset = parser->GetPacketOffset (packet_index);
-       
-       FFMPEG_LOG ("ffmpeg_asf_read_pts: calculated packet index %lld and 
packet offset %lld.\n", packet_index, packet_offset);
-       
-       if (packet_index >= (int64_t) file_properties->data_packet_count) {
-               FFMPEG_LOG ("ffmpeg_asf_read_pts: calculated packet index 
(%lld) is more than packet count (%lld).\n", packet_index, 
file_properties->data_packet_count); 
-               return AV_NOPTS_VALUE;
-       }
-       
-       if (!parser->source->Seek (packet_offset, SEEK_SET)) {
-               FFMPEG_LOG ("ffmpeg_asf_read_pts: could not seek to position 
%lld.\n", packet_offset);
-               return AV_NOPTS_VALUE;
-       }
-       
-       int stream_index = parser->ConvertFFMpegStreamIndex 
(ffmpeg_stream_index);
-       if (stream_index == 0) {
-               FFMPEG_LOG ("ffmpeg_asf_read_pts: could not find asf stream of 
ffmpeg stream index %i.\n", ffmpeg_stream_index);
-               return AV_NOPTS_VALUE;
-       }
-       
-       FFMPEG_LOG ("ffmpeg_asf_read_pts: searching for pts of position %lld of 
asf stream %i.\n", *start_pos, stream_index); 
-       
-       bool is_audio_stream = parser->GetStream (stream_index)->is_audio ();
-       int64_t result = AV_NOPTS_VALUE;
-       while (packet_offset > pos_limit) {
-               packet_offset += file_properties->min_packet_size;
-               packet_index++;
-               
-               ASFPacket* packet = new ASFPacket ();
-               if (!parser->ReadPacket (packet)) {
-                       FFMPEG_LOG ("ffmpeg_asf_read_pts: could not read packet 
index %lld at position %lld.\n", packet_index, packet_offset);
-                       delete packet;
-                       return AV_NOPTS_VALUE;
-               }
-               
-               if (!is_audio_stream && !packet->payloads->is_key_frame 
(stream_index))
-                       continue;
-
-               *start_pos = packet_offset;
-               
-               result = packet->payloads->get_presentation_time (stream_index);
-               
-               delete packet;
-               
-               break;
-       }
-               
-       //FFMPEG_LOG ("fmpeg_asf_read_pts: found pts (%lld) of packet index 
%lld.\n", pts, packet_index);
-       
-       return result;
-}
-
-AVInputFormat ffmpeg_asf_demuxer = {
-    "asf",
-    "asf format",
-    sizeof(MoonASFContext),
-    ffmpeg_asf_probe,
-    ffmpeg_asf_read_header,
-    ffmpeg_asf_read_packet,
-    ffmpeg_asf_read_close,
-    ffmpeg_asf_read_seek,
-    ffmpeg_asf_read_pts,
-};
-
-
-
-
-
-
-void AVFormatContext_dump (AVFormatContext* s)
-{
-       int t = 1;
-       char* tabs = g_strnfill (t, '\t');
-       
-       FFMPEG_DUMP ("AVFormatContext: %p\n", s);
-       if (!s) return;
-
-
-       FFMPEG_DUMP ("%sav_class = %s\n", tabs, s->av_class == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%siformat = %s\n", tabs, s->iformat == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%soformat = %s\n", tabs, s->oformat == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%spriv_data = %s\n", tabs, s->priv_data == NULL ? "NULL" 
: "!NULL");
-       FFMPEG_DUMP ("%spb = <ByteIOContext>\n", tabs);
-       FFMPEG_DUMP ("%snb_streams = %u\n", tabs, s->nb_streams);
-       FFMPEG_DUMP ("%sstreams = %s\n", tabs, s->streams == NULL ? "NULL" : 
"!NULL");
-       for (guint32 i = 0; i < s->nb_streams; i++)
-               AVStream_dump (s->streams [i], 2);
-       FFMPEG_DUMP ("%sfilename = %s\n", tabs, s->filename);
-       FFMPEG_DUMP ("%stimestamp = %llu\n", tabs, s->timestamp);
-       FFMPEG_DUMP ("%stitle = %s\n", tabs, s->title);
-       FFMPEG_DUMP ("%sauthor = %s\n", tabs, s->author);
-       FFMPEG_DUMP ("%scopyright = %s\n", tabs, s->copyright);
-       FFMPEG_DUMP ("%scomment = %s\n", tabs, s->comment);
-       FFMPEG_DUMP ("%salbum = %s\n", tabs, s->album);
-       FFMPEG_DUMP ("%syear = %i\n", tabs, s->year);
-       FFMPEG_DUMP ("%strack = %i\n", tabs, s->track);
-       FFMPEG_DUMP ("%sgenre = %s\n", tabs, s->genre);
-       FFMPEG_DUMP ("%sctx_flags = %i\n", tabs, s->ctx_flags);
-       FFMPEG_DUMP ("%spacket_buffer = %s\n", tabs, s->packet_buffer == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sstart_time = %llu\n", tabs, s->start_time);
-       FFMPEG_DUMP ("%sduration = %llu\n", tabs, s->duration);
-       FFMPEG_DUMP ("%sfile_size = %llu\n", tabs, s->file_size);
-       FFMPEG_DUMP ("%sbit_rate = %i\n", tabs, s->bit_rate);
-       FFMPEG_DUMP ("%scur_st = %s\n", tabs, s->cur_st == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%scur_ptr = %s\n", tabs, s->cur_ptr == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%scur_len = %i\n", tabs, s->cur_len);
-       FFMPEG_DUMP ("%scur_pkt = <AVPacket>\n", tabs);
-       FFMPEG_DUMP ("%sdata_offset = %llu\n", tabs, s->data_offset);
-       FFMPEG_DUMP ("%sindex_built = %i\n", tabs, s->index_built);
-       FFMPEG_DUMP ("%smux_rate = %i\n", tabs, s->mux_rate);
-       FFMPEG_DUMP ("%spacket_size = %i\n", tabs, s->packet_size);
-       FFMPEG_DUMP ("%spreload = %i\n", tabs, s->preload);
-       FFMPEG_DUMP ("%smax_delay = %i\n", tabs, s->max_delay);
-       FFMPEG_DUMP ("%sloop_output = %i\n", tabs, s->loop_output);
-       FFMPEG_DUMP ("%sflags = %i\n", tabs, s->flags);
-       FFMPEG_DUMP ("%sloop_input = %i\n", tabs, s->loop_input);
-       FFMPEG_DUMP ("%sprobesize = %u\n", tabs, s->probesize);
-       FFMPEG_DUMP ("%smax_analyze_duration = %i\n", tabs, 
s->max_analyze_duration);
-       FFMPEG_DUMP ("%skey = %s\n", tabs, s->key == NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%skeylen = %i\n", tabs, s->keylen);
-
-}
-
-void AVRational_dump (AVRational s, int t)
-{
-       AVRational_dump (&s, t);
-}
-
-void AVRational_dump (AVRational* s, int t)
-{
-       char* tabs = g_strnfill (t, '\t');
-       //FFMPEG_DUMP ("%s" "AVRational: %p\n", tabs1, s);
-       //if (!s) return;
-       FFMPEG_DUMP ("%s num = %i, den = %i (as float: %f)\n", tabs, s->num, 
s->den, (float) s->num / (float) s->den);
- 
-}
-char* AVRational_tostring (AVRational s)
-{
-       return g_strdup_printf ("<AVRational: num = %i, den = %i, num/den = 
%f>", s.num, s.den, (float) s.num / (float) s.den);
-}
-
-char* AVFrac_tostring (AVFrac s)
-{
-       return g_strdup_printf ("<AVFrac: val = %lld, num = %lld, den = %lld, 
num/den = %f>", s.val, s.num, s.den, s.val + (float) s.num / (float) s.den);
-}
-
-void AVStream_dump (AVStream* s, int t)
-{
-       char* tabs = g_strnfill (t, '\t');
-       char* tabs1 = g_strnfill (t-1, '\t');
-       FFMPEG_DUMP ("%s" "AVStream: %p\n", tabs1, s);
-       if (!s) return;
-       FFMPEG_DUMP ("%sindex = %i\n", tabs, s->index);
-       FFMPEG_DUMP ("%sid = %i\n", tabs, s->id);
-       FFMPEG_DUMP ("%scodec = %s\n", tabs, s->codec == NULL ? "NULL" : 
"!NULL");
-       AVCodecContext_dump (s->codec, t+1);
-       FFMPEG_DUMP ("%sr_frame_rate = %s\n", tabs, AVRational_tostring 
(s->r_frame_rate));
-       FFMPEG_DUMP ("%spriv_data = %s\n", tabs, s->priv_data == NULL ? "NULL" 
: "!NULL");
-       //FFMPEG_DUMP ("%scodec_info_duration = %llu\n", tabs, 
s->codec_info_duration);
-       //FFMPEG_DUMP ("%scodec_info_nb_frames = %i\n", tabs, 
s->codec_info_nb_frames);
-       FFMPEG_DUMP ("%spts = %s\n", tabs, AVFrac_tostring (s->pts));
-       FFMPEG_DUMP ("%stime_base = %s\n", tabs, AVRational_tostring 
(s->time_base));
-       FFMPEG_DUMP ("%spts_wrap_bits = %i\n", tabs, s->pts_wrap_bits);
-       FFMPEG_DUMP ("%sstream_copy = %i\n", tabs, s->stream_copy);
-       FFMPEG_DUMP ("%sdiscard = %i\n", tabs, s->discard);
-       FFMPEG_DUMP ("%squality = %f\n", tabs, s->quality);
-       FFMPEG_DUMP ("%sstart_time = %llu\n", tabs, s->start_time);
-       FFMPEG_DUMP ("%sduration = %llu\n", tabs, s->duration);
-       FFMPEG_DUMP ("%slanguage = %s\n", tabs, s->language);
-       FFMPEG_DUMP ("%sneed_parsing = %i\n", tabs, s->need_parsing);
-       FFMPEG_DUMP ("%sparser = %s\n", tabs, s->parser == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%scur_dts = %llu\n", tabs, s->cur_dts);
-       FFMPEG_DUMP ("%slast_IP_duration = %i\n", tabs, s->last_IP_duration);
-       FFMPEG_DUMP ("%slast_IP_pts = %llu\n", tabs, s->last_IP_pts);
-       FFMPEG_DUMP ("%sindex_entries = %s\n", tabs, s->index_entries == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%snb_index_entries = %i\n", tabs, s->nb_index_entries);
-       FFMPEG_DUMP ("%sindex_entries_allocated_size = %u\n", tabs, 
s->index_entries_allocated_size);
-       FFMPEG_DUMP ("%snb_frames = %llu\n", tabs, s->nb_frames);
-       FFMPEG_DUMP ("%spts_buffer = %s\n", tabs, s->pts_buffer == NULL ? 
"NULL" : "!NULL");
-
-
-}
-
-
-void AVCodecContext_dump (AVCodecContext* s, int t)
-{
-       char* tabs = g_strnfill (t, '\t');
-       char* tabs1 = g_strnfill (t-1, '\t');
-       FFMPEG_DUMP ("%sAVCodecContext: %p\n", tabs1, s);
-       if (!s) return;
-       FFMPEG_DUMP ("%sav_class = %s\n", tabs, s->av_class == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%sbit_rate = %i\n", tabs, s->bit_rate);
-       FFMPEG_DUMP ("%sbit_rate_tolerance = %i\n", tabs, 
s->bit_rate_tolerance);
-       FFMPEG_DUMP ("%sflags = %i\n", tabs, s->flags);
-       FFMPEG_DUMP ("%ssub_id = %i\n", tabs, s->sub_id);
-       FFMPEG_DUMP ("%sme_method = %i\n", tabs, s->me_method);
-       FFMPEG_DUMP ("%sextradata = %s\n", tabs, s->extradata == NULL ? "NULL" 
: "!NULL");
-       FFMPEG_DUMP ("%sextradata_size = %i\n", tabs, s->extradata_size);
-       FFMPEG_DUMP ("%stime_base = %s\n", tabs, AVRational_tostring 
(s->time_base));
-       FFMPEG_DUMP ("%swidth = %i\n", tabs, s->width);
-       FFMPEG_DUMP ("%sgop_size = %i\n", tabs, s->gop_size);
-       FFMPEG_DUMP ("%spix_fmt = <PixelFormat>\n", tabs);
-       FFMPEG_DUMP ("%srate_emu = %i\n", tabs, s->rate_emu);
-       FFMPEG_DUMP ("%sdraw_horiz_band = %s\n", tabs, s->draw_horiz_band == 
NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%ssample_rate = %i\n", tabs, s->sample_rate);
-       FFMPEG_DUMP ("%schannels = %i\n", tabs, s->channels);
-       FFMPEG_DUMP ("%ssample_fmt = <SampleFormat>\n", tabs);
-       FFMPEG_DUMP ("%sframe_size = %i\n", tabs, s->frame_size);
-       FFMPEG_DUMP ("%sframe_number = %i\n", tabs, s->frame_number);
-       FFMPEG_DUMP ("%sreal_pict_num = %i\n", tabs, s->real_pict_num);
-       FFMPEG_DUMP ("%sdelay = %i\n", tabs, s->delay);
-       FFMPEG_DUMP ("%sqcompress = %f\n", tabs, s->qcompress);
-       FFMPEG_DUMP ("%sqblur = %f\n", tabs, s->qblur);
-       FFMPEG_DUMP ("%sqmin = %i\n", tabs, s->qmin);
-       FFMPEG_DUMP ("%sqmax = %i\n", tabs, s->qmax);
-       FFMPEG_DUMP ("%smax_qdiff = %i\n", tabs, s->max_qdiff);
-       FFMPEG_DUMP ("%smax_b_frames = %i\n", tabs, s->max_b_frames);
-       FFMPEG_DUMP ("%sb_quant_factor = %f\n", tabs, s->b_quant_factor);
-       FFMPEG_DUMP ("%src_strategy = %i\n", tabs, s->rc_strategy);
-       FFMPEG_DUMP ("%sb_frame_strategy = %i\n", tabs, s->b_frame_strategy);
-       FFMPEG_DUMP ("%shurry_up = %i\n", tabs, s->hurry_up);
-       FFMPEG_DUMP ("%scodec = %s\n", tabs, s->codec == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%spriv_data = %s\n", tabs, s->priv_data == NULL ? "NULL" 
: "!NULL");
-       FFMPEG_DUMP ("%srtp_mode = %i\n", tabs, s->rtp_mode);
-       FFMPEG_DUMP ("%srtp_payload_size = %i\n", tabs, s->rtp_payload_size);
-       FFMPEG_DUMP ("%srtp_callback = %s\n", tabs, s->rtp_callback == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%smv_bits = %i\n", tabs, s->mv_bits);
-       FFMPEG_DUMP ("%sheader_bits = %i\n", tabs, s->header_bits);
-       FFMPEG_DUMP ("%si_tex_bits = %i\n", tabs, s->i_tex_bits);
-       FFMPEG_DUMP ("%sp_tex_bits = %i\n", tabs, s->p_tex_bits);
-       FFMPEG_DUMP ("%si_count = %i\n", tabs, s->i_count);
-       FFMPEG_DUMP ("%sp_count = %i\n", tabs, s->p_count);
-       FFMPEG_DUMP ("%sskip_count = %i\n", tabs, s->skip_count);
-       FFMPEG_DUMP ("%smisc_bits = %i\n", tabs, s->misc_bits);
-       FFMPEG_DUMP ("%sframe_bits = %i\n", tabs, s->frame_bits);
-       FFMPEG_DUMP ("%sopaque = %s\n", tabs, s->opaque == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%scodec_name = %s\n", tabs, s->codec_name);
-       FFMPEG_DUMP ("%scodec_type = %i\n", tabs, s->codec_type);
-       FFMPEG_DUMP ("%scodec_id = %i\n", tabs, s->codec_id);
-       FFMPEG_DUMP ("%scodec_tag = %u\n", tabs, s->codec_tag);
-       FFMPEG_DUMP ("%sworkaround_bugs = %i\n", tabs, s->workaround_bugs);
-       FFMPEG_DUMP ("%sluma_elim_threshold = %i\n", tabs, 
s->luma_elim_threshold);
-       FFMPEG_DUMP ("%schroma_elim_threshold = %i\n", tabs, 
s->chroma_elim_threshold);
-       FFMPEG_DUMP ("%sstrict_std_compliance = %i\n", tabs, 
s->strict_std_compliance);
-       FFMPEG_DUMP ("%sb_quant_offset = %f\n", tabs, s->b_quant_offset);
-       FFMPEG_DUMP ("%serror_resilience = %i\n", tabs, s->error_resilience);
-       FFMPEG_DUMP ("%sget_buffer = %s\n", tabs, s->get_buffer == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%srelease_buffer = %s\n", tabs, s->release_buffer == NULL 
? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%shas_b_frames = %i\n", tabs, s->has_b_frames);
-       FFMPEG_DUMP ("%sblock_align = %i\n", tabs, s->block_align);
-       FFMPEG_DUMP ("%sparse_only = %i\n", tabs, s->parse_only);
-       FFMPEG_DUMP ("%smpeg_quant = %i\n", tabs, s->mpeg_quant);
-       FFMPEG_DUMP ("%sstats_out = %s\n", tabs, s->stats_out);
-       FFMPEG_DUMP ("%sstats_in = %s\n", tabs, s->stats_in);
-       FFMPEG_DUMP ("%src_qsquish = %f\n", tabs, s->rc_qsquish);
-       FFMPEG_DUMP ("%src_qmod_amp = %f\n", tabs, s->rc_qmod_amp);
-       FFMPEG_DUMP ("%src_qmod_freq = %i\n", tabs, s->rc_qmod_freq);
-       FFMPEG_DUMP ("%src_override = %s\n", tabs, s->rc_override == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%src_override_count = %i\n", tabs, s->rc_override_count);
-       FFMPEG_DUMP ("%src_eq = %s\n", tabs, s->rc_eq);
-       FFMPEG_DUMP ("%src_max_rate = %i\n", tabs, s->rc_max_rate);
-       FFMPEG_DUMP ("%src_min_rate = %i\n", tabs, s->rc_min_rate);
-       FFMPEG_DUMP ("%src_buffer_size = %i\n", tabs, s->rc_buffer_size);
-       FFMPEG_DUMP ("%src_buffer_aggressivity = %f\n", tabs, 
s->rc_buffer_aggressivity);
-       FFMPEG_DUMP ("%si_quant_factor = %f\n", tabs, s->i_quant_factor);
-       FFMPEG_DUMP ("%si_quant_offset = %f\n", tabs, s->i_quant_offset);
-       FFMPEG_DUMP ("%src_initial_cplx = %f\n", tabs, s->rc_initial_cplx);
-       FFMPEG_DUMP ("%sdct_algo = %i\n", tabs, s->dct_algo);
-       FFMPEG_DUMP ("%slumi_masking = %f\n", tabs, s->lumi_masking);
-       FFMPEG_DUMP ("%stemporal_cplx_masking = %f\n", tabs, 
s->temporal_cplx_masking);
-       FFMPEG_DUMP ("%sspatial_cplx_masking = %f\n", tabs, 
s->spatial_cplx_masking);
-       FFMPEG_DUMP ("%sp_masking = %f\n", tabs, s->p_masking);
-       FFMPEG_DUMP ("%sdark_masking = %f\n", tabs, s->dark_masking);
-       FFMPEG_DUMP ("%sunused = %i\n", tabs, s->unused);
-       FFMPEG_DUMP ("%sidct_algo = %i\n", tabs, s->idct_algo);
-       FFMPEG_DUMP ("%sslice_count = %i\n", tabs, s->slice_count);
-       FFMPEG_DUMP ("%sslice_offset = %s\n", tabs, s->slice_offset == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%serror_concealment = %i\n", tabs, s->error_concealment);
-       FFMPEG_DUMP ("%sdsp_mask = %u\n", tabs, s->dsp_mask);
-       FFMPEG_DUMP ("%sbits_per_sample = %i\n", tabs, s->bits_per_sample);
-       FFMPEG_DUMP ("%sprediction_method = %i\n", tabs, s->prediction_method);
-       FFMPEG_DUMP ("%ssample_aspect_ratio = %s\n", tabs, AVRational_tostring 
(s->sample_aspect_ratio));
-       FFMPEG_DUMP ("%scoded_frame = %s\n", tabs, s->coded_frame == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sdebug = %i\n", tabs, s->debug);
-       FFMPEG_DUMP ("%sdebug_mv = %i\n", tabs, s->debug_mv);
-       FFMPEG_DUMP ("%serror = %s\n", tabs, s->error == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%smb_qmin = %i\n", tabs, s->mb_qmin);
-       FFMPEG_DUMP ("%smb_qmax = %i\n", tabs, s->mb_qmax);
-       FFMPEG_DUMP ("%sme_cmp = %i\n", tabs, s->me_cmp);
-       FFMPEG_DUMP ("%sme_sub_cmp = %i\n", tabs, s->me_sub_cmp);
-       FFMPEG_DUMP ("%smb_cmp = %i\n", tabs, s->mb_cmp);
-       FFMPEG_DUMP ("%sildct_cmp = %i\n", tabs, s->ildct_cmp);
-       FFMPEG_DUMP ("%sdia_size = %i\n", tabs, s->dia_size);
-       FFMPEG_DUMP ("%slast_predictor_count = %i\n", tabs, 
s->last_predictor_count);
-       FFMPEG_DUMP ("%spre_me = %i\n", tabs, s->pre_me);
-       FFMPEG_DUMP ("%sme_pre_cmp = %i\n", tabs, s->me_pre_cmp);
-       FFMPEG_DUMP ("%spre_dia_size = %i\n", tabs, s->pre_dia_size);
-       FFMPEG_DUMP ("%sme_subpel_quality = %i\n", tabs, s->me_subpel_quality);
-       FFMPEG_DUMP ("%sget_format = %s\n", tabs, s->get_format == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sdtg_active_format = %i\n", tabs, s->dtg_active_format);
-       FFMPEG_DUMP ("%sme_range = %i\n", tabs, s->me_range);
-       FFMPEG_DUMP ("%sintra_quant_bias = %i\n", tabs, s->intra_quant_bias);
-       FFMPEG_DUMP ("%sinter_quant_bias = %i\n", tabs, s->inter_quant_bias);
-       FFMPEG_DUMP ("%scolor_table_id = %i\n", tabs, s->color_table_id);
-       FFMPEG_DUMP ("%sinternal_buffer_count = %i\n", tabs, 
s->internal_buffer_count);
-       FFMPEG_DUMP ("%sinternal_buffer = %s\n", tabs, s->internal_buffer == 
NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%sglobal_quality = %i\n", tabs, s->global_quality);
-       FFMPEG_DUMP ("%scoder_type = %i\n", tabs, s->coder_type);
-       FFMPEG_DUMP ("%scontext_model = %i\n", tabs, s->context_model);
-       FFMPEG_DUMP ("%sslice_flags = %i\n", tabs, s->slice_flags);
-       FFMPEG_DUMP ("%sxvmc_acceleration = %i\n", tabs, s->xvmc_acceleration);
-       FFMPEG_DUMP ("%smb_decision = %i\n", tabs, s->mb_decision);
-       FFMPEG_DUMP ("%sintra_matrix = %s\n", tabs, s->intra_matrix == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sinter_matrix = %s\n", tabs, s->inter_matrix == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sstream_codec_tag = %u\n", tabs, s->stream_codec_tag);
-       FFMPEG_DUMP ("%sscenechange_threshold = %i\n", tabs, 
s->scenechange_threshold);
-       FFMPEG_DUMP ("%slmin = %i\n", tabs, s->lmin);
-       FFMPEG_DUMP ("%slmax = %i\n", tabs, s->lmax);
-       FFMPEG_DUMP ("%spalctrl = %s\n", tabs, s->palctrl == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%snoise_reduction = %i\n", tabs, s->noise_reduction);
-       FFMPEG_DUMP ("%sreget_buffer = %s\n", tabs, s->reget_buffer == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%src_initial_buffer_occupancy = %i\n", tabs, 
s->rc_initial_buffer_occupancy);
-       FFMPEG_DUMP ("%sinter_threshold = %i\n", tabs, s->inter_threshold);
-       FFMPEG_DUMP ("%sflags2 = %i\n", tabs, s->flags2);
-       FFMPEG_DUMP ("%serror_rate = %i\n", tabs, s->error_rate);
-       FFMPEG_DUMP ("%santialias_algo = %i\n", tabs, s->antialias_algo);
-       FFMPEG_DUMP ("%squantizer_noise_shaping = %i\n", tabs, 
s->quantizer_noise_shaping);
-       FFMPEG_DUMP ("%sthread_count = %i\n", tabs, s->thread_count);
-       FFMPEG_DUMP ("%sexecute = %s\n", tabs, s->execute == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%sthread_opaque = %s\n", tabs, s->thread_opaque == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sme_threshold = %i\n", tabs, s->me_threshold);
-       FFMPEG_DUMP ("%smb_threshold = %i\n", tabs, s->mb_threshold);
-       FFMPEG_DUMP ("%sintra_dc_precision = %i\n", tabs, 
s->intra_dc_precision);
-       FFMPEG_DUMP ("%snsse_weight = %i\n", tabs, s->nsse_weight);
-       FFMPEG_DUMP ("%sskip_top = %i\n", tabs, s->skip_top);
-       FFMPEG_DUMP ("%sskip_bottom = %i\n", tabs, s->skip_bottom);
-       FFMPEG_DUMP ("%sprofile = %i\n", tabs, s->profile);
-       FFMPEG_DUMP ("%slevel = %i\n", tabs, s->level);
-       FFMPEG_DUMP ("%slowres = %i\n", tabs, s->lowres);
-       FFMPEG_DUMP ("%scoded_width = %i\n", tabs, s->coded_width);
-       FFMPEG_DUMP ("%sframe_skip_threshold = %i\n", tabs, 
s->frame_skip_threshold);
-       FFMPEG_DUMP ("%sframe_skip_factor = %i\n", tabs, s->frame_skip_factor);
-       FFMPEG_DUMP ("%sframe_skip_exp = %i\n", tabs, s->frame_skip_exp);
-       FFMPEG_DUMP ("%sframe_skip_cmp = %i\n", tabs, s->frame_skip_cmp);
-       FFMPEG_DUMP ("%sborder_masking = %f\n", tabs, s->border_masking);
-       FFMPEG_DUMP ("%smb_lmin = %i\n", tabs, s->mb_lmin);
-       FFMPEG_DUMP ("%smb_lmax = %i\n", tabs, s->mb_lmax);
-       FFMPEG_DUMP ("%sme_penalty_compensation = %i\n", tabs, 
s->me_penalty_compensation);
-       FFMPEG_DUMP ("%sskip_loop_filter = %i\n", tabs, s->skip_loop_filter);
-       FFMPEG_DUMP ("%sskip_idct = %i\n", tabs, s->skip_idct);
-       FFMPEG_DUMP ("%sskip_frame = %i\n", tabs, s->skip_frame);
-       FFMPEG_DUMP ("%sbidir_refine = %i\n", tabs, s->bidir_refine);
-       FFMPEG_DUMP ("%sbrd_scale = %i\n", tabs, s->brd_scale);
-       FFMPEG_DUMP ("%scrf = %f\n", tabs, s->crf);
-       FFMPEG_DUMP ("%scqp = %i\n", tabs, s->cqp);
-       FFMPEG_DUMP ("%skeyint_min = %i\n", tabs, s->keyint_min);
-       FFMPEG_DUMP ("%srefs = %i\n", tabs, s->refs);
-       FFMPEG_DUMP ("%schromaoffset = %i\n", tabs, s->chromaoffset);
-       FFMPEG_DUMP ("%sbframebias = %i\n", tabs, s->bframebias);
-       FFMPEG_DUMP ("%strellis = %i\n", tabs, s->trellis);
-       FFMPEG_DUMP ("%scomplexityblur = %f\n", tabs, s->complexityblur);
-       FFMPEG_DUMP ("%sdeblockalpha = %i\n", tabs, s->deblockalpha);
-       FFMPEG_DUMP ("%sdeblockbeta = %i\n", tabs, s->deblockbeta);
-       FFMPEG_DUMP ("%spartitions = %i\n", tabs, s->partitions);
-       FFMPEG_DUMP ("%sdirectpred = %i\n", tabs, s->directpred);
-       FFMPEG_DUMP ("%scutoff = %i\n", tabs, s->cutoff);
-       FFMPEG_DUMP ("%sscenechange_factor = %i\n", tabs, 
s->scenechange_factor);
-       FFMPEG_DUMP ("%smv0_threshold = %i\n", tabs, s->mv0_threshold);
-       FFMPEG_DUMP ("%sb_sensitivity = %i\n", tabs, s->b_sensitivity);
-       FFMPEG_DUMP ("%scompression_level = %i\n", tabs, s->compression_level);
-       FFMPEG_DUMP ("%suse_lpc = %i\n", tabs, s->use_lpc);
-       FFMPEG_DUMP ("%slpc_coeff_precision = %i\n", tabs, 
s->lpc_coeff_precision);
-       FFMPEG_DUMP ("%smin_prediction_order = %i\n", tabs, 
s->min_prediction_order);
-       FFMPEG_DUMP ("%smax_prediction_order = %i\n", tabs, 
s->max_prediction_order);
-       FFMPEG_DUMP ("%sprediction_order_method = %i\n", tabs, 
s->prediction_order_method);
-       FFMPEG_DUMP ("%smin_partition_order = %i\n", tabs, 
s->min_partition_order);
-       FFMPEG_DUMP ("%smax_partition_order = %i\n", tabs, 
s->max_partition_order);
-       FFMPEG_DUMP ("%stimecode_frame_start = %llu\n", tabs, 
s->timecode_frame_start);
-
-
-}
-
-void AVPacket_dump (AVPacket* s, int t)
-{
-       char* tabs = g_strnfill (t, '\t');
-       char* tabs1 = g_strnfill (t-1, '\t');
-       FFMPEG_DUMP ("%sAVPacket: %s\n", tabs1, s == NULL ? "NULL" : "!NULL");
-       if (!s) return;
-       
-       FFMPEG_DUMP ("%spts = %llu\n", tabs, s->pts);
-       FFMPEG_DUMP ("%sdts = %llu\n", tabs, s->dts);
-       FFMPEG_DUMP ("%sdata = %s\n", tabs, s->data == NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%ssize = %i\n", tabs, s->size);
-       FFMPEG_DUMP ("%sstream_index = %i\n", tabs, s->stream_index);
-       FFMPEG_DUMP ("%sflags = %i\n", tabs, s->flags);
-       FFMPEG_DUMP ("%sduration = %i\n", tabs, s->duration);
-       FFMPEG_DUMP ("%sdestruct = %s\n", tabs, s->destruct == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%spriv = %s\n", tabs, s->priv == NULL ? "NULL" : "!NULL");
-       // FFMPEG_DUMP ("%spos = %lld\n", tabs, s->pos); // Byte position in 
stream, demuxer dependent.
-
-       
-}
-
-void AVFrame_dump (AVFrame* s, int t)
-{
-       char* tabs = g_strnfill (t, '\t');
-       char* tabs1 = g_strnfill (t-1, '\t');
-       FFMPEG_DUMP ("%sAVFrame: %s\n", tabs1, s == NULL ? "NULL" : "!NULL");
-       if (!s) return;
-       
-       FFMPEG_DUMP ("%sdata = %s\n", tabs, s->data == NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%slinesize = %i %i %i %i\n", tabs, s->linesize [0], 
s->linesize [1], s->linesize [2], s->linesize [3]);
-       FFMPEG_DUMP ("%sbase = %s\n", tabs, s->base == NULL ? "NULL" : "!NULL");
-       FFMPEG_DUMP ("%skey_frame = %i\n", tabs, s->key_frame);
-       FFMPEG_DUMP ("%spict_type = %i\n", tabs, s->pict_type);
-       FFMPEG_DUMP ("%spts = %lld\n", tabs, s->pts);
-       FFMPEG_DUMP ("%scoded_picture_number = %i\n", tabs, 
s->coded_picture_number);
-       FFMPEG_DUMP ("%sdisplay_picture_number = %i\n", tabs, 
s->display_picture_number);
-       FFMPEG_DUMP ("%squality = %i\n", tabs, s->quality);
-       FFMPEG_DUMP ("%sage = %i\n", tabs, s->age);
-       FFMPEG_DUMP ("%sreference = %i\n", tabs, s->reference);
-       FFMPEG_DUMP ("%sqscale_table = %s\n", tabs, s->qscale_table == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%sqstride = %i\n", tabs, s->qstride);
-       FFMPEG_DUMP ("%smbskip_table = %s\n", tabs, s->mbskip_table == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%smotion_val = %s\n", tabs, s->motion_val == NULL ? 
"NULL" : "!NULL");
-       FFMPEG_DUMP ("%smb_type = %s\n", tabs, s->mb_type == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%smotion_subsample_log2 = %i\n", tabs, (int) 
s->motion_subsample_log2);
-       FFMPEG_DUMP ("%sopaque = %s\n", tabs, s->opaque == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%serror = %llu %llu %llu %llu\n", tabs, s->error [0], 
s->error [1], s->error [2], s->error [3]);
-       FFMPEG_DUMP ("%stype = %i\n", tabs, s->type);
-       FFMPEG_DUMP ("%srepeat_pict = %i\n", tabs, s->repeat_pict);
-       FFMPEG_DUMP ("%sqscale_type = %i\n", tabs, s->qscale_type);
-       FFMPEG_DUMP ("%sinterlaced_frame = %i\n", tabs, s->interlaced_frame);
-       FFMPEG_DUMP ("%stop_field_first = %i\n", tabs, s->top_field_first);
-       FFMPEG_DUMP ("%span_scan = %s\n", tabs, s->pan_scan == NULL ? "NULL" : 
"!NULL");
-       FFMPEG_DUMP ("%spalette_has_changed = %i\n", tabs, 
s->palette_has_changed);
-       FFMPEG_DUMP ("%sbuffer_hints = %i\n", tabs, s->buffer_hints);
-       FFMPEG_DUMP ("%sdct_coeff = %s\n", tabs, s->dct_coeff == NULL ? "NULL" 
: "!NULL");
-       FFMPEG_DUMP ("%sref_index = %s\n", tabs, s->ref_index == NULL ? "NULL" 
: "!NULL");
-
-       
-}
-
-#endif // INCLUDE_FFMPEG

Deleted: trunk/moon/src/asf/asf-ffmpeg.h
===================================================================
--- trunk/moon/src/asf/asf-ffmpeg.h     2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf-ffmpeg.h     2008-01-24 09:55:17 UTC (rev 93774)
@@ -1,171 +0,0 @@
-/*
- * asf-ffmpeg.h: 
- *   An asf demuxer for ffmpeg.
- *
- * Author: Rolf Bjarne Kvinge  ([EMAIL PROTECTED])
- *
- * Copyright 2007 Novell, Inc. (http://www.novell.com)
- *
- * See the LICENSE file included with the distribution for details.
- */
- 
-#ifdef INCLUDE_FFMPEG
-
-#ifndef _ASF_FFMPEG_MOONLIGHT_H
-#define _ASF_FFMPEG_MOONLIGHT_H
-
-#if log_ffmpeg || true
-#define FFMPEG_LOG(...) ASF_LOG (__VA_ARGS__)
-#else
-#define FFMPEG_LOG(...)
-#endif
-
-extern "C" 
-{
-#include "avio.h"
-#include "avformat.h"
-}
-
-#include "asf.h"
-#include <glib.h>
-
-void AVFormatContext_dump (AVFormatContext* c);
-void AVStream_dump (AVStream* s, int t);
-void AVCodecContext_dump (AVCodecContext* s, int t);
-void AVPacket_dump (AVPacket* s, int t);
-void AVRational_dump (AVRational* s, int t);
-void AVRational_dump (AVRational s, int t);
-void AVFrame_dump (AVFrame* s, int t);
-char* AVRational_tostring (AVRational s);
-char* AVFrac_tostring (AVFrac s);
-
-int ffmpeg_asf_probe(AVProbeData *pd);
-int ffmpeg_asf_read_header(AVFormatContext *s, AVFormatParameters *ap);
-int ffmpeg_asf_read_packet(AVFormatContext *s, AVPacket *pkt);
-int ffmpeg_asf_read_close(AVFormatContext *s);
-int ffmpeg_asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, 
int flags);
-int64_t ffmpeg_asf_read_pts(AVFormatContext *s, int stream_index, int64_t 
*ppos, int64_t pos_limit);
-
-ASFParser* ffmpeg_asf_get_last_parser ();
-
-class FFMPEGParser;
-
-struct MoonASFContext {
-       FFMPEGParser* parser;
-};
-
-extern AVInputFormat ffmpeg_asf_demuxer;
-
-class FFMPEGPacket : public ASFPacket {
-public:
-       FFMPEGPacket ()
-       {
-               current_payload = 0;
-       }
-       virtual ~FFMPEGPacket ()
-       {
-       }
-       
-       // Initialized to 0
-       // Set to -1 when all payloads have been read.
-       int current_payload;
-};
-
-class FFMPEGParser : public ASFParser {
-public:
-       FFMPEGParser (const char* filename) : ASFParser (filename)
-       {
-               memset (ffmpeg_stream_indices, -1, 128);
-               reader = new ASFFrameReader (this);
-       }
-       
-       virtual ~FFMPEGParser ()
-       {
-               delete reader;
-               reader = NULL;
-       }
-       
-       void AddStreamIndex (gint32 ffmpeg_stream_index, gint32 
asf_stream_index)
-       {
-               // asf_stream_index range from 1 to 127
-               if (asf_stream_index < 1 || asf_stream_index > 127) {
-                       FFMPEG_LOG ("FFMPEGParser::AddStreamIndex (%i, %i): 
Invalid asf stream index.\n", ffmpeg_stream_index, asf_stream_index);
-                       return;
-               }
-                       
-               FFMPEG_LOG ("FFMPEGParser::AddStreamIndex (%i, %i).\n", 
ffmpeg_stream_index, asf_stream_index);
-               ffmpeg_stream_indices [asf_stream_index] = ffmpeg_stream_index;
-       }
-       
-       gint32 ConvertStreamIndex (gint32 asf_stream_index)
-       {
-               if (asf_stream_index < 1 || asf_stream_index > 127) {
-                       FFMPEG_LOG ("FFMPEGParser::ConvertStreamIndex (%i, %i): 
Invalid asf stream index.\n", asf_stream_index, asf_stream_index);
-                       return -1;
-               }
-               
-               FFMPEG_LOG ("FFMPEGParser::ConvertStreamIndex (%i): %i.\n", 
asf_stream_index, ffmpeg_stream_indices [asf_stream_index]);
-               return ffmpeg_stream_indices [asf_stream_index];
-       }
-       
-       gint32 ConvertFFMpegStreamIndex (gint32 ffmpeg_stream_index)
-       {
-               FFMPEG_LOG ("FFMPEGParser::ConvertFFMpegStreamIndex (%i).\n", 
ffmpeg_stream_index);
-               for (int i = 1; i < 128; i++) {
-                       gint32 val = ffmpeg_stream_indices [i];
-                       FFMPEG_LOG ("FFMPEGParser::ConvertFFMPegStreamIndex 
(%i), i = %i, value = %i.\n", ffmpeg_stream_index, i,val);
-                       if (val == ffmpeg_stream_index) 
-                               return i;
-               }
-               return 0; // 0 is not a valid asf stream index.
-       }
-       
-       gint32 ffmpeg_stream_indices [128];
-       
-       ASFFrameReader* reader;
-};
-
-class FFMPEGSource : public ASFSource {
-public:
-       FFMPEGSource (ASFParser* parser, ByteIOContext* buffer)
-               : ASFSource (parser)
-       {
-               this->buffer = buffer;
-       }
-       
-       virtual ~FFMPEGSource () { };
-       
-       ByteIOContext* GetBuffer ()
-       {
-               return buffer;
-       }
-       
-       virtual bool ReadInternal (void* destination, uint32_t bytes)
-       {
-               int result;
-               result = get_buffer (buffer, (unsigned char*) destination, 
(int) bytes);
-               return result != 0; // Is this correct
-       }
-       
-       virtual bool SeekInternal (int64_t offset, int mode)
-       {
-               int64_t result = url_fseek (buffer, offset, mode);
-               
-               return result; // Is this correct?
-       }
-       
-       virtual bool Eof () { return url_feof (buffer); }
-       virtual bool CanSeek () { return true; }
-       
-       virtual int64_t Position () 
-       {
-               return buffer ? (buffer->pos - (buffer->buf_end - 
buffer->buf_ptr)) : 0;
-       }
-       
-private:
-       ByteIOContext* buffer;
-};
-
-#endif
-
-#endif // INCLUDE_FFMPEG

Modified: trunk/moon/src/asf/asf-generated.h
===================================================================
--- trunk/moon/src/asf/asf-generated.h  2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf-generated.h  2008-01-24 09:55:17 UTC (rev 93774)
@@ -39,7 +39,6 @@
 
 class ASFSource;
 class ASFMediaSource;
-class ASFFileSource;
 class ASFPacket;
 class ASFFrameReader;
 class ASFParser;

Modified: trunk/moon/src/asf/asf-structures.cpp
===================================================================
--- trunk/moon/src/asf/asf-structures.cpp       2008-01-24 09:50:47 UTC (rev 
93773)
+++ trunk/moon/src/asf/asf-structures.cpp       2008-01-24 09:55:17 UTC (rev 
93774)
@@ -722,7 +722,7 @@
                asf_word length = * (asf_word*) start;
                
                // Verify data
-               size_requested = sizeof (asf_word) + sizeof (guint16) * length;
+               size_requested = sizeof (asf_word) + sizeof (uint16_t) * length;
                if (size_requested > size_left) {
                        parser->AddError ("Data corruption in script command.");
                        goto failure;
@@ -741,9 +741,9 @@
                
                char* tmp = (char*) next;
                tmp += sizeof (asf_script_command_entry);
-               tmp += (next->name_length * sizeof (guint16));
+               tmp += (next->name_length * sizeof (uint16_t));
                
-               size_requested = sizeof (asf_script_command_entry) + 
next->name_length * sizeof (guint16);
+               size_requested = sizeof (asf_script_command_entry) + 
next->name_length * sizeof (uint16_t);
                if (size_requested > size_left) {
                        parser->AddError ("Data corruption in script command.");
                        goto failure;

Modified: trunk/moon/src/asf/asf-test.cpp
===================================================================
--- trunk/moon/src/asf/asf-test.cpp     2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf-test.cpp     2008-01-24 09:55:17 UTC (rev 93774)
@@ -108,7 +108,7 @@
        }
        srand (time (0));
        
-       guint8 byte;
+       uint8_t byte;
        int random_value;
        
        while (fread (&byte, 1, 1, in) == 1) {
@@ -116,7 +116,7 @@
                random_value = rand ();
                total++;
                
-               guint8 c [2];
+               uint8_t c [2];
                unsigned int cc = 1;
 
                c [0] = byte;
@@ -134,12 +134,12 @@
                                case 1: // write garbage
                                        trashed++;
                                        cc = 1;
-                                       c [0] ^= (guint8) rand ();
+                                       c [0] ^= (uint8_t) rand ();
                                        break;
                                case 2: // write an extra byte
                                        added++;
                                        cc = 2;
-                                       c [1] = (guint8) rand ();
+                                       c [1] = (uint8_t) rand ();
                                        break;
                                case 3: // write an extra byte (copying)
                                        added++;

Modified: trunk/moon/src/asf/asf.cpp
===================================================================
--- trunk/moon/src/asf/asf.cpp  2008-01-24 09:50:47 UTC (rev 93773)
+++ trunk/moon/src/asf/asf.cpp  2008-01-24 09:55:17 UTC (rev 93774)
@@ -903,7 +903,7 @@
        printf ("\n");
 */
 //     printf ("ASFFrameReader::Advance (): frame data: size = %.4lld, key = 
%s, pts = %.5llu, stream# = %i, media_object_number = %.3u, 
script_command_stream_index = %u (advanced).\n", 
-//             size, IsKeyFrame () ? "true " : "false", Pts (), StreamNumber 
(), media_object_number, script_command_stream_index);
+//             size, IsKeyFrame () ? "true " : "false", Pts (), StreamId (), 
media_object_number, script_command_stream_index);
 
 
        // Check if the current frame is a script command, in which case we 
must call the callback set in 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to